diff --git a/.config/qtile/config.py b/.config/qtile/config.py index 06a353c..62ff77b 100644 --- a/.config/qtile/config.py +++ b/.config/qtile/config.py @@ -30,6 +30,7 @@ POWER_MENU = os.path.expanduser( WEB_QUICK_OPEN = os.path.expanduser( "~/.local/bin/firefox-quick-keywords" ) # https://github.com/GRFreire/firefox-quick-keywords +SHOW_KEYBINDS = "python3 /home/grfreire/.config/qtile/list_keybinds.py" MEDIA_CONTROL = os.path.expanduser("~/.config/qtile/media_control.sh") keys = [ @@ -76,6 +77,7 @@ keys = [ # QTile Key([MOD, "control"], "r", lazy.restart(), desc="Restart Qtile"), Key([MOD, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"), + Key([MOD], "slash", lazy.spawn(SHOW_KEYBINDS), desc="Show list of qtile keybinds"), # System Key([MOD], "BackSpace", lazy.spawn(POWER_MENU), desc="Open power menu"), Key([], "Print", lazy.spawn(SCREENSHOT), desc="Take a screenshot of all the screens"), @@ -356,6 +358,7 @@ floating_layout = layout.Floating( Match(wm_class="gnome-calculator"), # Calculator Match(wm_class="pavucontrol"), # Audio mixer Match(wm_class="gnome-calendar"), # Calendar + Match(wm_class="yad"), # Yad ] ) diff --git a/.config/qtile/list_keybinds.py b/.config/qtile/list_keybinds.py new file mode 100644 index 0000000..74264ca --- /dev/null +++ b/.config/qtile/list_keybinds.py @@ -0,0 +1,21 @@ +import os +from libqtile.confreader import Config + +c = Config("/home/grfreire/.config/qtile/config.py") +c.load() + +def columnate(matrix): + def _columnate(matrix): + widths = [max(map(len, map(str, col))) for col in zip(*matrix)] + for row in matrix: + yield " ".join((str(val).ljust(width) for val, width in zip(row, widths))) + + return "\n".join(_columnate(matrix)) + +matrix = [] +for key in c.keys: + keys = ' + '.join((key.modifiers + [key.key])) + desc = key.desc + matrix.append([keys, desc]) + +os.system(f"echo \"{columnate(matrix)}\" | yad --text-info --geometry=1200x700") \ No newline at end of file