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