#!/bin/bash # Toggle padding on the focused kitty window. Bound to Super+middle click in # hyprland.conf; follow_mouse = 1 means the focused window is the one under the # cursor. Uses the per-process socket from `listen_on unix:/tmp/kitty`, which # kitty suffixes with -. The user var nopad records the toggle state. win=$(hyprctl activewindow -j) [[ $(jq -r .class <<<"$win") == kitty ]] || exit 0 k=(kitty @ --to "unix:/tmp/kitty-$(jq -r .pid <<<"$win")") m=(--match state:focused) nopad=$("${k[@]}" ls "${m[@]}" | jq -r '.[0].tabs[0].windows[0].user_vars.nopad // empty') if [[ $nopad == 1 ]]; then "${k[@]}" set-spacing "${m[@]}" padding=default "${k[@]}" set-user-vars "${m[@]}" nopad else "${k[@]}" set-spacing "${m[@]}" padding=0 "${k[@]}" set-user-vars "${m[@]}" nopad=1 fi