Compare commits

...

2 Commits

Author SHA1 Message Date
70c935e1a9 pre fix 2025-08-17 18:31:11 +02:00
c21dcb78a2 removed useless definition 2025-08-17 16:15:22 +02:00
4 changed files with 150 additions and 140 deletions

View File

@@ -6,14 +6,14 @@ from libqtile.config import Screen
from themes.colors import gruvbox_dark from themes.colors import gruvbox_dark
from modules.keys import keys, mouse from modules.keys import keybinds, mousebinds
from modules.groups import groups from modules.groups import groups
from modules.widgets import widgets_main, widgets_portrait, widgets_media from modules.widgets import widgets_main, widgets_portrait, widgets_media
from modules.hooks import * from modules.hooks import *
from modules.layouts import layouts from modules.layouts import layouts
# Application definitions # Application definitions
apps = { APPS = {
"terminal": "kitty", "terminal": "kitty",
"browser": "firefox", "browser": "firefox",
"filebrowser": "nemo", "filebrowser": "nemo",
@@ -55,12 +55,6 @@ screens = [
), ),
] ]
# Default definitions
layout_defaults = dict(
margin=3,
border_width=0,
grow_amount=2,
)
widget_defaults = dict( widget_defaults = dict(
font="Open Sans", font="Open Sans",
@@ -69,8 +63,8 @@ widget_defaults = dict(
) )
# Essentials # Essentials
keys = keys keys = keybinds()
mouse = mouse mouse = mousebinds()
groups = groups groups = groups
layouts = layouts layouts = layouts

View File

@@ -1,12 +1,9 @@
import re import re
from libqtile.lazy import lazy from libqtile.lazy import lazy
from libqtile.config import Group, EzKey as Key, Match, DropDown, ScratchPad from libqtile.config import Group, EzKey as Key, Match, DropDown, ScratchPad
from modules.keys import keys from modules.keys import keybinds
mod = "mod4"
group_screen_map = { group_screen_map = {
"0": 1,
"1": 1, "1": 1,
"2": 1, "2": 1,
"3": 1, "3": 1,
@@ -66,7 +63,9 @@ groups = [
name="f4", name="f4",
label="", label="",
matches=[ matches=[
Match(wm_class=re.compile(r"^(com.github.th_ch.youtube_music)$")), Match(
wm_class=re.compile(r"^(com.github.th_ch.youtube_music)$"),
),
], ],
), ),
Group( Group(
@@ -92,6 +91,10 @@ groups = [
] ]
def create_group_keys(groups, go_to_group, go_to_group_and_move_window):
additional_keys = []
def go_to_group(name: str): def go_to_group(name: str):
def _inner(qtile): def _inner(qtile):
screen = group_screen_map.get(name, 0) screen = group_screen_map.get(name, 0)
@@ -131,8 +134,8 @@ for i in groups:
) )
for i in range(1, 12): for i in range(1, 12):
group_name = f"f{i}" group_name = f"<f{i}>"
key = f"F{i}" key = f"<f{i}>"
keys.append keys.append
groups.append( groups.append(
@@ -162,4 +165,3 @@ groups.append(
], ],
) )
) )

View File

