Last active
October 29, 2024 22:10
-
-
Save purarue/b94254dc5b731a57c2e525de699887ad to your computer and use it in GitHub Desktop.
print a table of the current keybindings in qtile (v 0.15.1)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Copyright (c) 2017, Piotr Przymus | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in | |
# all copies or substantial portions of the Software. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
# SOFTWARE. | |
""" | |
Print a table of the current keybindings in qtile | |
This is a modified version of the qtile-cmd script | |
https://gist.github.com/purarue/b94254dc5b731a57c2e525de699887ad | |
""" | |
from libqtile.ipc import find_sockfile, Client | |
from libqtile.command_client import InteractiveCommandClient | |
from libqtile.command_interface import IPCCommandInterface | |
def main(): | |
"Prints a table of current keybindings." | |
ipc_client = Client(find_sockfile()) | |
cmd_object = IPCCommandInterface(ipc_client) | |
cmd_client = InteractiveCommandClient(cmd_object) | |
print(getattr(cmd_client, "display_kb")()) | |
if __name__ == "__main__": | |
main() |
Example Output:
KeySym Mod Command Desc
------ ----------- ------------------------------------------------------ ----
1 mod4 toscreen()
1 shift, mod4 togroup('1', switch_group = False)
2 mod4 toscreen()
2 shift, mod4 togroup('2', switch_group = False)
3 mod4 toscreen()
3 shift, mod4 togroup('3', switch_group = False)
4 mod4 toscreen()
4 shift, mod4 togroup('4', switch_group = False)
5 mod4 toscreen()
5 shift, mod4 togroup('5', switch_group = False)
6 mod4 toscreen()
6 shift, mod4 togroup('6', switch_group = False)
7 mod4 toscreen()
7 shift, mod4 togroup('7', switch_group = False)
8 mod4 toscreen()
8 shift, mod4 togroup('8', switch_group = False)
9 mod4 toscreen()
9 shift, mod4 togroup('9', switch_group = False)
Return mod4 spawn('alacritty')
Tab mod4 spawn('rofi -show window -display-window "window > "')
Tab shift, mod4 next_layout()
f mod4 toggle_fullscreen()
f shift, mod4 toggle_floating()
h mod4 left()
h shift, mod4 swap_left()
i mod4 grow()
j mod4 down()
j shift, mod4 shuffle_down()
k mod4 up()
k shift, mod4 shuffle_up()
l mod4 right()
l shift, mod4 swap_right()
m mod4 shrink()
n mod4 normalize()
o mod4 maximize()
q mod4 kill()
r mod4 spawn('rofi -show run -display-run "run > "')
r shift, mod4 restart()
space shift, mod4 flip()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This does already exist in
qtile-cmd
but thepprint
call messes up the output and makes it look unreadable.This could be installed by doing:
curl "https://gist.githubusercontent.com/purarue/b94254dc5b731a57c2e525de699887ad/raw/40e9229112f0fdbf1555de9c79d251e5bde3602c/qtile_display_kb.py" > ./qtile_keybinds && chmod u+x qtile_keybinds && sudo mv qtile_keybinds /usr/local/bin
which downloads this, makes it executable and puts it your
$PATH
asqtile_keybinds