mirror of
https://github.com/LukeHagar/omarchy.git
synced 2025-12-06 04:20:23 +00:00
Made keybindings menu a little more human readable (#1824)
Co-authored-by: Lucas Goossen <lucas.goossen@hey.com>
This commit is contained in:
@@ -11,30 +11,44 @@
|
|||||||
# - Map numeric modifier key mask to a textual rendition
|
# - Map numeric modifier key mask to a textual rendition
|
||||||
# - Output comma-separated values that the parser can understand
|
# - Output comma-separated values that the parser can understand
|
||||||
dynamic_bindings() {
|
dynamic_bindings() {
|
||||||
hyprctl -j binds | \
|
hyprctl -j binds |
|
||||||
jq -r '.[] | {modmask, key, keycode, description, dispatcher, arg} | "\(.modmask),\(.key)@\(.keycode),\(.description),\(.dispatcher),\(.arg)"' | \
|
jq -r '.[] | {modmask, key, keycode, description, dispatcher, arg} | "\(.modmask),\(.key)@\(.keycode),\(.description),\(.dispatcher),\(.arg)"' |
|
||||||
sed -r \
|
sed -r \
|
||||||
-e 's/null//' \
|
-e 's/null//' \
|
||||||
-e 's,~/.local/share/omarchy/bin/,,' \
|
-e 's,~/.local/share/omarchy/bin/,,' \
|
||||||
-e 's,uwsm app -- ,,' \
|
-e 's,uwsm app -- ,,' \
|
||||||
-e 's/@0//' \
|
-e 's/@0//' \
|
||||||
-e 's/,@/,code:/' \
|
-e 's/,@/,code:/' \
|
||||||
-e 's/^0,/,/' \
|
-e 's/,code:10,/,1,/' \
|
||||||
-e 's/^1,/SHIFT,/' \
|
-e 's/,code:11,/,2,/' \
|
||||||
-e 's/^4,/CTRL,/' \
|
-e 's/,code:12,/,3,/' \
|
||||||
-e 's/^5,/SHIFT CTRL,/' \
|
-e 's/,code:13,/,4,/' \
|
||||||
-e 's/^8,/ALT,/' \
|
-e 's/,code:14,/,5,/' \
|
||||||
-e 's/^9,/SHIFT ALT,/' \
|
-e 's/,code:15,/,6,/' \
|
||||||
-e 's/^12,/CTRL ALT,/' \
|
-e 's/,code:16,/,7,/' \
|
||||||
-e 's/^13,/SHIFT CTRL ALT,/' \
|
-e 's/,code:17,/,8,/' \
|
||||||
-e 's/^64,/SUPER,/' \
|
-e 's/,code:18,/,9,/' \
|
||||||
-e 's/^65,/SUPER SHIFT,/' \
|
-e 's/,code:19,/,0,/' \
|
||||||
-e 's/^68,/SUPER CTRL,/' \
|
-e 's/,code:20,/,-,/' \
|
||||||
-e 's/^69,/SUPER SHIFT CTRL,/' \
|
-e 's/,code:21,/,=,/' \
|
||||||
-e 's/^72,/SUPER ALT,/' \
|
-e 's/^0,/,/' \
|
||||||
-e 's/^73,/SUPER SHIFT ALT,/' \
|
-e 's/,mouse:272,/,MOUSE LEFT,/' \
|
||||||
-e 's/^76,/SUPER CTRL ALT,/' \
|
-e 's/,mouse:273,/,MOUSE RIGHT,/' \
|
||||||
-e 's/^77,/SUPER SHIFT CTRL ALT,/'
|
-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,/' \
|
||||||
|
-e 's/^73,/SUPER SHIFT ALT,/' \
|
||||||
|
-e 's/^76,/SUPER CTRL ALT,/' \
|
||||||
|
-e 's/^77,/SUPER SHIFT CTRL ALT,/'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Parse and format keybindings
|
# Parse and format keybindings
|
||||||
@@ -46,7 +60,7 @@ dynamic_bindings() {
|
|||||||
# - Prints everything in a nicely aligned format.
|
# - Prints everything in a nicely aligned format.
|
||||||
parse_bindings() {
|
parse_bindings() {
|
||||||
awk -F, '
|
awk -F, '
|
||||||
{
|
{
|
||||||
# Combine the modifier and key (first two fields)
|
# Combine the modifier and key (first two fields)
|
||||||
key_combo = $1 " + " $2;
|
key_combo = $1 " + " $2;
|
||||||
|
|
||||||
@@ -58,36 +72,35 @@ parse_bindings() {
|
|||||||
action = $3;
|
action = $3;
|
||||||
|
|
||||||
if (action == "") {
|
if (action == "") {
|
||||||
# Reconstruct the command from the remaining fields
|
# Reconstruct the command from the remaining fields
|
||||||
for (i = 4; i <= NF; i++) {
|
for (i = 4; i <= NF; i++) {
|
||||||
action = action $i (i < NF ? "," : "");
|
action = action $i (i < NF ? "," : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
# Clean up trailing commas, remove leading "exec, ", and trim
|
# Clean up trailing commas, remove leading "exec, ", and trim
|
||||||
sub(/,$/, "", action);
|
sub(/,$/, "", action);
|
||||||
gsub(/(^|,)[[:space:]]*exec[[:space:]]*,?/, "", action);
|
gsub(/(^|,)[[:space:]]*exec[[:space:]]*,?/, "", action);
|
||||||
gsub(/^[ \t]+|[ \t]+$/, "", action);
|
gsub(/^[ \t]+|[ \t]+$/, "", action);
|
||||||
gsub(/[ \t]+/, " ", key_combo); # Collapse multiple spaces to one
|
gsub(/[ \t]+/, " ", key_combo); # Collapse multiple spaces to one
|
||||||
|
|
||||||
# Escape XML entities
|
# Escape XML entities
|
||||||
gsub(/&/, "\\&", action);
|
gsub(/&/, "\\&", action);
|
||||||
gsub(/</, "\\<", action);
|
gsub(/</, "\\<", action);
|
||||||
gsub(/>/, "\\>", action);
|
gsub(/>/, "\\>", action);
|
||||||
gsub(/"/, "\\"", action);
|
gsub(/"/, "\\"", action);
|
||||||
gsub(/'"'"'/, "\\'", action);
|
gsub(/'"'"'/, "\\'", action);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action != "") {
|
if (action != "") {
|
||||||
printf "%-35s → %s\n", key_combo, action;
|
printf "%-35s → %s\n", key_combo, action;
|
||||||
}
|
}
|
||||||
}'
|
}'
|
||||||
}
|
}
|
||||||
|
|
||||||
monitor_height=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .height')
|
monitor_height=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .height')
|
||||||
menu_height=$((monitor_height * 40 / 100))
|
menu_height=$((monitor_height * 40 / 100))
|
||||||
|
|
||||||
dynamic_bindings | \
|
dynamic_bindings |
|
||||||
sort -u | \
|
sort -u |
|
||||||
parse_bindings | \
|
parse_bindings |
|
||||||
walker --dmenu --theme keybindings -p 'Keybindings' -w 800 -h "$menu_height"
|
walker --dmenu --theme keybindings -p 'Keybindings' -w 800 -h "$menu_height"
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
$terminal = uwsm app -- $TERMINAL
|
$terminal = uwsm app -- $TERMINAL
|
||||||
$browser = omarchy-launch-browser
|
$browser = omarchy-launch-browser
|
||||||
|
|
||||||
bindd = SUPER, return, Terminal, exec, $terminal --working-directory="$(omarchy-cmd-terminal-cwd)"
|
bindd = SUPER, RETURN, Terminal, exec, $terminal --working-directory="$(omarchy-cmd-terminal-cwd)"
|
||||||
bindd = SUPER, F, File manager, exec, uwsm app -- nautilus --new-window
|
bindd = SUPER, F, File manager, exec, uwsm app -- nautilus --new-window
|
||||||
bindd = SUPER, B, Browser, exec, $browser
|
bindd = SUPER, B, Browser, exec, $browser
|
||||||
bindd = SUPER SHIFT, B, Browser (private), exec, $browser --private
|
bindd = SUPER SHIFT, B, Browser (private), exec, $browser --private
|
||||||
@@ -12,7 +12,7 @@ bindd = SUPER, T, Activity, exec, $terminal -e btop
|
|||||||
bindd = SUPER, D, Docker, exec, $terminal -e lazydocker
|
bindd = SUPER, D, Docker, exec, $terminal -e lazydocker
|
||||||
bindd = SUPER, G, Signal, exec, omarchy-launch-or-focus signal "uwsm app -- signal-desktop"
|
bindd = SUPER, G, Signal, exec, omarchy-launch-or-focus signal "uwsm app -- signal-desktop"
|
||||||
bindd = SUPER, O, Obsidian, exec, omarchy-launch-or-focus obsidian "uwsm app -- obsidian -disable-gpu --enable-wayland-ime"
|
bindd = SUPER, O, Obsidian, exec, omarchy-launch-or-focus obsidian "uwsm app -- obsidian -disable-gpu --enable-wayland-ime"
|
||||||
bindd = SUPER, slash, Passwords, exec, uwsm app -- 1password
|
bindd = SUPER, SLASH, Passwords, exec, uwsm app -- 1password
|
||||||
|
|
||||||
# If your web app url contains #, type it as ## to prevent hyperland treat it as comments
|
# If your web app url contains #, type it as ## to prevent hyperland treat it as comments
|
||||||
bindd = SUPER, A, ChatGPT, exec, omarchy-launch-webapp "https://chatgpt.com"
|
bindd = SUPER, A, ChatGPT, exec, omarchy-launch-webapp "https://chatgpt.com"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Deprecated bindings file. New installations include everything directly.
|
# Deprecated bindings file. New installations include everything directly.
|
||||||
|
|
||||||
bindd = SUPER, return, Terminal, exec, $terminal
|
bindd = SUPER, RETURN, Terminal, exec, $terminal
|
||||||
bindd = SUPER, F, File manager, exec, $fileManager
|
bindd = SUPER, F, File manager, exec, $fileManager
|
||||||
bindd = SUPER, B, Web browser, exec, $browser
|
bindd = SUPER, B, Web browser, exec, $browser
|
||||||
bindd = SUPER, M, Music player, exec, $music
|
bindd = SUPER, M, Music player, exec, $music
|
||||||
@@ -9,7 +9,7 @@ bindd = SUPER, T, Top, exec, $terminal -e btop
|
|||||||
bindd = SUPER, D, Lazy Docker, exec, $terminal -e lazydocker
|
bindd = SUPER, D, Lazy Docker, exec, $terminal -e lazydocker
|
||||||
bindd = SUPER, G, Messenger, exec, $messenger
|
bindd = SUPER, G, Messenger, exec, $messenger
|
||||||
bindd = SUPER, O, Obsidian, exec, obsidian -disable-gpu
|
bindd = SUPER, O, Obsidian, exec, obsidian -disable-gpu
|
||||||
bindd = SUPER, slash, Password manager, exec, $passwordManager
|
bindd = SUPER, SLASH, Password manager, 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
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ bindd = SHIFT, F11, Force full screen, fullscreen, 0
|
|||||||
bindd = ALT, F11, Full width, fullscreen, 1
|
bindd = ALT, F11, Full width, fullscreen, 1
|
||||||
|
|
||||||
# Move focus with SUPER + arrow keys
|
# Move focus with SUPER + arrow keys
|
||||||
bindd = SUPER, left, Move focus left, movefocus, l
|
bindd = SUPER, LEFT, Move focus left, movefocus, l
|
||||||
bindd = SUPER, right, Move focus right, movefocus, r
|
bindd = SUPER, RIGHT, Move focus right, movefocus, r
|
||||||
bindd = SUPER, up, Move focus up, movefocus, u
|
bindd = SUPER, UP, Move focus up, movefocus, u
|
||||||
bindd = SUPER, down, Move focus down, movefocus, d
|
bindd = SUPER, DOWN, Move focus down, movefocus, d
|
||||||
|
|
||||||
# Switch workspaces with SUPER + [0-9]
|
# Switch workspaces with SUPER + [0-9]
|
||||||
bindd = SUPER, code:10, Switch to workspace 1, workspace, 1
|
bindd = SUPER, code:10, Switch to workspace 1, workspace, 1
|
||||||
@@ -39,22 +39,22 @@ bindd = SUPER SHIFT, code:17, Move window to workspace 8, movetoworkspace, 8
|
|||||||
bindd = SUPER SHIFT, code:18, Move window to workspace 9, movetoworkspace, 9
|
bindd = SUPER SHIFT, code:18, Move window to workspace 9, movetoworkspace, 9
|
||||||
bindd = SUPER SHIFT, code:19, Move window to workspace 10, movetoworkspace, 10
|
bindd = SUPER SHIFT, code:19, Move window to workspace 10, movetoworkspace, 10
|
||||||
|
|
||||||
# Tab between workspaces
|
# TAB between workspaces
|
||||||
bindd = SUPER, TAB, Next workspace, workspace, e+1
|
bindd = SUPER, TAB, Next workspace, workspace, e+1
|
||||||
bindd = SUPER SHIFT, TAB, Previous workspace, workspace, e-1
|
bindd = SUPER SHIFT, TAB, Previous workspace, workspace, e-1
|
||||||
bindd = SUPER CTRL, TAB, Former workspace, workspace, previous
|
bindd = SUPER CTRL, TAB, Former workspace, workspace, previous
|
||||||
|
|
||||||
# Swap active window with the one next to it with SUPER + SHIFT + arrow keys
|
# Swap active window with the one next to it with SUPER + SHIFT + arrow keys
|
||||||
bindd = SUPER SHIFT, left, Swap window to the left, swapwindow, l
|
bindd = SUPER SHIFT, LEFT, Swap window to the left, swapwindow, l
|
||||||
bindd = SUPER SHIFT, right, Swap window to the right, swapwindow, r
|
bindd = SUPER SHIFT, RIGHT, Swap window to the right, swapwindow, r
|
||||||
bindd = SUPER SHIFT, up, Swap window up, swapwindow, u
|
bindd = SUPER SHIFT, UP, Swap window up, swapwindow, u
|
||||||
bindd = SUPER SHIFT, down, Swap window down, swapwindow, d
|
bindd = SUPER SHIFT, DOWN, Swap window down, swapwindow, d
|
||||||
|
|
||||||
# Cycle through applications on active workspace
|
# Cycle through applications on active workspace
|
||||||
bindd = ALT, Tab, Cycle to next window, cyclenext
|
bindd = ALT, TAB, Cycle to next window, cyclenext
|
||||||
bindd = ALT SHIFT, Tab, Cycle to prev window, cyclenext, prev
|
bindd = ALT SHIFT, TAB, Cycle to prev window, cyclenext, prev
|
||||||
bindd = ALT, Tab, Reveal active window on top, bringactivetotop
|
bindd = ALT, TAB, Reveal active window on top, bringactivetotop
|
||||||
bindd = ALT SHIFT, Tab, Reveal active window on top, bringactivetotop
|
bindd = ALT SHIFT, TAB, Reveal active window on top, bringactivetotop
|
||||||
|
|
||||||
# Resize active window
|
# Resize active window
|
||||||
bindd = SUPER, code:20, Expand window left, resizeactive, -100 0 # - key
|
bindd = SUPER, code:20, Expand window left, resizeactive, -100 0 # - key
|
||||||
@@ -63,8 +63,8 @@ bindd = SUPER SHIFT, code:20, Shrink window up, resizeactive, 0 -100
|
|||||||
bindd = SUPER SHIFT, code:21, Expand window down, resizeactive, 0 100
|
bindd = SUPER SHIFT, code:21, Expand window down, resizeactive, 0 100
|
||||||
|
|
||||||
# Scroll through existing workspaces with SUPER + scroll
|
# Scroll through existing workspaces with SUPER + scroll
|
||||||
bindd = SUPER, mouse_down, Scroll active workspace forward, workspace, e+1
|
bindd = SUPER, MOUSE_DOWN, Scroll active workspace forward, workspace, e+1
|
||||||
bindd = SUPER, mouse_up, Scroll active workspace backward, workspace, e-1
|
bindd = SUPER, MOUSE_UP, Scroll active workspace backward, 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 window, movewindow
|
bindmd = SUPER, mouse:272, Move window, movewindow
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
echo "Use current terminal shell cwd for new terminal working directories"
|
echo "Use current terminal shell cwd for new terminal working directories"
|
||||||
|
|
||||||
if ! grep -q "working-directory" ~/.config/hypr/bindings.conf; then
|
if ! grep -q "working-directory" ~/.config/hypr/bindings.conf; then
|
||||||
sed -i '/bindd = SUPER, return, Terminal, exec, \$terminal/ s|$| --working-directory=$(omarchy-cmd-terminal-cwd)|' ~/.config/hypr/bindings.conf
|
sed -i '/bindd = SUPER, RETURN, Terminal, exec, \$terminal/ s|$| --working-directory=$(omarchy-cmd-terminal-cwd)|' ~/.config/hypr/bindings.conf
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user