From 84b556331e481edb8d493dda63890c8682647e86 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 10 Feb 2023 20:58:37 +0200 Subject: qtile: Simplify keys --- .config/qtile/config.py | 155 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 150 insertions(+), 5 deletions(-) (limited to '.config/qtile/config.py') diff --git a/.config/qtile/config.py b/.config/qtile/config.py index a128fd5..ed0491b 100644 --- a/.config/qtile/config.py +++ b/.config/qtile/config.py @@ -1,3 +1,152 @@ +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([mod], "F1", + lazy.spawn("setxkbmap us -option ctrl:swapcaps"), + ), + Key([mod], "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()), + ] + """Configuration for qtile.""" import os @@ -5,7 +154,6 @@ import subprocess from libqtile import layout, bar, widget, hook from libqtile.config import Group, Screen from libqtile.dgroups import simple_key_binder -from keys import MyKeys from colors import dracula @@ -16,15 +164,12 @@ def start_once(): subprocess.run([autostart_path]) -# Keybindings -my_keys = MyKeys() -keys = my_keys.init_keys() # Use this to change between workspaces dgroups_key_binder = simple_key_binder("mod4") -mouse = my_keys.init_mouse() + # Groups and layouts groups = [] -- cgit v1.2.3