.dotfiles/configs/sway/create_floating.sh

29 lines
688 B
Bash
Raw Normal View History

2022-04-08 15:47:38 +02:00
#!/usr/bin/env bash
$@ &
pid=$!
2022-04-08 17:37:26 +02:00
# ALL_NODES='recurse(.nodes[]?, .floating_nodes[]?) | select(.pid and .visible)'
# echo "pid: $pid"
# all_nodes="$(swaymsg -t get_tree | jq -r "$ALL_NODES")"
# window_id="$(swaymsg -t get_tree | jq -r "$ALL_NODES" | jq -c ". | select(.pid==$pid) | .id")"
# echo "al: $all_nodes"
# echo "window_id: $window_id"
2022-04-08 15:47:38 +02:00
swaymsg -t subscribe -m '[ "window" ]' \
| jq --unbuffered --argjson pid "$pid" '.container | select(.pid == $pid) | .id' \
2022-04-08 17:37:26 +02:00
| xargs -I '@' -- swaymsg '[ con_id=@ ] floating enable' &
2022-04-08 15:47:38 +02:00
subscription=$!
echo Going into wait state
# Wait for our process to close
tail --pid=$pid -f /dev/null
echo Killing subscription
kill $subscription