Want A List Of Your Keybindings? Write A Shell Script!



I love showing real-world problems being solved through the use of shell scripting. One question I often get is “How can I get complete list of my keybindings for my window manager?” So I will show you how I could quickly write a script to do this for my Xmonad desktop, and you could do the same for any window manager that you use.

NOTE:
I have NOT uploaded the script in this video to my GitLab yet due to an Internet outage (again!). I will try to upload it for you guys tomorrow.

WANT TO SUPPORT THE CHANNEL?
💰 Patreon: https://www.patreon.com/distrotube
💳 Paypal: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=derek%40distrotube%2ecom&lc=US&item_name=DistroTube&no_note=0&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
🛍️ Amazon: https://amzn.to/2RotFFi
👕 Teespring: https://teespring.com/stores/distrotube

DONATE CRYPTO:
💰 Bitcoin: 1Mp6ebz5bNcjNFW7XWHVht36SkiLoxPKoX
🐶 Dogecoin: D5fpRD1JRoBFPDXSBocRTp8W9uKzfwLFAu
📕 LBC: bMfA2c3zmcLxPCpyPcrykLvMhZ7A5mQuhJ

SOCIAL PLATFORMS:
🗨️ Mastodon: https://distrotoot.com/@derek
👫 Reddit: https://www.reddit.com/r/DistroTube/
📽️ LBRY/Odysee: https://odysee.com/$/invite/@DistroTube:2

DT ON THE WEB:
🕸️ Website: http://distrotube.com/
🐿️ Gemini Capsule: gemini://distro.tube
📁 GitLab: https://gitlab.com/dwt1

FREE AND OPEN SOURCE SOFTWARE THAT I USE:
🌐 Brave Browser – https://brave.com/dis872
📽️ Open Broadcaster Software: https://obsproject.com/
🎬 Kdenlive: https://kdenlive.org
🎨 GIMP: https://www.gimp.org/
🎵 Ardour: https://ardour.org/
💻 VirtualBox: https://www.virtualbox.org/
🗒️ Doom Emacs: https://github.com/hlissner/doom-emacs

Your support is very much appreciated. Thanks, guys!

35 thoughts on “Want A List Of Your Keybindings? Write A Shell Script!

  1. Before getting 5 minutes into the video, I paused it and did it for my i3 config file. I colored all the output to make it easy to read. But since I colored it with ANSI escape codes, I couldn't properly display it in YAD, so it displays in the terminal.

  2. Dunno why, but YouTube got rid of my previous post with the solution, but here it is again. Here's the thing rewritten in awk (excluding the yad stuff), and also gets rid of the extra space on the very first line:

    awk 'BEGIN { group = "awkinitialization" }
    /START_KEYS/ { flag = 1 }
    /END_KEYS/ { flag = 0 }
    /KB_GROUP/ {
    if(group != "awkinitialization")
    printf("n")
    sub(/s*–s*KB_GROUP /, "")
    group = $0
    print
    }
    flag && /^s*[,[] (/ {
    sub(/s*[,[] /, "")
    sub(/, /, "t: ")
    print
    }' ~/.xmonad/xmonad.hs

  3. I have a little script in my qtile build that generates a markdown file with all my keybinds whenever I restart qtile. I also have a bind that opens that markdown file in a viewer for a quick help menu!

  4. I always just write out a text file called like .keyhelp or something and list all the keybindings there. Then I alias it in my zshrc with cat so "keyhelp" just pops them out in the terminal for me.

  5. Awesome vid! Taught me a few neat tricks. Wasn't aware of the Yad program either, and I've been looking for something exactly like that for one of my own scripts! Thanks 🙂

  6. its diffcult if you have keybindings all around your config files. maybe awk is a better option to do that. since it process line by line all the file.

  7. I like these kinda videos where the presenter shows the problem and how they solved it, from a purely problem-solving mindset, instead of holding your hand telling you what to do so that you can just copy-paste their code and learn nothing from it

  8. This is a fun idea for someone who already likes tinkering with TWMs and shell scripts, but honestly… I don't think you're going to convince anyone else to start using TWMs and shell scripting with this video 😉

Leave a Reply

Your email address will not be published.