diff --git a/bin/omarchy-menu-keybindings b/bin/omarchy-menu-keybindings index 622bcff..a851871 100755 --- a/bin/omarchy-menu-keybindings +++ b/bin/omarchy-menu-keybindings @@ -3,34 +3,47 @@ # A script to display Hyprland keybindings defined in your configuration # using walker for an interactive search menu. -USER_HYPRLAND_CONF="$HOME/.config/hypr/hyprland.conf" -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/media.conf" +# Fetch dynamic keybindings from Hyprland +# +# Also do some pre-processing: +# - Remove standard Omarchy bin path prefix +# - Remove uwsm prefix +# - Map numeric modifier key mask to a textual rendition +# - Output comma-separated values that the parser can understand +dynamic_bindings() { + hyprctl -j binds | \ + jq -r '.[] | {modmask, key, keycode, description, dispatcher, arg} | "\(.modmask),\(.key)@\(.keycode),\(.description),\(.dispatcher),\(.arg)"' | \ + sed -r \ + -e 's/null//' \ + -e 's,~/.local/share/omarchy/bin/,,' \ + -e 's,uwsm app -- ,,' \ + -e 's/@0//' \ + -e 's/,@/,code:/' \ + -e 's/^0,/,/' \ + -e 's/^1,/SHIFT,/' \ + -e 's/^4,/CTRL,/' \ + -e 's/^5,/SHIFT CTRL,/' \ + -e 's/^8,/ALT,/' \ + -e 's/^9,/SHIFT ALT,/' \ + -e 's/^12,/CTRL ALT,/' \ + -e 's/^13,/SHIFT CTRL ALT,/' \ + -e 's/^64,/SUPER,/' \ + -e 's/^65,/SUPER SHIFT,/' \ + -e 's/^68,/SUPER CTRL,/' \ + -e 's/^69,/SUPER SHIFT CTRL,/' \ + -e 's/^72,/SUPER ALT,/' +} -# Process the configuration file to extract and format keybindings -# 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 | +# Parse and format keybindings +# +# `awk` does the heavy lifting: +# - Set the field separator to a comma ','. +# - Joins the key combination (e.g., "SUPER + Q"). +# - Joins the command that the key executes. +# - Prints everything in a nicely aligned format. +parse_bindings() { 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; @@ -38,27 +51,36 @@ grep -h '^[[:space:]]*bind' $USER_HYPRLAND_CONF $OMARCHY_BINDINGS_CONF | 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 ? "," : ""); - } + # Use description, if set + action = $3; - # Clean up trailing commas, remove leading "exec, ", and trim - sub(/,$/, "", action); - gsub(/(^|,)[[:space:]]*exec[[:space:]]*,?/, "", action); - gsub(/^[ \t]+|[ \t]+$/, "", action); - gsub(/[ \t]+/, " ", key_combo); # Collapse multiple spaces to one + if (action == "") { + # Reconstruct the command from the remaining fields + for (i = 4; i <= NF; i++) { + action = action $i (i < NF ? "," : ""); + } + + # Clean up trailing commas, remove leading "exec, ", and trim + sub(/,$/, "", action); + gsub(/(^|,)[[:space:]]*exec[[:space:]]*,?/, "", action); + gsub(/^[ \t]+|[ \t]+$/, "", action); + gsub(/[ \t]+/, " ", key_combo); # Collapse multiple spaces to one - if (action != "") { # Escape XML entities gsub(/&/, "\\&", action); gsub(//, "\\>", action); gsub(/"/, "\\"", action); gsub(/'"'"'/, "\\'", action); - + } + + if (action != "") { printf "%-35s → %s\n", key_combo, action; } -}' | +}' +} + +dynamic_bindings | \ + sort -u | \ + parse_bindings | \ walker --dmenu --theme keybindings -p 'Keybindings' diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf index 4bd9e14..4363f61 100644 --- a/config/hypr/hyprland.conf +++ b/config/hypr/hyprland.conf @@ -23,26 +23,26 @@ $terminal = uwsm app -- alacritty $browser = uwsm app -- chromium --new-window --ozone-platform=wayland $webapp = $browser --app -bind = SUPER, return, exec, $terminal -bind = SUPER, F, exec, uwsm app -- nautilus --new-window -bind = SUPER, B, exec, $browser -bind = SUPER, M, exec, uwsm app -- spotify -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, uwsm app -- signal-desktop -bind = SUPER, O, exec, uwsm app -- obsidian -disable-gpu -bind = SUPER, slash, exec, uwsm app -- 1password +bindd = SUPER, return, Terminal, exec, $terminal +bindd = SUPER, F, File manager, exec, uwsm app -- nautilus --new-window +bindd = SUPER, B, Web browser, exec, $browser +bindd = SUPER, M, Music player, exec, uwsm app -- spotify +bindd = SUPER, N, Neovim, exec, $terminal -e nvim +bindd = SUPER, T, Top, exec, $terminal -e btop +bindd = SUPER, D, Lazy Docker, exec, $terminal -e lazydocker +bindd = SUPER, G, Signal messaging, exec, uwsm app -- signal-desktop +bindd = SUPER, O, Obsidian, exec, uwsm app -- obsidian -disable-gpu +bindd = SUPER, slash, Password manager, exec, uwsm app -- 1password -bind = SUPER, A, exec, $webapp="https://chatgpt.com" -bind = SUPER SHIFT, A, exec, $webapp="https://grok.com" -bind = SUPER, C, exec, $webapp="https://app.hey.com/calendar/weeks/" -bind = SUPER, E, exec, $webapp="https://app.hey.com" -bind = SUPER, Y, exec, $webapp="https://youtube.com/" -bind = SUPER SHIFT, G, exec, $webapp="https://web.whatsapp.com/" -bind = SUPER ALT, G, exec, $webapp="https://messages.google.com/web/conversations" -bind = SUPER, X, exec, $webapp="https://x.com/" -bind = SUPER SHIFT, X, exec, $webapp="https://x.com/compose/post" +bindd = SUPER, A, ChatGPT, exec, $webapp="https://chatgpt.com" +bindd = SUPER SHIFT, A, Grok, exec, $webapp="https://grok.com" +bindd = SUPER, C, Hey calendar, exec, $webapp="https://app.hey.com/calendar/weeks/" +bindd = SUPER, E, Hey email, exec, $webapp="https://app.hey.com" +bindd = SUPER, Y, YouTube, exec, $webapp="https://youtube.com/" +bindd = SUPER SHIFT, G, WhatsApp, exec, $webapp="https://web.whatsapp.com/" +bindd = SUPER ALT, G, Google Messaging, exec, $webapp="https://messages.google.com/web/conversations" +bindd = SUPER, X, X/Twitter, exec, $webapp="https://x.com/" +bindd = SUPER SHIFT, X,X/Twitter compose, exec, $webapp="https://x.com/compose/post" # Extra autostart processes # exec-once = uwsm app -- my-service diff --git a/default/hypr/bindings.conf b/default/hypr/bindings.conf index 15bfb20..0f8e77e 100644 --- a/default/hypr/bindings.conf +++ b/default/hypr/bindings.conf @@ -1,15 +1,15 @@ # Deprecated bindings file. New installations include everything directly. -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 +bindd = SUPER, return, Terminal, exec, $terminal +bindd = SUPER, F, File manager, exec, $fileManager +bindd = SUPER, B, Web browser, exec, $browser +bindd = SUPER, M, Music player, exec, $music +bindd = SUPER, N, Neovim, exec, $terminal -e nvim +bindd = SUPER, T, Top, exec, $terminal -e btop +bindd = SUPER, D, Lazy Docker, exec, $terminal -e lazydocker +bindd = SUPER, G, Messenger, exec, $messenger +bindd = SUPER, O, Obsidian, exec, obsidian -disable-gpu +bindd = SUPER, slash, Pasword manager, exec, $passwordManager source = ~/.local/share/omarchy/default/hypr/bindings/media.conf source = ~/.local/share/omarchy/default/hypr/bindings/tiling.conf diff --git a/default/hypr/bindings/media.conf b/default/hypr/bindings/media.conf index eb86284..cb2c1f8 100644 --- a/default/hypr/bindings/media.conf +++ b/default/hypr/bindings/media.conf @@ -2,15 +2,15 @@ $osdclient = swayosd-client --monitor "$(hyprctl monitors -j | jq -r '.[] | select(.focused == true).name')" # Laptop multimedia keys for volume and LCD brightness (with OSD) -bindel = ,XF86AudioRaiseVolume, exec, $osdclient --output-volume raise -bindel = ,XF86AudioLowerVolume, exec, $osdclient --output-volume lower -bindel = ,XF86AudioMute, exec, $osdclient --output-volume mute-toggle -bindel = ,XF86AudioMicMute, exec, $osdclient --input-volume mute-toggle -bindel = ,XF86MonBrightnessUp, exec, $osdclient --brightness raise -bindel = ,XF86MonBrightnessDown, exec, $osdclient --brightness lower +bindeld = ,XF86AudioRaiseVolume, Volume up, exec, $osdclient --output-volume raise +bindeld = ,XF86AudioLowerVolume, Volume down, exec, $osdclient --output-volume lower +bindeld = ,XF86AudioMute, Mute, exec, $osdclient --output-volume mute-toggle +bindeld = ,XF86AudioMicMute, Mute microphone, exec, $osdclient --input-volume mute-toggle +bindeld = ,XF86MonBrightnessUp, Brightness up, exec, $osdclient --brightness raise +bindeld = ,XF86MonBrightnessDown, Brightness down, exec, $osdclient --brightness lower # Requires playerctl -bindl = , XF86AudioNext, exec, $osdclient --playerctl next -bindl = , XF86AudioPause, exec, $osdclient --playerctl play-pause -bindl = , XF86AudioPlay, exec, $osdclient --playerctl play-pause -bindl = , XF86AudioPrev, exec, $osdclient --playerctl previous +bindld = , XF86AudioNext, Next track, exec, $osdclient --playerctl next +bindld = , XF86AudioPause, Pause, exec, $osdclient --playerctl play-pause +bindld = , XF86AudioPlay, Play, exec, $osdclient --playerctl play-pause +bindld = , XF86AudioPrev, Previous track, exec, $osdclient --playerctl previous diff --git a/default/hypr/bindings/tiling.conf b/default/hypr/bindings/tiling.conf index 2fb1e90..167b3e2 100644 --- a/default/hypr/bindings/tiling.conf +++ b/default/hypr/bindings/tiling.conf @@ -1,41 +1,41 @@ # Close window -bind = SUPER, W, killactive, +bindd = SUPER, W, Close active window, killactive, # Control tiling -bind = SUPER, J, togglesplit, # dwindle +bindd = SUPER, J, Toggle split, togglesplit, # dwindle bind = SUPER, P, pseudo, # dwindle -bind = SUPER, V, togglefloating, -bind = SHIFT, F11, fullscreen, 0 +bindd = SUPER, V, Toggle floating, togglefloating, +bindd = SHIFT, F11, Full screen, fullscreen, 0 # Move focus with mainMod + arrow keys -bind = SUPER, left, movefocus, l -bind = SUPER, right, movefocus, r -bind = SUPER, up, movefocus, u -bind = SUPER, down, movefocus, d +bindd = SUPER, left, Move focus left, movefocus, l +bindd = SUPER, right, Move focus right, movefocus, r +bindd = SUPER, up, Move focus up, movefocus, u +bindd = SUPER, down, Move focus down, movefocus, d # Switch workspaces with mainMod + [0-9] -bind = SUPER, code:10, workspace, 1 -bind = SUPER, code:11, workspace, 2 -bind = SUPER, code:12, workspace, 3 -bind = SUPER, code:13, workspace, 4 -bind = SUPER, code:14, workspace, 5 -bind = SUPER, code:15, workspace, 6 -bind = SUPER, code:16, workspace, 7 -bind = SUPER, code:17, workspace, 8 -bind = SUPER, code:18, workspace, 9 -bind = SUPER, code:19, workspace, 10 +bindd = SUPER, code:10, Switch to workspace 1, workspace, 1 +bindd = SUPER, code:11, Switch to workspace 2, workspace, 2 +bindd = SUPER, code:12, Switch to workspace 3, workspace, 3 +bindd = SUPER, code:13, Switch to workspace 4, workspace, 4 +bindd = SUPER, code:14, Switch to workspace 5, workspace, 5 +bindd = SUPER, code:15, Switch to workspace 6, workspace, 6 +bindd = SUPER, code:16, Switch to workspace 7, workspace, 7 +bindd = SUPER, code:17, Switch to workspace 8, workspace, 8 +bindd = SUPER, code:18, Switch to workspace 9, workspace, 9 +bindd = SUPER, code:19, Switch to workspace 10, workspace, 10 # Move active window to a workspace with mainMod + SHIFT + [0-9] -bind = SUPER SHIFT, code:10, movetoworkspace, 1 -bind = SUPER SHIFT, code:11, movetoworkspace, 2 -bind = SUPER SHIFT, code:12, movetoworkspace, 3 -bind = SUPER SHIFT, code:13, movetoworkspace, 4 -bind = SUPER SHIFT, code:14, movetoworkspace, 5 -bind = SUPER SHIFT, code:15, movetoworkspace, 6 -bind = SUPER SHIFT, code:16, movetoworkspace, 7 -bind = SUPER SHIFT, code:17, movetoworkspace, 8 -bind = SUPER SHIFT, code:18, movetoworkspace, 9 -bind = SUPER SHIFT, code:19, movetoworkspace, 10 +bindd = SUPER SHIFT, code:10, Move window to workspace 1, movetoworkspace, 1 +bindd = SUPER SHIFT, code:11, Move window to workspace 1, movetoworkspace, 2 +bindd = SUPER SHIFT, code:12, Move window to workspace 1, movetoworkspace, 3 +bindd = SUPER SHIFT, code:13, Move window to workspace 1, movetoworkspace, 4 +bindd = SUPER SHIFT, code:14, Move window to workspace 1, movetoworkspace, 5 +bindd = SUPER SHIFT, code:15, Move window to workspace 1, movetoworkspace, 6 +bindd = SUPER SHIFT, code:16, Move window to workspace 1, movetoworkspace, 7 +bindd = SUPER SHIFT, code:17, Move window to workspace 1, movetoworkspace, 8 +bindd = SUPER SHIFT, code:18, Move window to workspace 1, movetoworkspace, 9 +bindd = SUPER SHIFT, code:19, Move window to workspace 1, movetoworkspace, 10 # Swap active window with the one next to it with mainMod + SHIFT + arrow keys bind = SUPER SHIFT, left, swapwindow, l @@ -58,6 +58,5 @@ bind = SUPER, mouse_down, workspace, e+1 bind = SUPER, mouse_up, workspace, e-1 # Move/resize windows with mainMod + LMB/RMB and dragging -bindm = SUPER, mouse:272, movewindow -bindm = SUPER, mouse:273, resizewindow - +bindmd = SUPER, mouse:272, Move window, movewindow +bindmd = SUPER, mouse:273, Resize window, resizewindow diff --git a/default/hypr/bindings/utilities.conf b/default/hypr/bindings/utilities.conf index 073f2b3..6686670 100644 --- a/default/hypr/bindings/utilities.conf +++ b/default/hypr/bindings/utilities.conf @@ -1,6 +1,6 @@ # Launching bind = SUPER, space, exec, walker -bind = SUPER, K, exec, ~/.local/share/omarchy/bin/omarchy-menu-keybindings +bindd = SUPER, K, Show key bindings, exec, ~/.local/share/omarchy/bin/omarchy-menu-keybindings # Aesthetics bind = SUPER SHIFT, SPACE, exec, pkill -SIGUSR1 waybar @@ -13,7 +13,7 @@ bind = SUPER SHIFT, comma, exec, makoctl dismiss --all 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 -bind = SUPER, ESCAPE, exec, ~/.local/share/omarchy/bin/omarchy-menu-power +bindd = SUPER, ESCAPE, Power menu, exec, ~/.local/share/omarchy/bin/omarchy-menu-power # Toggle idling bind = SUPER CTRL, I, exec, ~/.local/share/omarchy/bin/omarchy-toggle-idle @@ -22,21 +22,21 @@ bind = SUPER CTRL, I, exec, ~/.local/share/omarchy/bin/omarchy-toggle-idle bind = SUPER CTRL, N, exec, ~/.local/share/omarchy/bin/omarchy-toggle-nightlight # Control Apple Display brightness -bind = CTRL, F1, exec, ~/.local/share/omarchy/bin/omarchy-cmd-apple-display-brightness -5000 -bind = CTRL, F2, exec, ~/.local/share/omarchy/bin/omarchy-cmd-apple-display-brightness +5000 -bind = SHIFT CTRL, F2, exec, ~/.local/share/omarchy/bin/omarchy-cmd-apple-display-brightness +60000 +bindd = CTRL, F1, Apple Display brightness down, exec, ~/.local/share/omarchy/bin/omarchy-cmd-apple-display-brightness -5000 +bindd = CTRL, F2, Apple Display brightness up, exec, ~/.local/share/omarchy/bin/omarchy-cmd-apple-display-brightness +5000 +bindd = SHIFT CTRL, F2, Apple Display full brightness, exec, ~/.local/share/omarchy/bin/omarchy-cmd-apple-display-brightness +60000 # Screenshots -bind = , PRINT, exec, ~/.local/share/omarchy/bin/omarchy-cmd-screenshot -bind = SHIFT, PRINT, exec, ~/.local/share/omarchy/bin/omarchy-cmd-screenshot window -bind = CTRL, PRINT, exec, ~/.local/share/omarchy/bin/omarchy-cmd-screenshot output +bindd = , PRINT, Take screenshot, exec, ~/.local/share/omarchy/bin/omarchy-cmd-screenshot +bindd = SHIFT, PRINT, Take screenshot of window, exec, ~/.local/share/omarchy/bin/omarchy-cmd-screenshot window +bindd = CTRL, PRINT, Take screenshot of display, exec, ~/.local/share/omarchy/bin/omarchy-cmd-screenshot output -# Screenshots -bind = ALT, PRINT, exec, ~/.local/share/omarchy/bin/omarchy-cmd-screenrecord -bind = CTRL ALT, PRINT, exec, ~/.local/share/omarchy/bin/omarchy-cmd-screenrecord output +# Screen recordings +bindd = ALT, PRINT, Screen recording, exec, ~/.local/share/omarchy/bin/omarchy-cmd-screenrecord +bindd = CTRL ALT, PRINT, Screen recording of display, exec, ~/.local/share/omarchy/bin/omarchy-cmd-screenrecord output # Screensaver -bind = SUPER ALT, SPACE, exec, ~/.local/share/omarchy/bin/omarchy-launch-screensaver +bindd = SUPER ALT, SPACE, Screensaver, exec, ~/.local/share/omarchy/bin/omarchy-launch-screensaver # Color picker -bind = SUPER, PRINT, exec, hyprpicker -a +bindd = SUPER, PRINT, Color picker, exec, hyprpicker -a