qtile: update config to match awesome

This commit is contained in:
2024-08-03 17:49:08 +03:00
parent 7a01bda031
commit c321a599e4

View File

@ -2,7 +2,7 @@ import os
import subprocess
from typing import List # noqa: F401
from libqtile import layout
from libqtile.config import Click, Drag, Group, Match
from libqtile.config import Click, Drag, Group, Match, Screen
from libqtile.lazy import lazy
from libqtile.config import EzKey as Keybind
from libqtile import hook
@ -14,62 +14,55 @@ from libqtile import hook
mod = "mod4"
terminal = "kitty"
launcher = "rofi -show run"
file_manager = "thunar"
browser = "firefox"
file_manager = "nemo"
browser = "brave"
calculator = "rofi -show calc"
music_player = f"{terminal} -e ncmpcpp"
screen_locker = "i3lock -c 000000"
scripts = os.path.expanduser('~/.config/qtile/scripts')
scripts = os.path.expanduser("~/.config/qtile/scripts")
#
# keybinds
#
def next_screen(qtile):
qtile.cmd_next_screen()
keys = [
# basics
Keybind("M-w", lazy.window.kill()),
Keybind("M-t", lazy.restart()),
Keybind("M-C-r", lazy.reload_config()),
Keybind("M-q", lazy.spawn(os.path.join(scripts, "exitmenu"))),
# focus
Keybind("M-h", lazy.layout.left()),
Keybind("M-j", lazy.layout.down()),
Keybind("M-k", lazy.layout.up()),
Keybind("M-l", lazy.layout.right()),
# shift
Keybind("M-S-h", lazy.layout.shuffle_left()),
Keybind("M-S-j", lazy.layout.shuffle_down()),
Keybind("M-S-k", lazy.layout.shuffle_up()),
Keybind("M-S-l", lazy.layout.shuffle_right()),
# resize
Keybind("M-C-h", lazy.layout.grow_left()),
Keybind("M-C-j", lazy.layout.grow_down()),
Keybind("M-C-k", lazy.layout.grow_up()),
Keybind("M-C-l", lazy.layout.grow_right()),
# cycle
Keybind("M-n", lazy.group.next_window()),
Keybind("M-m", lazy.function(next_screen)),
# window attributes
Keybind("M-C-q", lazy.window.toggle_floating()),
Keybind("M-C-w", lazy.window.toggle_fullscreen()),
# cycle layouts
Keybind("M-<Tab>", lazy.next_layout()),
# toggles
Keybind("M-S-w", lazy.spawn(os.path.join(scripts, "togglemaster"))),
# # media
# Keybind("XF86AudioMute", lazy.spawn("pulsemixer --toggle-mute")),
# Keybind("XF86AudioLowerVolume", lazy.spawn("pulsemixer --change-volume -5")),
# Keybind("XF86AudioRaiseVolume", lazy.spawn("pulsemixer --change-volume +5")),
# Keybind("XF86MonBrightnessDown", lazy.spawn("light -U 5")),
# Keybind("XF86MonBrightnessUp", lazy.spawn("light -A 5")),
# app launchers
Keybind("M-<Return>", lazy.spawn(terminal)),
Keybind("M-<space>", lazy.spawn(launcher)),
@ -89,10 +82,12 @@ keys = [
groups = [Group(i) for i in "asdfgzxcvb"]
for i in groups:
keys.extend([
Keybind(f"M-{i.name}", lazy.group[i.name].toscreen()),
Keybind(f"M-S-{i.name}", lazy.window.togroup(i.name)),
])
keys.extend(
[
Keybind(f"M-{i.name}", lazy.group[i.name].toscreen()),
Keybind(f"M-S-{i.name}", lazy.window.togroup(i.name)),
]
)
#
# theme
@ -100,11 +95,11 @@ for i in groups:
# load wal colors
colors = []
walpath = os.path.expanduser('~/.cache/wal/colors')
with open(walpath, 'r') as file:
walpath = os.path.expanduser("~/.cache/wal/colors")
with open(walpath, "r") as file:
for _ in range(8):
colors.append(file.readline().strip())
colors.append('#ffffff')
colors.append("#ffffff")
lazy.reload()
layout_theme = {
@ -125,21 +120,18 @@ layouts = [
layout.Max(**layout_theme),
]
#
# bar
#
# Drag floating layouts.
mouse = [
Drag([mod],
"Button1",
lazy.window.set_position_floating(),
start=lazy.window.get_position()),
Drag([mod],
"Button3",
lazy.window.set_size_floating(),
start=lazy.window.get_size()),
Click([mod], "Button2", lazy.window.bring_to_front())
Drag(
[mod],
"Button1",
lazy.window.set_position_floating(),
start=lazy.window.get_position(),
),
Drag(
[mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()
),
Click([mod], "Button2", lazy.window.bring_to_front()),
]
dgroups_key_binder = None
@ -147,20 +139,25 @@ dgroups_app_rules = [] # type: List
follow_mouse_focus = True
bring_front_click = False
cursor_warp = False
floating_layout = layout.Floating(float_rules=[
# Run the utility of `xprop` to see the wm class and name of an X client.
*layout.Floating.default_float_rules,
Match(wm_class='confirmreset'), # gitk
Match(wm_class='makebranch'), # gitk
Match(wm_class='maketag'), # gitk
Match(wm_class='ssh-askpass'), # ssh-askpass
Match(title='branchdialog'), # gitk
Match(title='pinentry'), # GPG key password entry
])
floating_layout = layout.Floating(
**layout_theme,
float_rules=[
# Run the utility of `xprop` to see the wm class and name of an X client.
*layout.Floating.default_float_rules,
Match(wm_class="confirmreset"), # gitk
Match(wm_class="makebranch"), # gitk
Match(wm_class="maketag"), # gitk
Match(wm_class="ssh-askpass"), # ssh-askpass
Match(title="branchdialog"), # gitk
Match(title="pinentry"), # GPG key password entry
],
)
screens = [Screen()]
# autostart script
@hook.subscribe.startup_complete
def autostart():
autostart = os.path.expanduser('~/.config/qtile/autostart.sh')
autostart = os.path.expanduser("~/.config/qtile/autostart.sh")
subprocess.call([autostart])