Skip to content
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

fix(bar): normalize areas of widgets #1190

Merged
merged 11 commits into from
Dec 20, 2024

Conversation

alex-ds13
Copy link
Contributor

This commit changes the way each of the 3 parts of potential widgets (left, center and right) is created so that they are all done on the same way and look the same. It is using Area with different anchors for each part which makes the widgets actually center vertically properly.

This created an issue with the Bar grouping. To fix it we've made the Bar grouping change the outer panel frame instead of creating an actual group. This has the side effect (or maybe feature!) of losing the background of the outer frame. Meaning this outer frame will now have the look of the Bar grouping only. Currently it is using a fixed outer margin but this can be changed in the future to a config option.

@alex-ds13 alex-ds13 force-pushed the fix(bar)/use-all-areas branch from b4c4afd to bf2c3ea Compare December 18, 2024 16:39
This commit changes the way each of the 3 parts of potential widgets
(left, center and right) is created so that they are all done on the
same way and look the same. It is using `Area` with different anchors
for each part which makes the widgets actually center vertically
properly.

This created an issue with the `Bar` grouping. To fix it we've made the
`Bar` grouping change the outer panel frame instead of creating an
actual group. This has the side effect (or maybe feature!) of losing the
background of the outer frame. Meaning this outer frame will now have
the look of the `Bar` grouping only. Currently it is using a fixed outer
margin but this can be changed in the future to a config option.
@alex-ds13 alex-ds13 force-pushed the fix(bar)/use-all-areas branch from bf2c3ea to a5e522b Compare December 18, 2024 17:04
@alex-ds13 alex-ds13 marked this pull request as ready for review December 18, 2024 19:40
@alex-ds13 alex-ds13 force-pushed the fix(bar)/use-all-areas branch from 12d9a21 to f173cbc Compare December 18, 2024 20:15
@LGUG2Z
Copy link
Owner

LGUG2Z commented Dec 18, 2024

error: this function has too many arguments (9/7)
   --> komorebi-bar\src\komorebi.rs:494:5
    |
494 | /     pub fn handle_notification(
495 | |         &mut self,
496 | |         ctx: &Context,
497 | |         monitor_index: usize,
...   |
503 | |         default_theme: Option<KomobarTheme>,
504 | |     ) {
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
    = note: `-D clippy::too-many-arguments` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::too_many_arguments)]`

This is fine to annotate with #[allow(clippy::too_many_arguments)]

@CtByte
Copy link
Contributor

CtByte commented Dec 18, 2024

My shaking is gone when I change the layout for the right alignment like this:

image

There is some spacing issue I need to look into, but at least the shaking is gone. The spacing is easily seen by adding "widget_spacing": 20, to the config. You can also see this on the video with the interface section

Recording.2024-12-19.095609.mp4

@alex-ds13 alex-ds13 force-pushed the fix(bar)/use-all-areas branch from 74add21 to 6f7dc31 Compare December 19, 2024 09:03
Previously if we changed/set the theme on `komorebi.json` it would apply
that theme to the bar without taking into account the transparency
alpha, also after removing the `theme` from `komorebi.json` file it
wasn't applying the theme from the bar config. This commit fixes these
issues.
Previously when reading the `theme` from `komorebi.json` it was also
getting the transparency_alpha from the `StaticConfig`, this is wrong,
it should use the alpha from the bar config. This commit fixes that.
Group roundings were getting lost when applying the theme after a
`komorebi.json` change/save trigger. Now we reapply these groupings on
the `apply_theme` to make sure they are always correct.
There were some cases were the bar was showing some shaking, turns out
that using `ui.with_layout` instead of `ui.horizontal_centered` removes
this shaking, so this commit makes that change and uses the
`right_to_left` layout on the right widgets again, meaning that we need
to reverse them again.
@alex-ds13 alex-ds13 force-pushed the fix(bar)/use-all-areas branch from 7d136c2 to b489be5 Compare December 19, 2024 16:20
On some computers the context colors were being reset on the very first
frame. So now we try to apply the theme on the first frame and
afterwards we only do it again when there is a config change or a theme
socket message.
@alex-ds13
Copy link
Contributor Author

Should be ready to merge now. But if you can do a quick test first on your system can't hurt to make sure this last commit didn't break anything elsewhere.

@LGUG2Z LGUG2Z merged commit 5ab5ec4 into LGUG2Z:master Dec 20, 2024
6 checks passed
@alex-ds13 alex-ds13 deleted the fix(bar)/use-all-areas branch December 20, 2024 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants