qtile: show keybinds list with yad

This commit is contained in:
Guilherme Rugai Freire 2021-08-08 19:51:21 -03:00
parent de08b0a8b0
commit 595388e78c
No known key found for this signature in database
GPG Key ID: 0F9FE41723A8A297
2 changed files with 24 additions and 0 deletions

View File

@ -30,6 +30,7 @@ POWER_MENU = os.path.expanduser(
WEB_QUICK_OPEN = os.path.expanduser( WEB_QUICK_OPEN = os.path.expanduser(
"~/.local/bin/firefox-quick-keywords" "~/.local/bin/firefox-quick-keywords"
) # https://github.com/GRFreire/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") MEDIA_CONTROL = os.path.expanduser("~/.config/qtile/media_control.sh")
keys = [ keys = [
@ -76,6 +77,7 @@ keys = [
# QTile # QTile
Key([MOD, "control"], "r", lazy.restart(), desc="Restart Qtile"), Key([MOD, "control"], "r", lazy.restart(), desc="Restart Qtile"),
Key([MOD, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"), Key([MOD, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
Key([MOD], "slash", lazy.spawn(SHOW_KEYBINDS), desc="Show list of qtile keybinds"),
# System # System
Key([MOD], "BackSpace", lazy.spawn(POWER_MENU), desc="Open power menu"), Key([MOD], "BackSpace", lazy.spawn(POWER_MENU), desc="Open power menu"),
Key([], "Print", lazy.spawn(SCREENSHOT), desc="Take a screenshot of all the screens"), 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="gnome-calculator"), # Calculator
Match(wm_class="pavucontrol"), # Audio mixer Match(wm_class="pavucontrol"), # Audio mixer
Match(wm_class="gnome-calendar"), # Calendar Match(wm_class="gnome-calendar"), # Calendar
Match(wm_class="yad"), # Yad
] ]
) )

View File

@ -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")