mirror of
https://github.com/GRFreire/dotfiles.git
synced 2026-01-09 20:19:37 +00:00
qtile: show keybinds list with yad
This commit is contained in:
parent
de08b0a8b0
commit
595388e78c
@ -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
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
21
.config/qtile/list_keybinds.py
Normal file
21
.config/qtile/list_keybinds.py
Normal 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")
|
||||
Loading…
Reference in New Issue
Block a user