.dotfiles/.config/sway/scripts/create-floating

28 lines
770 B
Plaintext
Raw Permalink Normal View History

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