#!/bin/sh eval "$1 &" pid=$! echo $pid; shift swaymsg "[pid=$pid]" "$@" while [ "$?" = "2" ];do swaymsg "[pid=$pid]" "$@" done