Add missing sway-switch-app script

This commit is contained in:
Daniel Lundin 2020-08-05 17:06:45 +02:00
parent 08f8ce2723
commit 6385a436eb
No known key found for this signature in database
GPG key ID: 6AB527C9196ACDCC

7
bin/sway-switch-app Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
set -exo pipefail
app_id="$1"
swaymsg -t get_tree \
| jq -r "recurse(.nodes[]?)|recurse(.floating_nodes[]?)|select(.app_id==\"${app_id}\")|select(.focused==false)|\"[con_id=\"+ (.id|tostring) + \"] focus\"" \
| head -n 1 \
| xargs -e swaymsg