From 2e346f74d1d0c9b0d9531abfa9a39ff91e52b57c Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Thu, 26 Oct 2023 19:59:38 +0300 Subject: qtile: restracture --- .config/qtile/config.py | 309 ++++++++++++++++++++++-------------------------- 1 file changed, 140 insertions(+), 169 deletions(-) (limited to '.config/qtile/config.py') diff --git a/.config/qtile/config.py b/.config/qtile/config.py index b99c035..337b0ea 100644 --- a/.config/qtile/config.py +++ b/.config/qtile/config.py @@ -1,172 +1,21 @@ -from libqtile.config import Key -from libqtile.command import lazy -from libqtile.config import Click, Drag - - -mod = "mod4" -mod = "mod4" -browser = "firefox" -term = "emacsclient -c" -editor = "emacsclient -c -a 'emacs'" - -keys = [ - Key([mod], "Return", - lazy.spawn(term), - ), - Key([mod, "shift"], "a", - lazy.spawn('anki'), - ), - Key([mod, "shift"], "m", - lazy.spawn("spotify"), - ), - Key([mod], "Tab", - lazy.spawn("rofi -show drun"), - ), - Key([mod], "r", - lazy.spawn("rofi -show run"), - ), - Key([mod], "w", - lazy.spawn("rofi -show window"), - ), - Key([mod], "p", - lazy.spawn("passmenu -p 'Password for: '"), - ), - Key([mod], "b", - lazy.spawn(browser), - ), - Key([mod, "shift"], "c", - lazy.next_layout(), - ), - Key([mod], "q", - lazy.window.kill(), - ), - Key([mod, "shift"], "r", - lazy.restart(), - ), - Key([mod, "shift"], "0", - lazy.shutdown(), - ), - Key([mod, "shift"], "e", - lazy.spawn(editor), - ), - # Switch focus of monitors - Key([mod], "period", - lazy.next_screen(), - ), - # Treetab controls - Key([mod, "shift"], "h", - lazy.layout.move_left(), - ), - Key([mod, "shift"], "l", - lazy.layout.move_right(), - ), - # Window controls - Key([mod], "n", - lazy.layout.down(), - ), - Key([mod], "p", - lazy.layout.up(), - ), - Key([mod, "shift"], "n", - lazy.layout.shuffle_down(), - lazy.layout.section_down(), - ), - Key([mod, "shift"], "p", - lazy.layout.shuffle_up(), - lazy.layout.section_up(), - ), - Key([mod], "s", - lazy.layout.shrink(), - lazy.layout.decrease_nmaster(), - ), - Key([mod], "l", - lazy.layout.grow(), - lazy.layout.increase_nmaster(), - ), - Key([mod], "o", - lazy.layout.normalize(), - ), - Key([mod], "m", - lazy.layout.maximize(), - ), - Key([mod, "shift"], "f", - lazy.window.toggle_floating(), - ), - Key([mod], "f", - lazy.window.toggle_fullscreen(), - ), - # Stack controls - Key([mod, "shift"], "Tab", - lazy.layout.rotate(), - lazy.layout.flip(), - ), - Key([mod, "shift"], "space", - lazy.layout.toggle_split(), - ), - # Volume controls - Key([], "XF86AudioLowerVolume", - lazy.spawn('amixer sset Master 5%-'), - ), - Key([], "XF86AudioRaiseVolume", - lazy.spawn('amixer sset Master 5%+'), - ), - # I use mod+F[key] to change volume in my thinkpad, - # as I dislike using "fn" key in laptops - Key([mod], "F11", - lazy.spawn('amixer sset Master 5%-'), - ), - Key([mod], "F12", - lazy.spawn('amixer sset Master 5%+'), - ), - # Music controls | MOC - Key([mod], "u", - lazy.spawn("mocp -G "), - ), - Key([mod], "o", - lazy.spawn("mocp -f"), - ), - Key([mod], "i", - lazy.spawn("mocp -r"), - ), - # Change languages - Key([], "F1", - lazy.spawn("setxkbmap us -option ctrl:swapcaps"), - ), - Key([], "F2", - lazy.spawn("setxkbmap gr"), - ), -] - - -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()), - ] - import os import subprocess from libqtile import layout, bar, widget, hook from libqtile.config import Group, Screen from libqtile.dgroups import simple_key_binder +from libqtile.config import Key +from libqtile.command import lazy +from libqtile.config import Click, Drag from colors import dracula -@hook.subscribe.startup_once -def start_once(): - """Set your autostart script.""" - autostart_path = os.path.expanduser('~/.config/autostart/autostart.sh') - subprocess.run([autostart_path]) - - - - -# Use this to change between workspaces -dgroups_key_binder = simple_key_binder("mod4") +# autostart_commands = ["picom", +# "feh --bg-scale ~/wallpapers/wtf.jpeg", +# "setxkbmap us -option ctrl:swapcaps"] +# for command in autostart_commands: +# subprocess.run(command) + # Groups and layouts groups = [] @@ -178,11 +27,9 @@ group_layouts = ["monadtall", "monadtall", "monadtall", "monadtall", for i in range(len(group_names)): groups.append( - Group( - name=group_names[i], - layout=group_layouts[i].lower(), - label=group_labels[i], - )) + Group(name=group_names[i], + layout=group_layouts[i].lower(), + label=group_labels[i],)) def init_layout_theme(): @@ -193,10 +40,8 @@ def init_layout_theme(): "border_normal": dracula["bg"], } - layout_theme = init_layout_theme() - layouts = [ layout.MonadTall(**layout_theme), # layout.MonadWide(**layout_theme), @@ -219,8 +64,6 @@ layouts = [ ] # Widgets - - def init_widgets_defaults(): """Set widget default settings.""" return dict(font="JetBrains Mono", @@ -431,3 +274,131 @@ cursor_warp = True auto_fullscreen = True focus_on_window_activation = "smart" # or focus wmname = "Qtile-Apo11o" + + +## Keys + +# Use this to change between workspaces +dgroups_key_binder = simple_key_binder("mod4") +mod = "mod4" +browser = "firefox" + +keys = [ + Key([mod], "Return", + lazy.spawn("emacsclient -c"), + ), + Key([mod, "shift"], "a", + lazy.spawn('anki'), + ), + Key([mod, "shift"], "m", + lazy.spawn("emacsclient -e '(thanos/pass-launcher)'"), + ), + Key([mod], "Tab", + lazy.spawn("rofi -show drun"), + ), + Key([mod], "r", + lazy.spawn("rofi -show run"), + ), + Key([mod], "w", + lazy.spawn("rofi -show window"), + ), + Key([mod], "p", + lazy.spawn("passmenu -p 'Password for: '"), + ), + Key([mod], "b", + lazy.spawn(browser), + ), + Key([mod, "shift"], "c", + lazy.next_layout(), + ), + Key([mod], "q", + lazy.window.kill(), + ), + Key([mod, "shift"], "r", + lazy.restart(), + ), + Key([mod, "shift"], "0", + lazy.shutdown(), + ), + Key([mod, "shift"], "e", + lazy.spawn("emacs"), + ), + # Switch focus of monitors + Key([mod], "period", + lazy.next_screen(), + ), + # Treetab controls + Key([mod, "shift"], "h", + lazy.layout.move_left(), + ), + Key([mod, "shift"], "l", + lazy.layout.move_right(), + ), + # Window controls + Key([mod], "n", + lazy.layout.down(), + ), + Key([mod], "p", + lazy.layout.up(), + ), + Key([mod, "shift"], "n", + lazy.layout.shuffle_down(), + lazy.layout.section_down(), + ), + Key([mod, "shift"], "p", + lazy.layout.shuffle_up(), + lazy.layout.section_up(), + ), + Key([mod], "s", + lazy.layout.shrink(), + lazy.layout.decrease_nmaster(), + ), + Key([mod], "l", + lazy.layout.grow(), + lazy.layout.increase_nmaster(), + ), + Key([mod], "o", + lazy.layout.normalize(), + ), + Key([mod], "m", + lazy.layout.maximize(), + ), + Key([mod, "shift"], "f", + lazy.window.toggle_floating(), + ), + Key([mod], "f", + lazy.window.toggle_fullscreen(), + ), + # Stack controls + Key([mod, "shift"], "Tab", + lazy.layout.rotate(), + lazy.layout.flip(), + ), + Key([mod, "shift"], "space", + lazy.layout.toggle_split(), + ), + # Volume controls + Key([], "XF86AudioLowerVolume", + lazy.spawn("pamixer -d 5") + ), + Key([], "XF86AudioRaiseVolume", + lazy.spawn("pamixer -i 5") + ), + # I use mod+F[key] to change volume in my thinkpad, + # as I dislike using "fn" key in laptops + Key([mod], "F11", + lazy.spawn('amixer sset Master 5%-'), + ), + Key([mod], "F12", + lazy.spawn('amixer sset Master 5%+'), + ), + ] + +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()), + ] -- cgit v1.2.3