Last active
March 21, 2024 09:57
-
-
Save ckafi/0a5b79105c8301466cc324a08200aad7 to your computer and use it in GitHub Desktop.
Tracks the previosly focused window in sway and marks it with '_prev'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
prev_focus=$(swaymsg -r -t get_seats | jq '.[0].focus') | |
swaymsg -m -t subscribe '["window"]' | \ | |
jq --unbuffered 'select(.change == "focus").container.id' | \ | |
while read new_focus; do | |
swaymsg "[con_id=${prev_focus}] mark --add _prev" &>/dev/null | |
prev_focus=$new_focus | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Referenced in this reddit: https://www.reddit.com/r/swaywm/comments/etpjix/i_created_a_script_to_implement_window_back_and/?utm_source=share&utm_medium=web2x&context=3