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