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

Add show-icon setting for keyboard-layout applet #466

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

kostoskistefan
Copy link

@kostoskistefan kostoskistefan commented Oct 4, 2023

Description

This pull request adds an option to show/hide the icon of the keyboard-layout applet. I think it's a nice option to have and it is especially useful for smaller screens, where we need all the space we can get for other applets on the panel.

Additionally, I also noticed that the icon for the applet was a bit off in a vertical panel, therefore I've changed the code that handles the margins based on the orientation.

Keep in mind that I've only started using Budgie a week ago and I'm not very familiar with the code. I used the other applets as a reference to implement this feature. If there's anything wrong with the code I wrote, please let me know, I'd love to learn more and improve!

Submitter Checklist

  • Squashed commits with git rebase -i (if needed)
  • Built budgie-desktop and verified that the patch worked (if needed)

@JoshStrobl JoshStrobl requested review from JoshStrobl and a team October 4, 2023 11:44
@serebit
Copy link
Member

serebit commented Oct 4, 2023

Code looks good at a glance (especially for a first attempt!), but will need to clone and properly test this.

Copy link
Member

@serebit serebit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works perfectly as far as I can tell, but the settings page doesn't look right - looking at the XML, it doesn't use the same widgets/margins as the other built-in applets' settings pages. I'd recommend copying another applet's settings.ui, like the tray applet, and just replace the labels/controls with the one you've implemented. Just for consistency's sake, that's all.

@serebit serebit added the enhancement New feature or request label Oct 15, 2023
@kostoskistefan
Copy link
Author

First of all, thank you for testing the code and notifying me about the inconsistencies.

I've changed the ui file based on the tray applet as you've suggested and I've also compared it to some other applets (like the clock applet for example). After recompiling and testing the code, the margins seem to be correct and consistent with the other applets.

Please let me know if there's anything else that needs to be done!

Copy link
Member

@JoshStrobl JoshStrobl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Did some cleanup of the spacing on the applet layout children while I was pixel peeping. Will be consistent now.

Settings section looked good too.

kostoskistefan and others added 3 commits October 16, 2023 20:15
This will ensure spacing between widgets is consistent regardless of layout and we don't have to do anything strange with margin start / ends
@kostoskistefan
Copy link
Author

Hey Josh, thanks for checking out the code.

I compiled and ran your changes and noticed something.

Whenever the icon is shown, everything looks great. If I hide the icon, there's a 2px margin on the left side of the text, which makes it look a bit uneven. Looking at it using the GTK Inspector, I can see that the horizontal box that contains the GTK Image and GTK Stack has a left margin of 2px set inside the theme_3.20.css file. Since this is the compiled css file, I did some minor digging and found out that it is actually set in the src/theme/common/widgets/_base.scss file and it looks like the following: &.horizontal > widget > widget > * { margin-left: 2px; }.

In the GTK Inspector I added a red border around all of the elements inside the keyboard-indicator applet just so you can better see the left margin that I'm talking about:
Icon shown: image
Icon hidden: image

Here's what happens if I directly set the margin to 0 within the GTK Inspector:
Icon shown: image
Icon hidden: image

Just for completeness sake, here's what I'm actually doing with the CSS inside the GTK Inspector:

.keyboard-indicator * {
    border: 1px solid red;
}

.keyboard-indicator .horizontal {
    margin: 0;
}

And here is my panels' applet order from left to right: system tray, keyboard indicator, status indicator, network, spacer, clock, raven and the user indicator applet.

Could you please confirm/deny that this happens on other systems as well and it's not something specific to my system and the gtk theme that I am using?

Please let me know what you think and what the next steps should be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants