#!/bin/sh appid=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[],.floating_nodes[]) | select(.focused).app_id') printf "focused appid = %s\n" $appid case "$appid" in mpv) wtype -k space ;; *) notify-send "$(mpc toggle)" ;; esac