#!/usr/bin/env bash # Follow current workspace and place bottom-right at 800x600. # Requires the window to be marked "pin-keymapp" and floating. # Subscribe to workspace changes swaymsg -t subscribe '["workspace"]' | while read -r _; do # Ensure the window exists before issuing moves if swaymsg -t get_tree | jq -e '.. | objects | select(.marks? and (index("pin-keymapp"))) ' >/dev/null; then # Move to current workspace swaymsg '[con_mark="pin-keymapp"] move container to workspace current' # Ensure size, then place. Order matters: floating -> resize -> move. swaymsg '[con_mark="pin-keymapp"] floating enable' swaymsg '[con_mark="pin-keymapp"] resize set width 800 px height 600 px' swaymsg '[con_mark="pin-keymapp"] move position 100%-800px 100%-600px' # If needed (multi-output absolute coords), use: # swaymsg '[con_mark="pin-keymapp"] move absolute position 100%-800px 100%-600px' fi done