-
Notifications
You must be signed in to change notification settings - Fork 597
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
Center systray vertically #3860
base: master
Are you sure you want to change the base?
Conversation
Hi There, I'm not a lua programmer, just modified the code for myself, and thought it might be useful. Cheers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not fundamentally opposed to this change. But it would be a behavior change I think we don't want to make now.
Anyway, AFAICT, icons in the systray are all supposed to be squares of the same size. So whatever the base_size
is, icons are always equally placed in. Hence there is no need to center them. Am I missing something?
lib/wibox/widget/systray.lua
Outdated
@@ -66,6 +66,7 @@ function systray:draw(context, cr, width, height) | |||
local cols = math.ceil(num_entries / rows) | |||
local bg = beautiful.bg_systray or beautiful.bg_normal or "#000000" | |||
local spacing = beautiful.systray_icon_spacing or 0 | |||
local y_offset = ((height - base_size) / 2) - 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think base_size
is nil
if the user hasn't manually changed it before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CI confirms that
2023-10-02T18:16:23.2795466Z 56 tests finished.
2023-10-02T18:16:23.2796918Z There were 1 errors:
2023-10-02T18:16:23.2806984Z - /home/runner/work/awesome/awesome/tests/test-systray.lua: 2023-10-02 18:16:16 E: awesome: Error during a protected call: lib/wibox/widget/systray.lua:69: attempt to perform arithmetic on a nil value (upvalue 'base_size')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aire-One i'm not sure if it has something to do with DPI support across GUI toolkits, or otherwise related to systray implementation in the apps - but the problem indeed real, some apps getting smaller icons than others
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, wrong thread, i thought i'm replying to #3860 (review)
This is my reasoning:
That's why I've created this change. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3860 +/- ##
==========================================
- Coverage 91.22% 91.21% -0.02%
==========================================
Files 927 927
Lines 59493 59512 +19
==========================================
+ Hits 54275 54282 +7
- Misses 5218 5230 +12
Flags with carried forward coverage won't be shown. Click here to find out more.
|
i'd rather make it optional |
Please take a look at my screenshots:
Cheers, |
I get "The provided host name is not valid for this server." when trying to access those images. And maybe use https? |
Hi, I have uploaded the screenshots into google drive: https://drive.google.com/drive/folders/1dDN8Td_QqbTvBC1gTbEjiEto8F1T5gaI?usp=drive_link I recap the reasoning:
Hope it works now. Cheers, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @actionless suggested, let's make this change optional.
For this specific use case, where the icons are all the same size, And even for that case, it shouldn't just be "centered vs not centered". It should be the same API as https://awesomewm.org/apidoc/widget_containers/wibox.container.place.html#valign. |
good point about "porting" full |
I have set
in my theme.lua Now the entire wibar has changed, and some properties are not set up correctly (font is not set, layout icon is missing, etc.). No error message, though. See the screenshot: https://drive.google.com/file/d/1AnXgfUZov4fvsrtfIclGbNKlMCGIqU4l/view?usp=drive_link What did I do wrong? Thanks. |
Merge from central.
If the user sets the systay size with systray:set_base_size(...), then this change centers the systray vertically.
Removed trailing whitespace. Co-authored-by: Aire-One <aireone@aireone.xyz>
66ec890
to
ead4fc3
Compare
Removed unnecessary whitespces.
If the user sets the systay size with systray:set_base_size(...), then this change centers the systray vertically.