From 33d11a022aa3cc77f130dbf03088cb4afe9ab11a Mon Sep 17 00:00:00 2001 From: The-Repo-Club Date: Tue, 29 Aug 2023 21:06:34 +0100 Subject: [PATCH] Fixup Qtile a bit --- dconf/.config/dconf/user | Bin 8466 -> 8622 bytes qtile/.config/qtile/config.py | 175 +++++-------------------------- qtile/.config/qtile/keys.py | 164 +++++++++++++++++++++++++++++ qtile/.config/qtile/variables.py | 25 +++++ 4 files changed, 214 insertions(+), 150 deletions(-) create mode 100644 qtile/.config/qtile/keys.py create mode 100644 qtile/.config/qtile/variables.py diff --git a/dconf/.config/dconf/user b/dconf/.config/dconf/user index 308b855699b0ad9561f11dc2c828faffa4c4fa67..90f87141fdb18c9b8efada0cd365a107af1aaaed 100644 GIT binary patch literal 8622 zcmcJVdz2K_oyThs1O#~)<*9L0#6hR%c|RJEQ51$aJbVFB5URUtrpxK>>aD7t8Sn*y z0U~bDL?vRBHOaha^8DI)Hvk%JACWwHl0;=I!PzM?d zh{Dqgm;uiO=M-=*d_I^1n!(o!xB#Bl5A(Sf7Jv&2xEQ_!TnZL}#RV*Zh0DM)u>9{} z1)p0W2I3&`1!%?AR)7Ov2~r>fvcLnH>|6nz@Tvl?f`zNWwFO)UuLf(t^AD#I>4jDD8Daj-n{t?fgwOAn@f3SJHN%-J#Za_rK_ z(0()g6qu4+y<71nJrMg|_}5_MOa954k5FSji0ysw%ChsDy4#-Fgjmmj1@(7pn$1IfALUr~%nYn)AR3)nkv>nDnJ>0@cX0#4$98=l#E zmF7iS{>;Mbz`NgX|CQoe`gq!JfwzKXAAEcuf?ZmE-U&Yfrcb?Qh}N(4Q0#l)7r|p2 z{_?xI*rnC~EARpE(Zy@-RC{T)KMa2c{#@Eo;$oMUAI2SL7!$#o$i^47rlmD6W$=x_ zT=w-XS?tn^!|%Y`z}xAAk1Ib(55xW-yc66}JNqpkyY#Wx_rQC>Y3m+2P5zOVKVOCQ zLXi#C!xdN3W3iXQr-8eNuCLa5mDczx;8|eZlfy?T-lWy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kND7OSl&R+rTFCeOIWW3DV*`9NLy0kh}f)mrRAXH{jX`pQzZ z$sXpDUGjfr$%e|3b;(>%@Y~BXud-}oW!d^oEH+*{Yo~lt(ax4wzgW&SpRJuJ7CU$ zXu#$HzZ~%9fDr>52d)@M#wg`(vu()~yHYvF&qjTB?98h?%_tP&RW0mDRW;O9H?&kY zHcYT|SJ&8B-O|dx(k-%N+5c|{Xssu;pp>!upAGndyi$yG z{xFqAe{Vhh_ZM`%-n%|;y;avAd+%@luCAx2eY{WCo@p<=sOz2H-}OeV>*ad-Kfm2v zdwPE_moM`X=6Y({D=(Yt3+peJFTbaJU(PcR{!G^!)5e>3gR>aFW3$FAF8P13%@tKzJ9cokZb~!h(%M81mf)#ol z#jLVZln(=CrYM=nP$rqGb<^oq*R>n#n(FKZx5c%cmZo|;-O}3ZHMy&8B0sXy|Pd4W7kO#qYz~MkUMC~``gNi}n{zt&_o!UmX)=Rb6Eln++-Qd*GX*cEC zEiSp)^%`5;`lf{WTWmeW`|dr}nE&T}r26){?E z%`w2|<4F0u7JntdkBRa0Wh7A6E}!EZc1FhSRG_H*;&?Pi-)`U237-A#|LxoxA0RTJ zM=P@gk;cpND-Or95HI;C8L`I*+5R|e9XyZSn75MlS4^hTSDf;E$_Ayac)3@M8E16c zY{#O~**N|nvcSpvVKL%+$lrVyG5*V#EhoE0W{7DJ@#m#mT3XW0ROhraL%epowTZcs qO4l_ux3||cI<>8diz$2-FqP=#rHA>S??)Uw`h2P}N4WjxsQ(4mfZam? diff --git a/qtile/.config/qtile/config.py b/qtile/.config/qtile/config.py index d435176ac..572a29665 100644 --- a/qtile/.config/qtile/config.py +++ b/qtile/.config/qtile/config.py @@ -5,7 +5,7 @@ # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# to use, copy, Variables.MODify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: @@ -25,21 +25,15 @@ import subprocess from widgets import Widgets from groups import Groups +from keys import Keys +from variables import Commands, Variables from colors import colorScheme, currentColor locale.setlocale(locale.LC_ALL, "") from libqtile import qtile, bar, layout, hook -from libqtile.config import ( - Key, - Click, - Drag, - Screen, - Match, - KeyChord, - ScratchPad, - DropDown, -) +from libqtile.config import Key, Click, Drag, Screen, Match, ScratchPad, DropDown + from libqtile.lazy import lazy from typing import Callable @@ -71,138 +65,12 @@ def go_to_group(name: str) -> Callable: return _inner -class Commands(object): - editor = "code" - menu = "menu" - browser = "firefox" - terminal = "alacritty" - btop = "kitty --class=btop -e btop" - powermenu = "rofi -show powermenu -config ~/.config/rofi/powermenu.rasi" - vbox = "virt-manager" - files = "nemo" - mail = "thunderbird" - passmenu = "passmenu" - - autostart = ["autostart"] - configure = [ - "youtube_subs -d", - "autorandr --load qtile", - "setxkbmap -option caps:escape", - ] - - -################## -## Key Bindings ## -################## - -ALT = "mod1" -MOD = "mod4" -CTRL = "control" -SHIFT = "shift" - -keys = [ - # qtile commands - Key([MOD, SHIFT], "r", lazy.reload_config(), desc="Reload the config"), - Key([MOD, CTRL], "r", lazy.restart(), desc="Restart qtile"), - # Switch between windows - Key([MOD], "h", lazy.layout.left(), desc="Move focus to left"), - Key([MOD], "l", lazy.layout.right(), desc="Move focus to right"), - Key([MOD], "j", lazy.layout.down(), desc="Move focus down"), - Key([MOD], "k", lazy.layout.up(), desc="Move focus up"), - # reset all windows - Key([MOD], "n", lazy.layout.normalize(), desc="Reset all window sizes"), - # Toggle between different layouts as defined below - Key([MOD], "Tab", lazy.next_layout(), desc="Toggle between layouts"), - Key([MOD], "t", lazy.window.toggle_floating(), desc="Toggle floating"), - Key([MOD], "q", lazy.window.kill(), desc="Kill focused window"), - # Custom keybinds - Key([MOD], "Return", lazy.spawn(Commands.terminal), desc="Launch terminal"), - Key([MOD], "m", lazy.spawn(Commands.menu), desc="Launch menu"), - Key([MOD], "p", lazy.spawn(Commands.passmenu), desc="Launch password menu"), - Key([MOD, CTRL], "f", lazy.spawn(Commands.browser), desc="Launch browser"), - Key([MOD, CTRL], "c", lazy.spawn(Commands.editor), desc="Launch editor"), - Key([MOD, SHIFT], "e", lazy.spawn(Commands.powermenu), desc="Launch power menu"), - Key([MOD, SHIFT], "Return", lazy.spawn(Commands.files), desc="Launch files"), - Key([MOD], "b", lazy.spawn(Commands.btop), desc="Launch btop"), - # Audio Settings - Key([], "XF86AudioMute", lazy.spawn("amixer set Master toggle")), - Key( - [], - "XF86AudioLowerVolume", - lazy.spawn("amixer set Master '5%-' unmute"), - ), - Key( - [], - "XF86AudioRaiseVolume", - lazy.spawn("amixer set Master '5%+' unmute"), - ), - # https://github.com/acrisci/playerctl/ - Key([], "XF86AudioPlay", lazy.spawn("playerctl play-pause")), - Key([], "XF86AudioNext", lazy.spawn("playerctl next")), - Key([], "XF86AudioPrev", lazy.spawn("playerctl previous")), - Key([], "XF86AudioStop", lazy.spawn("playerctl stop")), - # xBacklight - Key([], "XF86MonBrightnessUp", lazy.spawn("brightnessctl set 5%+")), - Key([], "XF86MonBrightnessDown", lazy.spawn("brightnessctl set 5%-")), -] - -keys.extend( - [ - ################ - ## Key Chords ## - ################ - # Grow windows. If current window is on the edge of screen and direction - # will be to screen edge - window would shrink. - KeyChord( - [MOD], - "r", - [ - Key([], "h", lazy.layout.grow_left(), desc="Grow window to the left"), - Key([], "l", lazy.layout.grow_right(), desc="Grow window to the right"), - Key([], "j", lazy.layout.grow_down(), desc="Grow window down"), - Key([], "k", lazy.layout.grow_up(), desc="Grow window up"), - ], - mode=True, - name="Resize Windows", - ), - KeyChord( - [MOD, CTRL], - "g", - [ - Key([], "s", lazy.spawn("prime-run steam"), desc="Spawn steam"), - Key([], "m", lazy.spawn("prime-run minecraft"), desc="Spawn minecraft"), - ], - mode=False, - name="Launch Game", - ), - KeyChord( - [MOD], - "Print", - [ - Key([], "w", lazy.spawn("win-shot -w"), desc="Screen Shot Window"), - Key([], "s", lazy.spawn("win-shot -s"), desc="Screen Shot Selected"), - Key([], "f", lazy.spawn("win-shot -f"), desc="Screen Shot Full"), - ], - mode=False, - name="Take a Screenshot", - ), - ] -) - ############ ## Groups ## ############ groups = Groups.groups -for i in groups: - keys.extend( - [ - Key([MOD], i.name, lazy.function(go_to_group(i.name))), - Key([MOD, "shift"], i.name, lazy.window.togroup(i.name)), - ] - ) - # Define scratchpads groups.append( ScratchPad( @@ -248,15 +116,19 @@ groups.append( ) ) -# Scratchpad keybindings -keys.extend( - [ - Key([CTRL], "Return", lazy.group["Hyper_L"].dropdown_toggle("term")), - Key([ALT], "c", lazy.group["Hyper_L"].dropdown_toggle("clifm")), - Key([ALT], "b", lazy.group["Hyper_L"].dropdown_toggle("btop")), - Key([ALT], "v", lazy.group["Hyper_L"].dropdown_toggle("volume")), - ] -) +################## +## Key Bindings ## +################## + +keys = Keys.keys + +for i in groups: + keys.extend( + [ + Key([Variables.MOD], i.name, lazy.function(go_to_group(i.name))), + Key([Variables.MOD, "shift"], i.name, lazy.window.togroup(i.name)), + ] + ) #################### @@ -303,7 +175,7 @@ layouts = [ **layout_theme, ), # layout.TreeTab(**layout_theme,), - # layout.VerticalTile(**layout_theme,), + # layout.VerticVariables.ALTile(**layout_theme,), layout.Zoomy( **layout_theme, ), @@ -422,15 +294,18 @@ screens = [ ################### mouse = [ Drag( - [MOD], + [Variables.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() + [Variables.MOD], + "Button3", + lazy.window.set_size_floating(), + start=lazy.window.get_size(), ), - Click([MOD], "Button2", lazy.window.bring_to_front()), + Click([Variables.MOD], "Button2", lazy.window.bring_to_front()), ] ################### diff --git a/qtile/.config/qtile/keys.py b/qtile/.config/qtile/keys.py new file mode 100644 index 000000000..2d667cde7 --- /dev/null +++ b/qtile/.config/qtile/keys.py @@ -0,0 +1,164 @@ +from variables import Commands, Variables + +from libqtile.lazy import lazy + +from libqtile.config import Key, KeyChord + + +class Keys(object): + keys = [ + # qtile commands + Key( + [Variables.MOD, Variables.SHIFT], + "r", + lazy.reload_config(), + desc="Reload the config", + ), + Key([Variables.MOD, Variables.CTRL], "r", lazy.restart(), desc="Restart qtile"), + # Switch between windows + Key([Variables.MOD], "h", lazy.layout.left(), desc="Move focus to left"), + Key([Variables.MOD], "l", lazy.layout.right(), desc="Move focus to right"), + Key([Variables.MOD], "j", lazy.layout.down(), desc="Move focus down"), + Key([Variables.MOD], "k", lazy.layout.up(), desc="Move focus up"), + # reset all windows + Key( + [Variables.MOD], "n", lazy.layout.normalize(), desc="Reset all window sizes" + ), + # Toggle between different layouts as defined below + Key([Variables.MOD], "Tab", lazy.next_layout(), desc="Toggle between layouts"), + Key( + [Variables.MOD], "t", lazy.window.toggle_floating(), desc="Toggle floating" + ), + Key([Variables.MOD], "q", lazy.window.kill(), desc="Kill focused window"), + # Custom keybinds + Key( + [Variables.MOD], + "Return", + lazy.spawn(Commands.terminal), + desc="Launch terminal", + ), + Key([Variables.MOD], "m", lazy.spawn(Commands.menu), desc="Launch menu"), + Key( + [Variables.MOD], + "p", + lazy.spawn(Commands.passmenu), + desc="Launch password menu", + ), + Key( + [Variables.MOD, Variables.CTRL], + "f", + lazy.spawn(Commands.browser), + desc="Launch browser", + ), + Key( + [Variables.MOD, Variables.CTRL], + "c", + lazy.spawn(Commands.editor), + desc="Launch editor", + ), + Key( + [Variables.MOD, Variables.SHIFT], + "e", + lazy.spawn(Commands.powermenu), + desc="Launch power menu", + ), + Key( + [Variables.MOD, Variables.SHIFT], + "Return", + lazy.spawn(Commands.files), + desc="Launch files", + ), + Key([Variables.MOD], "b", lazy.spawn(Commands.btop), desc="Launch btop"), + # Audio Settings + Key([], "XF86AudioMute", lazy.spawn("amixer set Master toggle")), + Key( + [], + "XF86AudioLowerVolume", + lazy.spawn("amixer set Master '5%-' unmute"), + ), + Key( + [], + "XF86AudioRaiseVolume", + lazy.spawn("amixer set Master '5%+' unmute"), + ), + # https://github.com/acrisci/playerctl/ + Key([], "XF86AudioPlay", lazy.spawn("playerctl play-pause")), + Key([], "XF86AudioNext", lazy.spawn("playerctl next")), + Key([], "XF86AudioPrev", lazy.spawn("playerctl previous")), + Key([], "XF86AudioStop", lazy.spawn("playerctl stop")), + # xBacklight + Key([], "XF86MonBrightnessUp", lazy.spawn("brightnessctl set 5%+")), + Key([], "XF86MonBrightnessDown", lazy.spawn("brightnessctl set 5%-")), + ] + + ################ + ## Key Chords ## + ################ + + keys.extend( + [ + # Grow windows. If current window is on the edge of screen and direction + # will be to screen edge - window would shrink. + KeyChord( + [Variables.MOD], + "r", + [ + Key( + [], "h", lazy.layout.grow_left(), desc="Grow window to the left" + ), + Key( + [], + "l", + lazy.layout.grow_right(), + desc="Grow window to the right", + ), + Key([], "j", lazy.layout.grow_down(), desc="Grow window down"), + Key([], "k", lazy.layout.grow_up(), desc="Grow window up"), + ], + mode=True, + name="Resize Windows", + ), + KeyChord( + [Variables.MOD, Variables.CTRL], + "g", + [ + Key([], "s", lazy.spawn("prime-run steam"), desc="Spawn steam"), + Key( + [], + "m", + lazy.spawn("prime-run minecraft"), + desc="Spawn minecraft", + ), + ], + mode=False, + name="Launch Game", + ), + KeyChord( + [Variables.MOD], + "Print", + [ + Key([], "w", lazy.spawn("win-shot -w"), desc="Screen Shot Window"), + Key( + [], "s", lazy.spawn("win-shot -s"), desc="Screen Shot Selected" + ), + Key([], "f", lazy.spawn("win-shot -f"), desc="Screen Shot Full"), + ], + mode=False, + name="Take a Screenshot", + ), + ] + ) + + # Scratchpad keybindings + keys.extend( + [ + Key( + [Variables.CTRL], + "Return", + lazy.group["Hyper_L"].dropdown_toggle("term"), + ), + Key([Variables.ALT], "c", lazy.group["Hyper_L"].dropdown_toggle("clifm")), + Key([Variables.ALT], "b", lazy.group["Hyper_L"].dropdown_toggle("btop")), + Key([Variables.ALT], "v", lazy.group["Hyper_L"].dropdown_toggle("volume")), + ] + ) diff --git a/qtile/.config/qtile/variables.py b/qtile/.config/qtile/variables.py new file mode 100644 index 000000000..2675318ec --- /dev/null +++ b/qtile/.config/qtile/variables.py @@ -0,0 +1,25 @@ +class Variables(object): + ALT = "mod1" + MOD = "mod4" + CTRL = "control" + SHIFT = "shift" + + +class Commands(object): + editor = "code" + menu = "menu" + browser = "firefox" + terminal = "alacritty" + btop = "kitty --class=btop -e btop" + powermenu = "rofi -show powermenu -config ~/.config/rofi/powermenu.rasi" + vbox = "virt-manager" + files = "nemo" + mail = "thunderbird" + passmenu = "passmenu" + + autostart = ["autostart"] + configure = [ + "youtube_subs -d", + "autorandr --load qtile", + "setxkbmap -option caps:escape", + ]