#!/usr/bin/env bash # Searchable cheat sheet of Hyprland keybindings, shown in wofi. # # The descriptions shown here come from the `desc` option passed to hl.bind() # in ~/.config/hypr/binds.lua, read back at runtime via `hyprctl binds -j`, # so the cheat sheet always matches the live config. set -u mods_from_mask() { local mask="$1" out="" (( mask & 1 )) && out="${out:+$out + }SHIFT" (( mask & 4 )) && out="${out:+$out + }CTRL" (( mask & 8 )) && out="${out:+$out + }ALT" (( mask & 64 )) && out="${out:+$out + }SUPER" (( mask & 128 )) && out="${out:+$out + }MOD5" printf "%s" "$out" } hyprctl binds -j | jq -rc '.[] | select(.has_description) | select(.description != "") | [.modmask, .key, .description] | @tsv' | while IFS=$'\t' read -r mask key desc; do if (( mask )); then mods="$(mods_from_mask "$mask")" printf '%s + %s\t%s\n' "$mods" "$key" "$desc" else printf '%s\t%s\n' "$key" "$desc" fi done | sort -k1,1 | column -t -s $'\t' | wofi --dmenu --prompt "Hyprland keybinds" >/dev/null