From 737800806d1c1e38f1e95197b8cee30ff5f7a160 Mon Sep 17 00:00:00 2001 From: Kevin Alberts Date: Fri, 25 Jul 2025 12:36:49 +0200 Subject: [PATCH] Various wayland fixes, ghostty, updates etcetera. --- config_debug.py | 2 +- kuro/base.py | 2 +- kuro/config.py | 5 ++--- kuro/theme.py | 20 ++++++++++++++++---- kuro/utils/widgets.py | 10 +++++----- 5 files changed, 25 insertions(+), 14 deletions(-) diff --git a/config_debug.py b/config_debug.py index 8dbfaff..3aa6617 100644 --- a/config_debug.py +++ b/config_debug.py @@ -25,7 +25,7 @@ # SOFTWARE. from libqtile.config import Key, Screen, Group, Drag, Click -from libqtile.command import lazy +from libqtile.lazy import lazy from libqtile import layout, bar, widget diff --git a/kuro/base.py b/kuro/base.py index 9557f9e..15ce41d 100644 --- a/kuro/base.py +++ b/kuro/base.py @@ -1,5 +1,5 @@ from libqtile import layout as libqtile_layout, layout, bar, widget -from libqtile.command import lazy +from libqtile.lazy import lazy from libqtile.config import Key, Group, Screen, Drag, Click, Match # Initialize logging diff --git a/kuro/config.py b/kuro/config.py index 9939081..ecfb2a4 100644 --- a/kuro/config.py +++ b/kuro/config.py @@ -19,8 +19,7 @@ class Config(BaseConfig): cmd_brightness_down = "sudo /usr/bin/xbacklight -dec 10" cmd_screenshot = "/home/kevin/bin/screenshot.sh" cmd_alt_screenshot = "/home/kevin/bin/screenshot.sh" - - app_terminal = "terminator" + app_terminal = "ghostty" web_browser = "firefox" file_manager = "thunar" app_launcher = "wofi --show drun,run" @@ -30,7 +29,7 @@ class Config(BaseConfig): # Autostart applications apps_autostart_group = [ {'group': "", 'command': ["firefox"]}, - {'group': "", 'command': ["terminator"]}, + {'group': "", 'command': ["ghostty", "--gtk-single-instance=true", "--quit-after-last-window-close=false", "--initial-window=true"]}, {'group': "", 'command': ["/usr/bin/rambox"]}, {'group': "", 'command': ["thunar"]}, {'group': "", 'command': ["thunderbird"]}, diff --git a/kuro/theme.py b/kuro/theme.py index 25c5356..88a0dca 100644 --- a/kuro/theme.py +++ b/kuro/theme.py @@ -15,7 +15,7 @@ from libqtile.log_utils import logger logger.warning("Importing qtile theme requirements...") from libqtile.config import Key, Screen, Group, Drag, Click, Match -from libqtile.command import lazy +from libqtile.lazy import lazy from libqtile import layout, bar, widget, qtile from qtile_extras import widget as extra_widget @@ -214,7 +214,7 @@ class Kuro(BaseTheme): ## # Debug keyboard shortcuts ## - Key([self.mod, "control"], "w", lazy.function(display_wm_class)), + Key([self.mod, "shift", "control"], "w", lazy.function(display_wm_class)), # Show extensive window info Key([self.mod, "shift", "control"], "i", lazy.function(self.show_window_info)), @@ -594,7 +594,7 @@ class Kuro(BaseTheme): logger.warning("Restoring wallpaper...") if self.current_wallpaper: - p = utils.execute_once(["wal", "-n", "-i", "{}".format(self.current_wallpaper)]) + p = utils.execute_once(["wallust", "run", "{}".format(self.current_wallpaper)]) p.wait() else: wallpaper = None @@ -622,6 +622,9 @@ class Kuro(BaseTheme): # Update color scheme self.update_colorscheme() + # Setup XDG Desktop Portal + self.setup_xdg_desktop_portal() + # After first startup is complete, autostart configured apps logger.warning("Autostarting apps...") for app in Config.get("apps_autostart", []): @@ -745,7 +748,7 @@ class Kuro(BaseTheme): def update_colorscheme(self, *args, **kwargs): if self.current_wallpaper: logger.warning(f"Updating wal colors for wallpaper {self.current_wallpaper}") - p = utils.execute(["wal", "-n", "-i", "{}".format(self.current_wallpaper)]) + p = utils.execute_once(["wallust", "run", "{}".format(self.current_wallpaper)]) p.wait() colors = None @@ -843,3 +846,12 @@ class Kuro(BaseTheme): utils.notify(qtile, "Updated colorscheme!", f"active: {colors['color15']}, inactive: {colors['color1']}") + + def setup_xdg_desktop_portal(self): + # XDG Desktop portal is used for screensharing, screenshots and filepickers in wayland. + # To work correctly, it needs to have two env variables set in the systemd user session + logger.warning(f"Setting XDG_CURRENT_DESKTOP env and updating XDG Desktop Portal configuration...") + os.environ["XDG_CURRENT_DESKTOP"] = "qtile" + subprocess.Popen(["systemctl", "--user", "import-environment", "WAYLAND_DISPLAY", "XDG_CURRENT_DESKTOP"]) + subprocess.Popen(["dbus-update-activation-environment", "--systemd", "WAYLAND_DISPLAY", "XDG_CURRENT_DESKTOP=qtile"]) + subprocess.Popen(["systemctl", "--user", "restart", "xdg-desktop-portal"]) diff --git a/kuro/utils/widgets.py b/kuro/utils/widgets.py index a27249a..f1b51fd 100644 --- a/kuro/utils/widgets.py +++ b/kuro/utils/widgets.py @@ -201,18 +201,18 @@ class DualPaneTextboxBase(base._Widget): self.changed = False @expose_command() - def set_font(self, font=base.UNSPECIFIED, fontsize_left=base.UNSPECIFIED, fontsize_right=base.UNSPECIFIED, fontshadow=base.UNSPECIFIED): + def set_font(self, font=None, fontsize_left=0, fontsize_right=0, fontshadow=""): """ Change the font used by this widget. If font is None, the current font is used. """ - if font is not base.UNSPECIFIED: + if font is not None: self.font = font - if fontsize_left is not base.UNSPECIFIED: + if fontsize_left != 0: self.fontsize_left = fontsize_left - if fontsize_right is not base.UNSPECIFIED: + if fontsize_right != 0: self.fontsize_right = fontsize_right - if fontshadow is not base.UNSPECIFIED: + if fontshadow != "": self.fontshadow = fontshadow self.bar.draw()