track_workspace[s] now uses track_anything.sh

This commit is contained in:
James Andariese 2024-03-30 16:05:07 -05:00
parent 35cbcaadbc
commit 2b24b0fb67
2 changed files with 21 additions and 12 deletions

View File

@ -1,7 +1,15 @@
#!/usr/bin/env bash
swaymsg -t subscribe -m '[ "workspace" ]' | jq --unbuffered '.current.num' | while read -r;do
if [ "$REPLY" != "null" ];then
echo "$REPLY"
fi
done
. "$(dirname "$0")/track_anything.sh"
poll() {
swaymsg -t get_workspaces | jq -r '.[]|select(.focused).name'
}
rate_limit .1
poll_interval 10
on_sway
output_string .
filter uniq
start "$@"

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash
. "$(dirname "$0")/track_anything.sh"
poll() {
swaymsg -t get_tree |
jq -c --unbuffered '.
@ -52,12 +54,11 @@ poll() {
| $out
'
}
poll
[ ${1-x} == '-d' ] && exit 0
swaymsg -t subscribe -m '[ "workspace", "window" ]' |
jq --unbuffered -c '.' |
while read -r EVENT;do
poll
done
rate_limit .1
poll_interval 10
on_sway
output_string .
filter uniq
start "$@"