Skip to content

Instantly share code, notes, and snippets.

@wwalker
Created June 10, 2022 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wwalker/fc2da4f02795a81909987eadab4cab82 to your computer and use it in GitHub Desktop.
Save wwalker/fc2da4f02795a81909987eadab4cab82 to your computer and use it in GitHub Desktop.
#!/bin/bash -x
launch_and_mark(){
local window_role=$1
local startup_sleep=$2
shift 2
launch "$@"
id=
read -rt 10 id < <(timeout "$startup_sleep" i3-msg -t subscribe -m '["window"]' | stdbuf -o0 jq -S -r "select(.change==\"new\" $class).container.window" )
if [[ -n "$id" ]]; then
xprop -id "$id" -f WM_WINDOW_ROLE 8s -set WM_WINDOW_ROLE "$window_role"
fi
sleep 1
}
move_to_left_monitor(){
left_monitor=$( xrandr | grep ' connected .*+0+0' | awk '{ print $1 }' )
i3-msg focus output "$left_monitor"
sleep 0.5
}
[[ $( hostname ) = "polonium" ]] && move_to_left_monitor
launch_and_mark "teams" 5 webex
launch_and_mark "me" 5 chrome Wayne
#launch_and_mark "cisco" 5 chrome Cisco
launch_and_mark "signal" 5 signal-desktop
launch_and_mark "work" 5 chrome Heimdall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment