Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 61 lines (49 sloc) 1.245 kB
b722d65 @alobbs Initial import
authored
1 set -o errexit
2 set -o pipefail
3
4 function get_running_apps {
5 match=$1
6 echo `wmctrl -lx | grep $match | cut -d" " -f1`
7 }
8
9 function launch_app {
10 binary=$1
11 binary_args=$2
12 match=$3
13 delay=$4
14 workspace=$5
15 fullscreen=$6
16 maximize=$7
17
18 # Running app: give it focus and exit
19 apps_running=$(get_running_apps $match)
20 if [ "x$apps_running" != "x" ]; then
21 wmctrl -ia $apps_running
22 exit
23 fi
24
25 # Launch a new app
26 ${binary} ${binary_args} &
27
28 n=0
29 while [ $n -lt 4 ]; do
30 sleep $delay
31 app_running=$(get_running_apps $match)
32 if [ "x$app_running" != "x" ]; then
33 break
34 fi
35 n=$[$n+1]
36 done
37
38 app_running=$(get_running_apps $match)
39
40 # Relocate the window to the workspace
41 if [ "x$workspace" != "x" ]; then
42 wmctrl -ir ${app_running} -t ${workspace}
43 fi
44
45 # Maximize it
46 if [ "x$fullscreen" != "x" ]; then
47 wmctrl -ir ${app_running} -b add,fullscreen
48 fi
49
50 if [ "x$maximize" != "x" ]; then
51 wmctrl -ir ${app_running} -b add,maximized_vert,maximized_horz
52 fi
53
54 # Activate the window
55 wmctrl -ia ${app_running}
56 }
57
58 function launch {
59 launch_app "$BINARY" "$BINARY_ARGS" "$MATCH" "$DELAY" "$WORKSPACE" "$FULLSCREEN" "$MAXIMIZE"
60 }
Something went wrong with that request. Please try again.