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

@@ -66,14 +66,16 @@ conky.config = {
--Windows
own_window = true, -- create your own window to draw
own_window_argb_value = 255, -- real transparency - composite manager required 0-255
own_window_argb_visual = true, -- use ARGB - composite manager required
own_window_class = 'Conky', -- manually set the WM_CLASS name for use with xprop
own_window_colour = '#282c34', -- set colour if own_window_transparent no
own_window_transparent = false, -- if own_window_argb_visual is true sets background opacity 0%
own_window_argb_visual = true, -- use ARGB - composite manager required
own_window_argb_value = 255, -- real transparency - composite manager required 0-255
own_window_colour = '#282c34', -- set colour if own_window_transparent no
own_window_class = 'Conky', -- manually set the WM_CLASS name for use with xprop
own_window_title = 'conky-qtile-01', -- set the name manually
own_window_type = 'override', -- if own_window true options are: normal/override/dock/desktop/panel
own_window_hints = 'undecorated,below,above,sticky,skip_taskbar,skip_pager', -- if own_window true - just hints - own_window_type sets it
own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager', -- if own_window true - just hints - own_window_type sets it
# out_to_x = false,
# out_to_wayland = true,
--COLOR CODE BEGIN--
--Colorscheme: Doom One

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

View File

@@ -4,10 +4,10 @@ COLORSCHEME=doom-one
### AUTOSTART PROGRAMS ###
kanshi &
# dunst -conf "$HOME"/.config/dunst/"$COLORSCHEME" &
# nm-applet &
# nextcloud --background &
# flameshot &
dunst -conf "$HOME"/.config/dunst/"$COLORSCHEME" &
nm-applet &
nextcloud --background &
flameshot &
# systemctl --user start mpd &
/usr/bin/emacs --daemon &
waypaper --backend swaybg --restore &

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