@@ -2,123 +2,131 @@ from libqtile.lazy import lazy
from libqtile.config import EzKey as Key from libqtile.config import EzKey as Key
from libqtile.config import EzClick as Click, EzDrag as Drag from libqtile.config import EzClick as Click, EzDrag as Drag
from config import apps
keys = [ def keybinds():
# Focus manipulation from config import APPS
Key("M-h", lazy.layout.left(), desc="Move focus to the left"),
Key("M-l", lazy.layout.right(), desc="Move focus to the right"),
Key("M-j", lazy.layout.down(), desc="Move focus to the down"),
Key("M-k", lazy.layout.up(), desc="Move focus to the up"),
# Window manipulation
Key(
"M-S-h",
lazy.layout.swap_left(),
desc="Move window to the left",
),
Key(
"M-S-l",
lazy.layout.swap_right(),
desc="Move window to the right",
),
Key("M-S-j", lazy.layout.shuffle_down(), desc="Move window down"),
Key("M-S-k", lazy.layout.shuffle_up(), desc="Move window up"),
Key("M-S-i", lazy.layout.shrink(), desc="Increase window size"),
Key("M-S-m", lazy.layout.grow(), desc="Decrease window size"),
Key("M-c", lazy.window.kill(), desc="Closes window"),
# Layout manipulation
Key(
"M-n",
lazy.layout.normalize(),
desc="Normalize all window sizes",
),
Key("M-S-n", lazy.layout.reset(), desc="Resets all window sizes"),
Key(
"M-t",
lazy.window.toggle_floating(),
desc="Toggles between floating and tiled state of a window",
),
Key(
"M-o",
lazy.layout.maximize(),
desc="Maximizes the window in the current layot",
),
Key(
"M-f",
lazy.window.toggle_fullscreen(),
desc="Toggles wiondow between tiled/floating and fullscreen",
),
Key("<M-Tab>", lazy.next_layout(), desc="Switches between layouts"),
Key("<M-C-r>", lazy.reload_config(), desc="Reload config"),
# Audio and media control
Key("<F86AudioMute>", lazy.spawn("pamixer -t"), desc="Mutes Audio"),
Key(
"<XF86AudioLowerVolume>",
lazy.spawn("pamixer -d 2"),
desc="Lower Audio Volume",
),
Key(
"<XF86AudioRaiseVolume>",
lazy.spawn("pamixer -i 2"),
desc="Raise Audio Volume",
),
Key(
"<XF86AudioPrev>",
lazy.spawn("playerctl previous"),
desc="Play Previous Media",
),
Key(
"<XF86AudioNext>",
lazy.spawn("playerctl next"),
desc="Play Next Media",
),
Key(
"<XF86AudioPlay>",
lazy.spawn("playerctl play-pause"),
desc="Toggle Play/Pause",
),
# Rofi
Key(
"M-r",
lazy.spawn("rofi -show drun -show-icons"),
desc="Spawns Rofi",
),
Key(
"A-<Tab>",
lazy.spawn("rofi -show window -show-icons"),
desc="Tab Windows",
),
# Scratchpads
Key(
"C-1",
lazy.group["scratchpad"].dropdown_toggle("term"),
desc="Toggles terminal scratchpad",
),
Key(
"C-2",
lazy.group["scratchpad"].dropdown_toggle("calc"),
desc="Calculator in scratchpad",
),
# Application shortcuts
Key(
"M-e",
lazy.spawn(apps["filebrowser"]),
desc="Launches filebrowser",
),
Key("M-b", lazy.spawn(apps["browser"])),
Key("M-<Return>", lazy.spawn(apps["terminal"])),
]
mouse = [ keys = (
Drag( [
"M-1", # Focus manipulation
lazy.window.set_position_floating(), Key("M-h", lazy.layout.left(), desc="Move focus to the left"),
start=lazy.window.get_position(), Key("M-l", lazy.layout.right(), desc="Move focus to the right"),
), Key("M-j", lazy.layout.down(), desc="Move focus to the down"),
Drag( Key("M-k", lazy.layout.up(), desc="Move focus to the up"),
"M-3", # Window manipulation
lazy.window.set_size_floating(), Key(
start=lazy.window.get_size(), "M-S-h",
), lazy.layout.swap_left(),
Click("M-2", lazy.window.bring_to_front()), desc="Move window to the left",
] ),
Key(
"M-S-l",
lazy.layout.swap_right(),
desc="Move window to the right",
),
Key("M-S-j", lazy.layout.shuffle_down(), desc="Move window down"),
Key("M-S-k", lazy.layout.shuffle_up(), desc="Move window up"),
Key("M-S-i", lazy.layout.shrink(), desc="Increase window size"),
Key("M-S-m", lazy.layout.grow(), desc="Decrease window size"),
Key("M-c", lazy.window.kill(), desc="Closes window"),
# Layout manipulation
Key(
"M-n",
lazy.layout.normalize(),
desc="Normalize all window sizes",
),
Key("M-S-n", lazy.layout.reset(), desc="Resets all window sizes"),
Key(
"M-t",
lazy.window.toggle_floating(),
desc="Toggles between floating and tiled state of a window",
),
Key(
"M-o",
lazy.layout.maximize(),
desc="Maximizes the window in the current layot",
),
Key(
"M-f",
lazy.window.toggle_fullscreen(),
desc="Toggles wiondow between tiled/floating and fullscreen",
),
Key("<M-Tab>", lazy.next_layout(), desc="Switches between layouts"),
Key("<M-C-r>", lazy.reload_config(), desc="Reload config"),
# Audio and media control
Key("<F86AudioMute>", lazy.spawn("pamixer -t"), desc="Mutes Audio"),
Key(
"<XF86AudioLowerVolume>",
lazy.spawn("pamixer -d 2"),
desc="Lower Audio Volume",
),
Key(
"<XF86AudioRaiseVolume>",
lazy.spawn("pamixer -i 2"),
desc="Raise Audio Volume",
),
Key(
"<XF86AudioPrev>",
lazy.spawn("playerctl previous"),
desc="Play Previous Media",
),
Key(
"<XF86AudioNext>",
lazy.spawn("playerctl next"),
desc="Play Next Media",
),
Key(
"<XF86AudioPlay>",
lazy.spawn("playerctl play-pause"),
desc="Toggle Play/Pause",
),
# Rofi
Key(
"M-r",
lazy.spawn("rofi -show drun -show-icons"),
desc="Spawns Rofi",
),
Key(
"A-<Tab>",
lazy.spawn("rofi -show window -show-icons"),
desc="Tab Windows",
),
# Scratchpads
Key(
"C-1",
lazy.group["scratchpad"].dropdown_toggle("term"),
desc="Toggles terminal scratchpad",
),
Key(
"C-2",
lazy.group["scratchpad"].dropdown_toggle("calc"),
desc="Calculator in scratchpad",
),
# Application shortcuts
Key(
"M-e",
lazy.spawn(APPS["filebrowser"]),
desc="Launches filebrowser",
),
Key("M-b", lazy.spawn(APPS["browser"])),
Key("M-<Return>", lazy.spawn(APPS["terminal"])),
],
)
return keys
def mousebinds():
mouse = [
Drag(
"M-1",
lazy.window.set_position_floating(),
start=lazy.window.get_position(),
),
Drag(
"M-3",
lazy.window.set_size_floating(),
start=lazy.window.get_size(),
),
Click("M-2", lazy.window.bring_to_front()),
]
return mouse

View File

@@ -1,8 +1,14 @@
from libqtile import layout from libqtile import layout
from libqtile.config import Match from libqtile.config import Match
from config import layout_defaults
floating_layout_defaults = layout_defaults.copy()
LAYOUT_DEFAULTS = dict(
margin=3,
border_width=0,
grow_amount=2,
)
floating_layout_defaults = LAYOUT_DEFAULTS.copy()
layouts = [ layouts = [
layout.MonadTall( layout.MonadTall(
@@ -14,10 +20,10 @@ layouts = [
min_ratio=0.30, min_ratio=0.30,
max_ratio=0.75, max_ratio=0.75,
single_border_width=0, single_border_width=0,
**layout_defaults, **LAYOUT_DEFAULTS,
), ),
layout.VerticalTile( layout.VerticalTile(
**layout_defaults, **LAYOUT_DEFAULTS,
), ),
] ]