Modifying qtile config to work on either X11 or wayland.

This commit is contained in:
Derek Taylor
2026-01-09 15:56:01 -06:00
parent 9ed8d90508
commit 4f6ac88aec
4 changed files with 70 additions and 24 deletions

View File

@@ -31,6 +31,9 @@ from libqtile.config import Click, Drag, Group, Key, KeyChord, Match, Screen
from libqtile.lazy import lazy
import colors
IS_WAYLAND = qtile.core.name == "wayland"
IS_X11 = qtile.core.name == "x11"
mod = "mod4" # Sets mod key to SUPER/WINDOWS
myTerm = "alacritty" # My terminal of choice
myBrowser = "brave" # My browser of choice
@@ -273,7 +276,13 @@ widget_defaults = dict(
extension_defaults = widget_defaults.copy()
def init_widgets_list():
def tray_widget():
if IS_WAYLAND:
return widget.StatusNotifier(padding=6)
else:
return widget.Systray(padding=6)
def init_widgets_list(include_tray=True):
widgets_list = [
widget.Spacer(length = 8),
widget.Image(
@@ -388,11 +397,14 @@ def init_widgets_list():
## Uncomment for time only
format = "%I:%M %p",
),
# DISABLE Systray if using Wayland!!!
widget.Systray(padding = 6),
widget.Spacer(length = 8),
]
if include_tray:
widgets_list.extend([
tray_widget(),
widget.Spacer(length=8),
])
]
return widgets_list
def init_widgets_screen1():
@@ -503,8 +515,11 @@ wl_input_rules = None
@hook.subscribe.startup_once
def start_once():
home = os.path.expanduser('~')
subprocess.call([home + '/.config/qtile/autostart-x11'])
home = os.path.expanduser("~")
if IS_WAYLAND:
subprocess.call([home + "/.config/qtile/autostart-wayland"])
else:
subprocess.call([home + "/.config/qtile/autostart-x11"])
# XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this
# string besides java UI toolkits; you can see several discussions on the