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 a bridge between gsettings and labwc #643

Merged
merged 10 commits into from
Jan 11, 2025
Merged

Add a bridge between gsettings and labwc #643

merged 10 commits into from
Jan 11, 2025

Conversation

fossfreedom
Copy link
Contributor

@fossfreedom fossfreedom commented Dec 18, 2024

Description

This PR provides a bridge between gsettings changes and the labwc equivalents.

labwc config files are environment and rc.xml located in your home folder.

The bridge listens to various gsettings schemas, looks to see if there is an equivalent labwc setting and changes that in the configuration files. A call to labwc -r is used to reload the configuration file to apply the changes.

This is a one-way bridge - gsettings are applied to labwc - manual changes to those config files are not reflected back to gsettings.

On first login, the home folder configuration files are copied from budgie templates held in /usr/share/budgie-desktop.

Note - for distros, those templates can be prefixed with "distro-" located in the same shared folder and this is used in instead of the default template - i.e. allows distros to tailor what labwc configuration results.

The nominal supported gsettings supported are too numerous to list here - the areas covered in the bridge are

  1. GNOME window management keybindings as set by BCC such as window tiling and workspace switching
  2. Some accessibility options such as magnifier
  3. media keys on the keyboard - this is likely to be a distro configuration for their defaults
  4. Budgie keybindings, again can be set in BCC as well as those just defined in gsettings keys
  5. most BCC mouse configuration options
  6. most BCC touchpad configuration options
  7. Many budgie desktop settings options that previously invoked mutter changes
  8. Many budgie desktop settings that invoked budgie specific capabilities such as opening notification and applet view
  9. Brightness control and volume control - the latter assumes gsd-power is running
  10. Theme changes set the labwc theme name - i.e. this assumes that the theme in use has an openbox theme available
  11. Number of workspaces
  12. Add window rules to force nemo-desktop to the bottom layer i.e. allow desktop icons to function correctly
  13. Add window rules to force budgie-daemon and budgie-power-dialog windows to be centered - strictly speaking we should look at using layers-shell changes here but this is a quick win for the moment

Submitter Checklist

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

@fossfreedom fossfreedom marked this pull request as ready for review December 20, 2024 16:37
@JoshStrobl JoshStrobl self-requested a review December 20, 2024 19:54
@JoshStrobl JoshStrobl added this to the 10.10 milestone Dec 20, 2024
So if a media key has not been specifically defined the bridge
should grab the -static key equivalent.
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.

Great work! Will need to test it out after some of the changes :)

src/bridges/labwc/rc.xml Outdated Show resolved Hide resolved
src/bridges/labwc/labwc_bridge.py Outdated Show resolved Hide resolved
src/bridges/labwc/labwc_bridge.py Outdated Show resolved Hide resolved
src/bridges/labwc/labwc_bridge.py Outdated Show resolved Hide resolved
src/bridges/labwc/labwc_bridge.py Outdated Show resolved Hide resolved
src/bridges/labwc/labwc_bridge.py Outdated Show resolved Hide resolved
@JoshStrobl JoshStrobl self-requested a review January 4, 2025 19:57
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.

@fossfreedom While testing it, I had an import error on the systemd module. I suspect we should check that python3-systemd is installed alongside any other python3 modules that aren't part of the python3 base install. Will install them on my system to test further.

Jan 11 12:21:51 minion org.buddiesofbudgie.labwc-bridge.desktop[15756]: Traceback (most recent call last):
Jan 11 12:21:51 minion org.buddiesofbudgie.labwc-bridge.desktop[15756]:   File "/usr/libexec/budgie-desktop/labwc_bridge.py", line 16, in <module>
Jan 11 12:21:51 minion org.buddiesofbudgie.labwc-bridge.desktop[15756]:     from systemd.journal import JournalHandler
Jan 11 12:21:51 minion org.buddiesofbudgie.labwc-bridge.desktop[15756]: ModuleNotFoundError: No module named 'systemd'

@JoshStrobl
Copy link
Member

Interestingly I already had python3-systemd installed. What python modules did you need for this to work?

@fossfreedom
Copy link
Contributor Author

Exactly that. Under debian it's the python3-systemd module. I would have thought that was common across all distros to be able to write warning type statements to journald

@JoshStrobl
Copy link
Member

Yea I checked the instructions at https://github.com/systemd/python-systemd/blob/main/README.md and indeed it should be python3-systemd.

@JoshStrobl
Copy link
Member

Figured out the issue was python3 was being loaded from homebrew. Now that I got it running, I get the following:

Traceback (most recent call last):
  File "/usr/libexec/budgie-desktop/labwc_bridge.py", line 734, in <module>
    bridge = Bridge()
  File "/usr/libexec/budgie-desktop/labwc_bridge.py", line 174, in __init__
    self.bridge_config()
    ~~~~~~~~~~~~~~~~~~^^
  File "/usr/libexec/budgie-desktop/labwc_bridge.py", line 374, in bridge_config
    self.keybindings_changed(self.gsd_media_keys_settings, key)
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/libexec/budgie-desktop/labwc_bridge.py", line 655, in keybindings_changed
    keybind = settings[key]
              ~~~~~~~~^^^^^
  File "/usr/lib64/python3.13/site-packages/gi/overrides/Gio.py", line 253, in __getitem__
    raise KeyError('unknown key: %r' % (key,))
KeyError: "unknown key: 'terminal'"

@fossfreedom
Copy link
Contributor Author

Confirmed with Josh that this was a distro specific key - better here to be more robust to confirm keys actually exist in the schema before further processing.

@JoshStrobl JoshStrobl self-requested a review January 11, 2025 14:45
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.

Validated and LGTM 🥳

@JoshStrobl JoshStrobl merged commit 35f338a into main Jan 11, 2025
1 check passed
@JoshStrobl JoshStrobl deleted the labwcbridge branch January 11, 2025 14:45
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.

2 participants