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

@@ -7,6 +7,7 @@
* Table of Contents :toc:
- [[#about-this-config][About This Config]]
- [[#imports][Imports]]
- [[#helper-flags-for-x11wayland][Helper Flags For X11/Wayland]]
- [[#variables][Variables]]
- [[#custom-functions][Custom Functions]]
- [[#keybindings][Keybindings]]
@@ -16,6 +17,8 @@
- [[#layouts][Layouts]]
- [[#default-settings-for-all-widgets][Default Settings For All Widgets]]
- [[#widgets][Widgets]]
- [[#system-tray-widget][System Tray Widget]]
- [[#the-rest-of-the-widgets][The Rest of the Widgets]]
- [[#screens][Screens]]
- [[#some-important-functions][Some Important Functions]]
- [[#drag-floating-layouts][Drag Floating Layouts]]
@@ -74,6 +77,13 @@ import colors
#+END_SRC
* Helper Flags For X11/Wayland
#+begin_src python
IS_WAYLAND = qtile.core.name == "wayland"
IS_X11 = qtile.core.name == "x11"
#+end_src
* Variables
Just some variables I am setting to make my life easier.
@@ -394,8 +404,21 @@ extension_defaults = widget_defaults.copy()
* Widgets
This is the bar (the panel) and the widgets within the bar.
** System Tray Widget
This will be a different widget depending on if we are logging into the X11 session or the Wayland session.
#+begin_src python
def init_widgets_list():
def tray_widget():
if IS_WAYLAND:
return widget.StatusNotifier(padding=6)
else:
return widget.Systray(padding=6)
#+end_src
** The Rest of the Widgets
#+begin_src python
def init_widgets_list(include_tray=True):
widgets_list = [
widget.Spacer(length = 8),
widget.Image(
@@ -510,11 +533,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
#+end_src
@@ -652,9 +678,12 @@ Executes a bash script (autostart.sh) which launches programs for autostart.
#+begin_src python
@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"])
#+end_src
* Java Apps Might Need This