Skip to content

Instantly share code, notes, and snippets.

@stephenh
Created November 24, 2025 18:14
Show Gist options
  • Select an option

  • Save stephenh/93f96c458ce5180c5ff930870c77042e to your computer and use it in GitHub Desktop.

Select an option

Save stephenh/93f96c458ce5180c5ff930870c77042e to your computer and use it in GitHub Desktop.
vi-style hyprscrolliing bindings
# Focus change (vim-style), use scrolling focus to center window
bindd = $mod, $left, Move focus left, layoutmsg, focus l
bindd = $mod, $right, Move focus right, layoutmsg, focus r
bindd = $mod, $up, Move focus up, movefocus, u
bindd = $mod, $down, Move focus down, movefocus, d
# Move scrolling windows (vim-style)
bindd = $mod SHIFT, $left, Move window left, layoutmsg, movewindowto l
bindd = $mod SHIFT, $right, Move window right, layoutmsg, movewindowto r
bindd = $mod SHIFT, $up, Move window up, layoutmsg, movewindowto u
bindd = $mod SHIFT, $down, Move window down, layoutmsg, movewindowto d
bindd = $mod SHIFT, SEMICOLON, Promote window right, layoutmsg, promote
# Resize, kinda full screen
bindd = $mod, SPACE, Toggle full width, exec, ~/.local/bin/fullwidth.sh
bindd = $mod SHIFT, SPACE, Resize, layoutmsg, colresize +conf
# Resize windows (scrolling)
bind = $mod, r, submap, resize
submap = resize
binde = , $left, layoutmsg, colresize -conf
binde = , $right, layoutmsg, colresize +conf
binde = , $up, resizeactive, 0 -40
binde = , $down, resizeactive, 0 40
bind = , ESCAPE, submap, reset
bind = , RETURN, submap, reset
submap = reset
# binds:auto_back_and_forth = true
binds:workspace_back_and_forth = true
binds:allow_workspace_cycles = true
#!/bin/bash
# Get active window info
window_info=$(hyprctl activewindow -j)
monitor_info=$(hyprctl monitors -j)
# Exit if no active window
if [[ -z "$window_info" ]] || [[ "$window_info" == "Invalid" ]]; then
exit
fi
window_width=$(echo "$window_info" | jq -r '.size[0]')
monitor_id=$(echo "$window_info" | jq -r '.monitor')
monitor_width=$(echo "$monitor_info" | jq -r ".[] | select(.id == $monitor_id) | .width")
monitor_scale=$(echo "$monitor_info" | jq -r ".[] | select(.id == $monitor_id) | .scale")
scaled_window_width=$(awk "BEGIN {print int($window_width * $monitor_scale)}")
border_etc_width=50
# echo "monitor_width=$monitor_width scaled_window_width=$scaled_window_width"
if [[ $((scaled_window_width + border_etc_width)) -ge $monitor_width ]]; then
echo "not-full"
# hyprctl --batch "dispatch layoutmsg colresize 0.5; dispatch layoutmsg focus l; dispatch layoutmsg focus r"
hyprctl dispatch layoutmsg colresize 0.5
else
echo "full"
hyprctl dispatch layoutmsg colresize 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment