dotfiles/de/home/.config/sway/scripts/scratchpad_cycle.sh
2025-07-16 16:57:07 -07:00

14 lines
609 B
Bash
Executable file

#!/bin/bash
swaymsg scratchpad show
active_window_scratchstate="$(swaymsg -t get_tree | jq -r '.. | select(.type?) | select(.focused==true).scratchpad_state')"
if [[ "${active_window_scratchstate}" != "none" ]];then
active_screen_dim="$(swaymsg -t get_outputs | jq -r '.. | select(.type?) | select(.focused==true).rect')"
active_screen_width="$(jq '.width' <<<${active_screen_dim})"
active_screen_height="$(jq '.height' <<<${active_screen_dim})"
if [[ "${active_screen_width}" -gt "${active_screen_height}" ]];then
swaymsg resize set 50ppt 50ppt
else
swaymsg resize set 75ppt 25ppt
fi
fi