diff --git a/bin/sway-switch-app b/bin/sway-switch-app new file mode 100755 index 0000000..4d48591 --- /dev/null +++ b/bin/sway-switch-app @@ -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