Revert "Update keyboard shortcuts script to show all runtime keybinds (#70)"

This reverts commit 6433511873.
This commit is contained in:
David Heinemeier Hansson
2025-07-13 17:27:33 -07:00
parent 59b59807a9
commit dc0032c9c3
8 changed files with 131 additions and 148 deletions

View File

@ -1,64 +1,59 @@
#!/bin/bash #!/bin/bash
# Define modifier flags as associative array for name lookup # A script to display Hyprland keybindings defined in your configuration
# per https://github.com/hyprwm/Hyprland/blob/main/src/devices/IKeyboard.hpp#L13-L22 # using wofi for an interactive search menu.
declare -A MODIFIER_NAMES=(
[$((1 << 0))]="SHIFT"
[$((1 << 1))]="CAPS"
[$((1 << 2))]="CTRL"
[$((1 << 3))]="ALT"
[$((1 << 4))]="MOD2"
[$((1 << 5))]="MOD3"
[$((1 << 6))]="SUPER"
[$((1 << 7))]="MOD5"
)
decode_modmask() { USER_HYPRLAND_CONF="$HOME/.config/hypr/hyprland.conf"
local modifiers=$1 OMARCHY_BINDINGS_CONF="$HOME/.local/share/omarchy/default/hypr/bindings.conf $HOME/.local/share/omarchy/default/hypr/bindings/tiling.conf $HOME/.local/share/omarchy/default/hypr/bindings/utilities.conf $HOME/.local/share/omarchy/default/hypr/bindings.conf $HOME/.local/share/omarchy/default/hypr/media.conf"
local result=()
for bit in "${!MODIFIER_NAMES[@]}"; do OMARCHY_BINDINGS_CONF="$HOME/.local/share/omarchy/default/hypr/bindings.conf \
if (( modifiers & bit )); then $HOME/.local/share/omarchy/default/hypr/bindings/tiling.conf \
result+=("${MODIFIER_NAMES[$bit]}") $HOME/.local/share/omarchy/default/hypr/bindings/utilities.conf \
fi $HOME/.local/share/omarchy/default/hypr/media.conf"
done
# Output all detected modifiers (plus-separated) # Process the configuration file to extract and format keybindings
echo "${result[*]}" # 1. `grep` finds all lines starting with 'bind' (allowing for leading spaces).
# 2. The first `sed` removes comments (anything after a '#').
# 3. `awk` does the heavy lifting of formatting the output.
# - It sets the field separator to a comma ','.
# - It removes the 'bind... =' part from the beginning of the line.
# - It joins the key combination (e.g., "SUPER + Q").
# - It joins the command that the key executes.
# - It prints everything in a nicely aligned format.
# 4. The final `sed` cleans up any leftover commas from the end of lines.
grep -h '^[[:space:]]*bind' $USER_HYPRLAND_CONF $OMARCHY_BINDINGS_CONF |
sed 's/#.*//' |
sed '/^[[:space:]]*$/d' |
sort -u |
awk -F, '
{
# Strip trailing comments
sub(/#.*/, "");
# Remove the "bind... =" part and surrounding whitespace
sub(/^[[:space:]]*bind[^=]*=(\+[[:space:]])?(exec, )?[[:space:]]*/, "", $1);
# Combine the modifier and key (first two fields)
key_combo = $1 " + " $2;
# Clean up: strip leading "+" if present, trim spaces
gsub(/^[ \t]*\+?[ \t]*/, "", key_combo);
gsub(/[ \t]+$/, "", key_combo);
# Reconstruct the command from the remaining fields
action = "";
for (i = 3; i <= NF; i++) {
action = action $i (i < NF ? "," : "");
} }
# Read live keybinds, not config file # Clean up trailing commas, remove leading "exec, ", and trim
OLD_IFS=$IFS sub(/,$/, "", action);
IFS=$'\n' gsub(/(^|,)[[:space:]]*exec[[:space:]]*,?/, "", action);
readarray -t KEYBINDS < <(hyprctl -j binds | jq -cr '.[]') gsub(/^[ \t]+|[ \t]+$/, "", action);
IFS=$OLD_IFS gsub(/[ \t]+/, " ", key_combo); # Collapse multiple spaces to one
# Loop over each keybind and pipe results to wofi for inspection/execution if (action != "") {
# Format to send to wofi: printf "%-35s → %s\n", key_combo, action;
# }
# <dispatcher> -- <arg> #<Modifier Keys> <Key> - <Description> }' |
# exec -- alacritty #SUPER return - Launch a Terminal flock --nonblock /tmp/.wofi.lock -c "wofi -dmenu -i --width 60% --height 70% -p 'Hyprland Keybindings' -O alphabetical --style=\"$HOME/.local/share/omarchy/default/wofi/search.css\""
# or
# exit -- #SUPER+ALT ESCAPE - Logout
#
# Wofi's pre-display-cmd looks for the '#' and prints everything after it
# in the wofi window. When we pipe that to `xargs hyprctl dispatch`, the
# Comment character ensures we ignore the description text and only executes
# the dispatcher + arg.
for keyconfig in "${KEYBINDS[@]}"; do
# Use pipe '|' to delimit results
IFS="|" read modmask key keycode description dispatcher arg < <(echo $(echo "$keyconfig" | jq -r '[.modmask, .key, .keycode, .description, .dispatcher, .arg] | join("|")'))
keys=($(decode_modmask $modmask) $key)
IFS=$OLD_IFS
# We can't use IFS here, as it only supports single characters
delimiter=" + "
# Join the array elements with the delimiter
combo=$(printf "%s$delimiter" "${keys[@]}")
# Remove the trailing delimiter
combo="${combo%$delimiter}"
printf "%s -- %s #%-30s → %s\n" "$dispatcher" "$arg" "$combo" "$description"
done | flock --nonblock /tmp/.wofi.lock -c "wofi --cache-file /dev/null --width 40% --height 70% -d -i -p 'Hyprland Keybindings' --style=\"$HOME/.local/share/omarchy/default/wofi/search.css\" -m --pre-display-cmd \"echo '%s' | cut -d'#' -f2 | tr -d '\n'\" | xargs hyprctl dispatch"

View File

@ -1,8 +0,0 @@
#!/bin/bash
set -e
makoctl mode -t do-not-disturb > /dev/null
makoctl mode | grep -q 'do-not-disturb' \
&& notify-send "Silenced notifications" \
|| notify-send "Enabled notifications"

View File

@ -1,8 +1,16 @@
# Deprecated bindings file. New installations include everything directly. # Deprecated bindings file. New installations include everything directly.
# Order matters for how they show up when you press SUPER + K to see the
# defined keybinds
source = ~/.local/share/omarchy/default/hypr/bindings/01-important.conf bind = SUPER, return, exec, $terminal
bind = SUPER, F, exec, $fileManager
bind = SUPER, B, exec, $browser
bind = SUPER, M, exec, $music
bind = SUPER, N, exec, $terminal -e nvim
bind = SUPER, T, exec, $terminal -e btop
bind = SUPER, D, exec, $terminal -e lazydocker
bind = SUPER, G, exec, $messenger
bind = SUPER, O, exec, obsidian -disable-gpu
bind = SUPER, slash, exec, $passwordManager
source = ~/.local/share/omarchy/default/hypr/bindings/media.conf source = ~/.local/share/omarchy/default/hypr/bindings/media.conf
source = ~/.local/share/omarchy/default/hypr/bindings/tiling.conf source = ~/.local/share/omarchy/default/hypr/bindings/tiling.conf
source = ~/.local/share/omarchy/default/hypr/bindings/utilities.conf source = ~/.local/share/omarchy/default/hypr/bindings/utilities.conf

View File

@ -1,14 +0,0 @@
# Launching
bindd = SUPER, space, Application Launcher, exec, pkill wofi || wofi --show drun --sort-order=alphabetical --style="$HOME/.local/share/omarchy/default/wofi/search.css"
bindd = SUPER, K, Show Keybindings, exec, ~/.local/share/omarchy/bin/omarchy-show-keybindings
bindd = SUPER, return, Launch a Terminal, exec, $terminal
bindd = SUPER, F, Launch a File Manager, exec, $fileManager
bindd = SUPER, B, Launch a Browser, exec, $browser
bindd = SUPER, M, Launch a Music Player, exec, $music
bindd = SUPER, N, Launch nvim, exec, $terminal -e nvim
bindd = SUPER, T, Launch btop, exec, $terminal -e btop
bindd = SUPER, D, Launch lazydocker, exec, $terminal -e lazydocker
bindd = SUPER, G, Launch a Messenger App, exec, $messenger
bindd = SUPER, O, Launch Obsidian, exec, obsidian -disable-gpu
bindd = SUPER, slash, Launch a Password Manager, exec, $passwordManager

View File

@ -1,13 +1,13 @@
# Laptop multimedia keys for volume, media control, and LCD brightness # Laptop multimedia keys for volume and LCD brightness
bindeld = ,XF86AudioRaiseVolume, Raise Volume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+ bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+
bindeld = ,XF86AudioLowerVolume, Lower Volume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
bindeld = ,XF86AudioMute, Mute Speakers, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bindeld = ,XF86AudioMicMute, Mute Mic, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
bindeld = ,XF86MonBrightnessUp, Raise Brightness, exec, brightnessctl -e4 -n2 set 5%+ bindel = ,XF86MonBrightnessUp, exec, brightnessctl -e4 -n2 set 5%+
bindeld = ,XF86MonBrightnessDown, Lower Brightness, exec, brightnessctl -e4 -n2 set 5%- bindel = ,XF86MonBrightnessDown, exec, brightnessctl -e4 -n2 set 5%-
# Requires playerctl # Requires playerctl
bindld = , XF86AudioNext, Next Track, exec, playerctl next bindl = , XF86AudioNext, exec, playerctl next
bindld = , XF86AudioPause, Pause Media, exec, playerctl play-pause bindl = , XF86AudioPause, exec, playerctl play-pause
bindld = , XF86AudioPlay, Pause Media, exec, playerctl play-pause bindl = , XF86AudioPlay, exec, playerctl play-pause
bindld = , XF86AudioPrev, Previous Track, exec, playerctl previous bindl = , XF86AudioPrev, exec, playerctl previous

View File

@ -1,58 +1,58 @@
# Close window # Close window
bindd = SUPER, W, Close Window, killactive, bind = SUPER, W, killactive,
# Control tiling # Control tiling
bindd = SUPER, J, Toggle Split, togglesplit, # dwindle bind = SUPER, J, togglesplit, # dwindle
bindd = SUPER, P, Toggle Pseudo, pseudo # dwindle bind = SUPER, P, pseudo, # dwindle
bindd = SUPER, V, Toggle Floating, togglefloating, bind = SUPER, V, togglefloating,
bindd = SUPER CTRL, F, Toggle Fullscreen, fullscreen
# Move focus with mainMod + arrow keys # Move focus with mainMod + arrow keys
bindd = SUPER, left, Move Focus Left, movefocus, l bind = SUPER, left, movefocus, l
bindd = SUPER, right, Move Focus Right, movefocus, r bind = SUPER, right, movefocus, r
bindd = SUPER, up, Move Focus Up, movefocus, u bind = SUPER, up, movefocus, u
bindd = SUPER, down, Move Focus Down, movefocus, d bind = SUPER, down, movefocus, d
# Switch workspaces with mainMod + [0-9] # Switch workspaces with mainMod + [0-9]
bindd = SUPER, code:10, Switch to workspace 1, workspace, 1 bind = SUPER, code:10, workspace, 1
bindd = SUPER, code:11, Switch to workspace 2, workspace, 2 bind = SUPER, code:11, workspace, 2
bindd = SUPER, code:12, Switch to workspace 3, workspace, 3 bind = SUPER, code:12, workspace, 3
bindd = SUPER, code:13, Switch to workspace 4, workspace, 4 bind = SUPER, code:13, workspace, 4
bindd = SUPER, code:14, Switch to workspace 5, workspace, 5 bind = SUPER, code:14, workspace, 5
bindd = SUPER, code:15, Switch to workspace 6, workspace, 6 bind = SUPER, code:15, workspace, 6
bindd = SUPER, code:16, Switch to workspace 7, workspace, 7 bind = SUPER, code:16, workspace, 7
bindd = SUPER, code:17, Switch to workspace 8, workspace, 8 bind = SUPER, code:17, workspace, 8
bindd = SUPER, code:18, Switch to workspace 9, workspace, 9 bind = SUPER, code:18, workspace, 9
bindd = SUPER, code:19, Switch to workspace 10, workspace, 10 bind = SUPER, code:19, workspace, 10
# Move active window to a workspace with mainMod + SHIFT + [0-9] # Move active window to a workspace with mainMod + SHIFT + [0-9]
bindd = SUPER SHIFT, code:10, Move Active Window to workspace 1, movetoworkspace, 1 bind = SUPER SHIFT, code:10, movetoworkspace, 1
bindd = SUPER SHIFT, code:11, Move Active Window to workspace 2, movetoworkspace, 2 bind = SUPER SHIFT, code:11, movetoworkspace, 2
bindd = SUPER SHIFT, code:12, Move Active Window to workspace 3, movetoworkspace, 3 bind = SUPER SHIFT, code:12, movetoworkspace, 3
bindd = SUPER SHIFT, code:13, Move Active Window to workspace 4, movetoworkspace, 4 bind = SUPER SHIFT, code:13, movetoworkspace, 4
bindd = SUPER SHIFT, code:14, Move Active Window to workspace 5, movetoworkspace, 5 bind = SUPER SHIFT, code:14, movetoworkspace, 5
bindd = SUPER SHIFT, code:15, Move Active Window to workspace 6, movetoworkspace, 6 bind = SUPER SHIFT, code:15, movetoworkspace, 6
bindd = SUPER SHIFT, code:16, Move Active Window to workspace 7, movetoworkspace, 7 bind = SUPER SHIFT, code:16, movetoworkspace, 7
bindd = SUPER SHIFT, code:17, Move Active Window to workspace 8, movetoworkspace, 8 bind = SUPER SHIFT, code:17, movetoworkspace, 8
bindd = SUPER SHIFT, code:18, Move Active Window to workspace 9, movetoworkspace, 9 bind = SUPER SHIFT, code:18, movetoworkspace, 9
bindd = SUPER SHIFT, code:19, Move Active Window to workspace 10, movetoworkspace, 10 bind = SUPER SHIFT, code:19, movetoworkspace, 10
# Swap active window with the one next to it with mainMod + SHIFT + arrow keys # Swap active window with the one next to it with mainMod + SHIFT + arrow keys
bindd = SUPER SHIFT, left, Swap Active Window with Left, swapwindow, l bind = SUPER SHIFT, left, swapwindow, l
bindd = SUPER SHIFT, right, Swap Active Window with Right, swapwindow, r bind = SUPER SHIFT, right, swapwindow, r
bindd = SUPER SHIFT, up, Swap Active Window with Up, swapwindow, u bind = SUPER SHIFT, up, swapwindow, u
bindd = SUPER SHIFT, down, Swap Active Window with Down, swapwindow, d bind = SUPER SHIFT, down, swapwindow, d
# Resize active window # Resize active window
bindd = SUPER, minus, Shrink Window Horizontally, resizeactive, -100 0 bind = SUPER, minus, resizeactive, -100 0
bindd = SUPER, equal, Grow Window Horizontally, resizeactive, 100 0 bind = SUPER, equal, resizeactive, 100 0
bindd = SUPER SHIFT, minus, Shrink Window Vertically, resizeactive, 0 -100 bind = SUPER SHIFT, minus, resizeactive, 0 -100
bindd = SUPER SHIFT, equal, Grow Window Vertically, resizeactive, 0 100 bind = SUPER SHIFT, equal, resizeactive, 0 100
# Scroll through existing workspaces with mainMod + scroll # Scroll through existing workspaces with mainMod + scroll
bindd = SUPER, mouse_down, Scroll Down though workspaces, workspace, e+1 bind = SUPER, mouse_down, workspace, e+1
bindd = SUPER, mouse_up, Scroll Up through workspaces, workspace, e-1 bind = SUPER, mouse_up, workspace, e-1
# Move/resize windows with mainMod + LMB/RMB and dragging # Move/resize windows with mainMod + LMB/RMB and dragging
bindmd = SUPER, mouse:272, Move Windows, movewindow bindm = SUPER, mouse:272, movewindow
bindmd = SUPER, mouse:273, Resize Windows, resizewindow bindm = SUPER, mouse:273, resizewindow

View File

@ -1,29 +1,32 @@
# Launching
bind = SUPER, space, exec, pkill wofi || wofi --show drun --sort-order=alphabetical --style="$HOME/.local/share/omarchy/default/wofi/search.css"
bind = SUPER, K, exec, ~/.local/share/omarchy/bin/omarchy-show-keybindings
# Aesthetics # Aesthetics
bindd = SUPER SHIFT, SPACE, Hide Waybar, exec, pkill -SIGUSR1 waybar bind = SUPER SHIFT, SPACE, exec, pkill -SIGUSR1 waybar
bindd = SUPER ALT, SPACE, Reload Waybar, exec, pkill -SIGUSR2 waybar bind = SUPER CTRL, SPACE, exec, ~/.local/share/omarchy/bin/swaybg-next
bindd = SUPER CTRL, SPACE, Next Wallpaper, exec, ~/.local/share/omarchy/bin/swaybg-next bind = SUPER SHIFT CTRL, SPACE, exec, ~/.local/share/omarchy/bin/omarchy-theme-next
bindd = SUPER SHIFT CTRL, SPACE, Next Theme, exec, ~/.local/share/omarchy/bin/omarchy-theme-next
# Notifications # Notifications
bindd = SUPER, comma, Dismiss Notification, exec, makoctl dismiss bind = SUPER, comma, exec, makoctl dismiss
bindd = SUPER SHIFT, comma, Dismiss All Notifications, exec, makoctl dismiss --all bind = SUPER SHIFT, comma, exec, makoctl dismiss --all
bindd = SUPER CTRL, comma, Toggle Do Not Disturb, exec, ~/.local/share/omarchy/bin/omarchy-toggle-dnd bind = SUPER CTRL, comma, exec, makoctl mode -t do-not-disturb && makoctl mode | grep -q 'do-not-disturb' && notify-send "Silenced notifications" || notify-send "Enabled notifications"
# Power menu controls lock, suspend, relaunch, restart, shutdown # Power menu controls lock, suspend, relaunch, restart, shutdown
bindd = SUPER, ESCAPE, Show Power Menu (Lock/Suspend/Relaunch/Restart/Shutdown), exec, ~/.local/share/omarchy/bin/omarchy-power-menu bind = SUPER, ESCAPE, exec, ~/.local/share/omarchy/bin/omarchy-power-menu
# Toggle idling # Toggle idling
bindd = SUPER CTRL, I, Toggle Idling, exec, ~/.local/share/omarchy/bin/omarchy-toggle-idle bind = SUPER CTRL, I, exec, ~/.local/share/omarchy/bin/omarchy-toggle-idle
# Control Apple Display brightness # Control Apple Display brightness
bindd = CTRL, F1, Dim Apple Screen Brightness, exec, ~/.local/share/omarchy/bin/apple-display-brightness -5000 bind = CTRL, F1, exec, ~/.local/share/omarchy/bin/apple-display-brightness -5000
bindd = CTRL, F2, Raise Apple Screen Brightness, exec, ~/.local/share/omarchy/bin/apple-display-brightness +5000 bind = CTRL, F2, exec, ~/.local/share/omarchy/bin/apple-display-brightness +5000
bindd = SHIFT CTRL, F2, Set Apple Screen Brightness to Max, exec, ~/.local/share/omarchy/bin/apple-display-brightness +60000 bind = SHIFT CTRL, F2, exec, ~/.local/share/omarchy/bin/apple-display-brightness +60000
# Screenshots # Screenshots
bindd = , PRINT, Screenshot a Region, exec, hyprshot -m region bind = , PRINT, exec, hyprshot -m region
bindd = SHIFT, PRINT, Screenshot a Window, exec, hyprshot -m window bind = SHIFT, PRINT, exec, hyprshot -m window
bindd = CTRL, PRINT, Screenshot Desktop, exec, hyprshot -m output bind = CTRL, PRINT, exec, hyprshot -m output
# Color picker # Color picker
bindd = SUPER, PRINT, Pick a Color, exec, hyprpicker -a bind = SUPER, PRINT, exec, hyprpicker -a

View File

@ -3,5 +3,4 @@ yay -S --noconfirm --needed \
imagemagick \ imagemagick \
mariadb-libs postgresql-libs \ mariadb-libs postgresql-libs \
github-cli \ github-cli \
lazygit lazydocker-bin \ lazygit lazydocker-bin
jq