This repository has no description
610 B
35 lines
1#!/usr/bin/env bash
2
3set -efo pipefail
4
5 SWAY_FLAGS=()
6
7 while [[ "$#" -gt 0 ]]; do
8 case $1 in
9 --)
10 shift
11 break
12 ;;
13 *)
14 SWAY_FLAGS+=($1)
15 ;;
16 esac
17 shift
18 done
19
20$@ &
21pid=$!
22
23swaymsg -t subscribe -m '[ "window" ]' \
24 | jq --unbuffered --argjson pid "$pid" '.container | select(.pid == $pid) | .id' \
25 | xargs -I '@' -- swaymsg "[ con_id=@ ] ${SWAY_FLAGS[@]}" &
26
27subscription=$!
28
29echo Going into wait state
30
31# Wait for our process to close
32tail --pid=$pid -f /dev/null
33
34echo Killing subscription
35kill $subscription