automatically export current hotkeys

This commit is contained in:
paul-loedige
2020-12-13 01:47:53 +01:00
parent 889c01eb6d
commit 5bcb81af86
+31 -18
View File
@@ -13,6 +13,7 @@ term = 'termite'
focus_color = '#bd93f9' focus_color = '#bd93f9'
border_width = 2 border_width = 2
mod = 'mod4' mod = 'mod4'
hotkey_file='/home/paul/.config/qtile/Hotkeys.csv'
#region colors #region colors
light_foreground_color = ['#f8f8f2','#f8f8f2'] light_foreground_color = ['#f8f8f2','#f8f8f2']
@@ -45,27 +46,27 @@ cyan_color = ['#8be9fd','#8be9fd']
#region Keys #region Keys
keys = [ keys = [
#moving focus aroung #moving focus aroung
Key([mod], "h", lazy.layout.left()), Key([mod], "h", lazy.layout.left(),desc="move focus left"),
Key([mod], "l", lazy.layout.right()), Key([mod], "l", lazy.layout.right(),desc="move focus right"),
Key([mod], "j", lazy.layout.down()), Key([mod], "j", lazy.layout.down(),desc="move focus down"),
Key([mod], "k", lazy.layout.up()), Key([mod], "k", lazy.layout.up(),desc="move focus up"),
Key([mod,"mod1"], "k", lazy.to_screen(0)), Key([mod,"mod1"], "k", lazy.to_screen(0),desc="move focus to top screen"),
Key([mod,"mod1"], "j", lazy.to_screen(1)), Key([mod,"mod1"], "j", lazy.to_screen(1),desc="move focus to main screen"),
Key([mod,"mod1"], "l", lazy.to_screen(1)), Key([mod,"mod1"], "l", lazy.to_screen(1),desc="move focus to main screen"),
Key([mod,"mod1"], "h", lazy.to_screen(2)), Key([mod,"mod1"], "h", lazy.to_screen(2),desc="move focus to left screen"),
# moving windows around # moving windows around
Key([mod, "shift"], "h", lazy.layout.swap_left()), Key([mod, "shift"], "h", lazy.layout.swap_left(),desc="move focused window left"),
Key([mod, "shift"], "l", lazy.layout.swap_right()), Key([mod, "shift"], "l", lazy.layout.swap_right(),desc="move focused window right"),
Key([mod, "shift"], "j", lazy.layout.shuffle_down()), Key([mod, "shift"], "j", lazy.layout.shuffle_down(),desc="move focused window down"),
Key([mod, "shift"], "k", lazy.layout.shuffle_up()), Key([mod, "shift"], "k", lazy.layout.shuffle_up(),desc="move focused window up"),
# resize windows # resize windows
Key([mod], "plus", lazy.layout.grow()), Key([mod], "plus", lazy.layout.grow(),desc="increase window size"),
Key([mod], "minus", lazy.layout.shrink()), Key([mod], "minus", lazy.layout.shrink(),desc="decrease window size"),
Key([mod], "n", lazy.layout.normalize()), Key([mod], "n", lazy.layout.normalize(),desc="normalize windows"),
Key([mod], "o", lazy.layout.maximize()), Key([mod], "o", lazy.layout.maximize(),desc="maximize current window"),
Key([mod], "space", lazy.window.toggle_fullscreen()), Key([mod], "space", lazy.window.toggle_fullscreen(),desc="make current window fullscreen"),
# app hotkeys # app hotkeys
Key([mod],"t", lazy.spawn(term), desc="Launch terminal"), Key([mod],"t", lazy.spawn(term), desc="Launch terminal"),
@@ -583,7 +584,19 @@ cursor_warp = False
auto_fullscreen = True auto_fullscreen = True
focus_on_window_activation = "smart" focus_on_window_activation = "smart"
#export keys into textfile
if os.path.isfile(hotkey_file):
os.remove(hotkey_file)
with open(hotkey_file,'w') as file:
for key in keys:
if not str(key.key).startswith("XF86"):
modifiers=""
for modifier in key.modifiers:
modifiers += '{:^7}'.format(
str(modifier).replace("mod1","Alt").replace("mod4","Super").replace("shift","Shift").replace("control","Ctrl")
) + "+"
file.write('{:30}'.format(modifiers+' '+str(key.key).upper())+"=>\t"+key.desc)
file.write('\n')
# XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this # XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this
# string besides java UI toolkits; you can see several discussions on the # string besides java UI toolkits; you can see several discussions on the