-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better default text formatting #78
Conversation
currently set to 5 lines max, but we'll see if it's possible to add customizability later
I'm kinda struggling to deal w/ the semi-diverging histories here. 4da6094 shouldn't do anything when applied to here, it's basically just to re-sync my fork. Not sure how to get rid of it lol |
I thought the elipsization edit would be quick and easy, but I'm getting a weird bug in the notification center with the fonts:
The glade files don't say anything about font sizing, so I assume that this happens somewhere. I don't think it's a config issue. Not sure where it's coming from, though. It looks like the font sizes for the time labels for the notif center and the notif have switched completely. |
Might be cleaner going through code. There's a |
Alright, I'm starting to think that this might be some weird bug on my machine, or just some weird bug in general, because I tried testing this with the following edit, and it should literally just be the same code that's currently on diff --git a/src/NotificationCenter/Notifications/NotificationPopup.hs b/src/NotificationCenter/Notifications/NotificationPopup.hs
index d4ac9c1..4334372 100644
--- a/src/NotificationCenter/Notifications/NotificationPopup.hs
+++ b/src/NotificationCenter/Notifications/NotificationPopup.hs
@@ -85,13 +85,13 @@ showNotificationWindow config noti dispNotis onClose = do
dispNotiWithoutHeight
lblBody = (flip view) dispNoti $ dLabelBody
- labelSetEllipsize lblBody EllipsizeModeEnd
+ -- labelSetEllipsize lblBody EllipsizeModeEnd
-- if configPopupEllipsizeBody config
-- then EllipsizeModeEnd
-- else EllipsizeModeNone
-- TODO: Integrate w/ config
- labelSetLines lblBody 5
+ -- labelSetLines lblBody 5
setWidgetWidthRequest mainWindow $ fromIntegral $ configWidthNoti config @phuhl I don't wanna bother you, but could you do me a huge favor and try running this on your machine to see if it gives u this bug? I really just wanna move past this rn, and I have no clue where it could be coming from. |
Compiles and runs without that wierd bug, but also it does not ellipzise on my machine... Don't know if i am doing smth wrong? Edit: ahum, wrong branch, nevermind |
That error exists on the base branch already |
Yeah, quite sure, the bug was introduced in d5fd02f which I carelessly merged because I though reading the changes is sufficient. Sorry bout that. |
Patch style.css and it works: .time {
- font-size: replaceme0027;
+ font-size: replaceme0028;
}
.noti-center.time {
- font-size: replaceme0028;
+ font-size: replaceme0027;
}
|
Prob shouldn't have fixed in master, u should have write perms for this PR. Lemme try to merge the master in. |
Merge style.css patch
Nice, this patch is working for me too! Thanks for the work @phuhl! Still getting that notification area bug though. That'll probably be for another PR. |
If the max lines specified by the user was not -1, we can infer that they don't want to ellipsize.
WARNING: THIS COMMIT ADDS A KNOWN BUG Getting this bug where none of the action buttons show up on notifications with action buttons. Added some print statements to unify the debugging experience.
Alright, I just pushed the changes I made to the glade, and to the code in To reproduce this bug:
notify-send.py "Lorem" "Lorem Ipsum" \
-a 'lorem' -i 'text-plain' \
--action '1:Action One' '2:Action Two' &
This bug only happens when the structure of the glade is changed. See the table below for a better understanding about how the structure of the glade has been changed by commit 8405e75: View Table
Ultimately, I really don't know where this bug could be coming from. I can always revert 8405e75 and submit this PR without the improved button box formatting, but if we do want this feature (which we should, since it looks way better IMO), I really need some guidance @phuhl. |
I think that I do still wanna go through with this, but it's taking too long to implement for the scope of #75. It might make more sense to live as its own being, or as a part of #77, since it'd be the first step to implementing that anyways. I'll revert this commit and do some last look-overs. Otherwise, this PR is basically done. |
I think, splitting this into two PRs is a good idea! Btw, I also know now, why your buttons don't appear. It is not, because they are hidden, but because of the rather hacky way that I use to set the notification size. Look at line 176 of NotificationPopup.hs. It returns the height of the notification by receiving the preferred height for a set width. I do it like that, because at the point of writing, gtk did not have a feature to set the width directly, only the height. What I did is the following: Get the "preferred height" at the desired width. Set the height to the preferred height and hope, that the width is correct then. That is also the reason why the notification center bugs arround in #40 I think. Anyways, back to your buttons. I set the height of the notification by setting it on the label in the background (that is the only reason why it is there). Since you changed the glade's layout, the buttons are not taken into account when calculating the height so they stick out to the bottom of the notification. To prove it: return (a + 100) and find that your buttons are totally visible. |
Some more pointers here (and also the reasons why I did not implement image align as center by default): When not setting a line limit, it is buggy! I don't know how to fix it. Actually, it seems to be buggy even with Config:
|
I will leave this open for now. I don't know a solution for the vertical centering of the image. But I'd like to know your opinion before moving on. My concern here is, that we already have a good selection of bugs and I am not sure if it is beneficial to push a broken-ish feature just to have more configuration options. But I also see, that you might be able to hack-config your way around this (which is a terrible UX though). |
Lol yeah I ran into some weird UX with margins and centered images. I'll look over some of these bugs later |
Alright, I was able to reproduce some of the bugs you talked about! I have a few notes:
I still can't reproduce the first image. I'll work on getting to the bottom of the other one though. |
I think that the image cutoff one is bugged cause of the getHeight function, as you talked about: linux_notification_center/src/NotificationCenter/Notifications/NotificationPopup.hs Lines 173 to 176 in 499c75b
Could we just directly set the height to |
no, i think this was an the commit after the revert. But it might actually be the same bug, just with more extreme visuals. When the IMG is centered, somehow the container it is centered in behaives as if it was twice as high as the notification or something like that. so, more lines of text -> more offset (I think) |
Not sure what you mean... |
Not sure if it is due to that, but if it was like that, your proposal would be fine for now. |
Not rly sure what I thought I meant, either. I kinda feel like the height setting stuff is where most of our problems come from, so I wanna try to see if I can't just let it do its thing. I mean, don't Gtk elements naturally grow to encompass everything they need? i might fiddle around w/ it to see if that's where the bug is. If I can't implement this by the end of the week, I might just gut the vertical alignment bits and just ship the margins & text ellipsization, since those two solve a lot of the problems that I have with the current layout. |
Didn't get any time, so since it's friday, I'll prob gut the alignment stuff rn and open a new issue for it. It'll just be the ellipsization and margins, which IMO make for an OK experience anyways. |
@phuhl lmk if any of these bugs persist, or if new bugs appear! |
thanks for the merge! 🚀 |
Better default text formatting Former-commit-id: 01f2367
Closes #75.
Body text shouldn't grow the size of the notification. Instead, it should be cutoff with
(...)
at about 2-5 linesThe image should be centered vertically by defaultThere should definitely be a setting for vertically centering the image, or having it in the corner, etc.Deemed out of scope / not enough time to implement. See discussion: Better default text formatting #78 (comment)
There should be configurable margins around the image.
New Config vars
(Also, I turned the
BEGIN_EXAMPLE
block into aBEGIN_SRC ini
in the readme, so we can have some nice syntax highlighting for the example config :D)