Compare commits

...

4 Commits

Author SHA1 Message Date
a4a63a314f added default layout defaults 2025-08-17 11:57:03 +02:00
c39ed6794f added default widget styling 2025-08-17 11:56:14 +02:00
15634f51ff added group configuration 2025-08-17 11:53:34 +02:00
aa46a5b7e2 added hooks 2025-08-17 11:53:12 +02:00
3 changed files with 222 additions and 29 deletions

View File

@@ -4,42 +4,27 @@ from libqtile import qtile
from libqtile.backend.wayland.inputs import InputConfig from libqtile.backend.wayland.inputs import InputConfig
from modules.keys import keys, mouse from modules.keys import keys, mouse
from modules.groups import groups
# Application definitions
apps = { apps = {
"terminal": "kitty", "terminal": "kitty",
"browser": "firefox", "browser": "firefox",
"filebrowser": "nemo", "filebrowser": "nemo",
"cli-filebrowser": "yazi",
"editor": "nvim",
} }
layout_defaults = dict(
margin=3,
border_width=0,
grow_amount=2,
)
# Essentials
keys = keys
mouse = mouse
groups = groups
# Wayland specific configuration
modifier_keys = {
"M": "mod4",
"A": "mod1",
"S": "shift",
"C": "control",
}
"""
General Qtile configuration
"""
dgroups_key_binder = None
dgroups_app_rules = [] # type: list
follow_mouse_focus = True
bring_front_click = True
floats_kept_above = True
cursor_warp = True
auto_fullscreen = True
focus_on_window_activation = "smart"
reconfigure_screens = True
auto_minimize = True
wmname = "Qtile"
"""
Wayland specific configuration
"""
if qtile.core.name == "X11": if qtile.core.name == "X11":
term = "urvx" term = "urvx"
elif qtile.core.name == "wayland": elif qtile.core.name == "wayland":
@@ -56,3 +41,15 @@ wl_input_rules = {
wl_xcursor_theme = None wl_xcursor_theme = None
wl_xcursor_size = 18 wl_xcursor_size = 18
# General Qtile configuration
dgroups_key_binder = None
dgroups_app_rules = [] # type: list
follow_mouse_focus = True
bring_front_click = True
floats_kept_above = True
cursor_warp = True
auto_fullscreen = True
focus_on_window_activation = "smart"
reconfigure_screens = True
auto_minimize = True
wmname = "Qtile"

View File

@@ -0,0 +1,165 @@
import re
from libqtile.lazy import lazy
from libqtile.config import Group, EzKey as Key, Match, DropDown, ScratchPad
from modules.keys import keys
mod = "mod4"
group_screen_map = {
"0": 1,
"1": 1,
"2": 1,
"3": 1,
"4": 0,
"5": 0,
"6": 0,
"7": 2,
"8": 2,
"9": 2,
"f1": 0,
"f2": 2,
"f3": 0,
"f4": 2,
"f5": 2,
"f6": 2,
"f7": 0,
"f8": 1,
"f9": 1,
"f10": 1,
"f11": 1,
"f12": 1,
}
groups = [
Group(
name="0",
label="󰓓",
matches=[
Match(wm_class=re.compile(r"^(steam)")),
Match(wm_class=re.compile(r"^(Minecraft*)")),
],
),
Group(name="1", label="󰲡"),
Group(name="2", label="󰲣"),
Group(name="3", label="󰲥"),
Group(name="4", label="󰲧"),
Group(name="5", label="󰲩"),
Group(name="6", label="󰲫"),
Group(name="7", label="󰲭"),
Group(name="8", label="󰲯"),
Group(name="9", label="󰲱"),
# Groups on function-keys
Group(
name="f1",
label="",
matches=[
Match(wm_class=re.compile(r"^(firefox)$")),
],
),
Group(name="f2", label="", matches=[Match(wm_class="discord")]),
Group(
name="f3",
label="",
matches=[Match(wm_class=re.compile(r"^(joplin)$"))],
),
Group(
name="f4",
label="",
matches=[
Match(wm_class=re.compile(r"^(com.github.th_ch.youtube_music)$")),
],
),
Group(
name="f5",
label="󱦹",
matches=[Match(wm_class="rnote")],
),
Group(
name="f6",
label="󰟵",
matches=[Match(wm_class="bitwarden")],
),
Group(
name="f7",
label=" 󰣀",
matches=[Match(wm_class=re.compile(r"^(XPipe)$"))],
),
Group(name="f8", label="󱊲"),
Group(name="f9", label="󱊳"),
Group(name="f10", label="󱊴"),
Group(name="f11", label="󱊵"),
Group(name="f12", label="󱊶"),
]
def go_to_group(name: str):
def _inner(qtile):
screen = group_screen_map.get(name, 0)
if len(qtile.screens) <= 2:
qtile.groups_map[name].toscreen()
else:
qtile.focus_screen(screen)
qtile.groups_map[name].toscreen()
return _inner
# for i in groups:
# keys.append(Key([mod], i.name, lazy.function(go_to_group(i.name))))
for i in groups:
keys.append(
Key(f"M-{i.name}", lazy.function(go_to_group(i.name))),
)
def go_to_group_and_move_window(name: str):
def _inner(qtile):
screen = group_screen_map.get(name, 0)
if len(qtile.screens) <= 2:
qtile.current_window.togroup(name, switch_group=False)
else:
qtile.current_window.togroup(name, switch_group=False)
qtile.focus_screen(screen)
qtile.groups_map[name].toscreen()
return _inner
for i in groups:
keys.append(
Key(f"M-S-{i.name}", lazy.function(go_to_group_and_move_window(i.name))),
)
for i in range(1, 12):
group_name = f"f{i}"
key = f"F{i}"
keys.append
groups.append(
ScratchPad(
"scratchpad",
[
DropDown(
"term",
"kitty",
width=0.4,
height=0.5,
x=0.3,
y=0.25,
opacity=1,
on_focus_lost_hide=True,
),
DropDown(
"calc",
"qalculate-gtk",
width=0.3,
height=0.6,
x=0.35,
y=0.2,
opacity=1,
on_focus_lost_hide=False,
),
],
)
)

View File

@@ -0,0 +1,31 @@
import os.path
import subprocess
from libqtile import hook, qtile
from libqtile.config import Match
# Autostart
@hook.subscribe.startup_once
def autostart():
script = "~/.config/qtile/assets/scripts/autostart.sh"
home = os.path.expanduser(script)
subprocess.Popen([home])
@hook.subscribe.startup_complete
def go_to_group_1():
qtile.focus_screen(0)
qtile.groups_map["1"].toscreen()
"""
Some clients won't start fullscreen (exclusive to wayland)
With this function we force clients defined in FULLSCREEN_RULES to enter fullscreen
"""
FULLSCREEN_RULES = [Match(wm_class="flameshot")]
@hook.subscribe.client_managed
def force_fullscreen(client) -> None:
if any(client.match(rule) for rule in FULLSCREEN_RULES):
client.fullscreen = True