import os import subprocess from typing import List # noqa: F401 from libqtile import layout from libqtile.config import Click, Drag, Group, Match from libqtile.lazy import lazy from libqtile.config import EzKey as Keybind from libqtile import hook # # variables # mod = "mod4" terminal = "kitty" launcher = "rofi -show run" file_manager = "thunar" browser = "firefox" calculator = "rofi -show calc" music_player = f"{terminal} -e ncmpcpp" screen_locker = "i3lock -c 000000" scripts = os.path.expanduser('~/.config/qtile/scripts') # # keybinds # keys = [ # basics Keybind("M-w", lazy.window.kill()), Keybind("M-t", lazy.restart()), 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()), # window attributes Keybind("M-C-q", lazy.window.toggle_floating()), Keybind("M-C-w", lazy.window.toggle_fullscreen()), # cycle layouts Keybind("M-", 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-", lazy.spawn(terminal)), Keybind("M-", lazy.spawn(launcher)), Keybind("M-", lazy.spawn("flameshot gui")), Keybind("M-1", lazy.spawn(file_manager)), Keybind("M-2", lazy.spawn(browser)), Keybind("M-3", lazy.spawn(calculator)), Keybind("M-4", lazy.spawn(music_player)), Keybind("M-6", lazy.spawn("virt-manager")), Keybind("M-0", lazy.spawn(screen_locker)), ] # # groups # 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)), ]) # # theme # # load wal colors colors = [] 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') lazy.reload() layout_theme = { "border_width": 2, "margin": 6, "border_on_single": True, "border_focus": colors[8], "border_normal": colors[0], } # # layouts # layouts = [ layout.Columns(**layout_theme), layout.Bsp(**layout_theme, fair=False), 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()) ] dgroups_key_binder = None 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 ]) # autostart script @hook.subscribe.startup_complete def autostart(): autostart = os.path.expanduser('~/.config/qtile/autostart.sh') subprocess.call([autostart])