-
Notifications
You must be signed in to change notification settings - Fork 39
/
xephyr_awesome
executable file
·148 lines (136 loc) · 3.59 KB
/
xephyr_awesome
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/usr/bin/env bash
# Run Awesome in a nested server for tests
#
# Requirements: (Debian)
#
# apt-get install xserver-xephyr
# apt-get install -t unstable awesome
#
# Based on original script by dante4d <[email protected]>
# See: http://awesome.naquadah.org/wiki/index.php?title=Using_Xephyr20
#
# URL: http://hellekin.cepheide.org/awesome/awesome_test21
#
# Copyright (c) 2009 Hellekin O. Wolf <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/22>.
#
function usage()
{
cat <<USAGE
awesome_test start|stop|restart|run
start Start nested Awesome in Xephyr
stop Stop Xephyr
restart Reload nested Awesome configuration
run Run command in nested Awesome
USAGE
exit 0
}
# WARNING: the following two functions expect that you only run one instance
# of Xephyr and the last launched Awesome runs in it
function awesome_pid()
{
/bin/pidof awesome | cut -d\ -f1
}
function xephyr_pid()
{
/bin/pidof Xephyr | cut -d\ -f1
}
[ $# -lt 1 ] && usage
# If rc.lua.new is missing, make a default one.
RC_LUA=~/.config/awesome/rc.lua.new
test -f $RC_LUA || /bin/cp /etc/xdg/awesome/rc.lua $RC_LUA
# Just in case we're not running from /usr/bin
AWESOME=`which awesome`
XEPHYR=`which Xephyr`
test -x $AWESOME || { echo "Awesome executable not found. Please install Awesome"; exit 1; }
test -x $XEPHYR || { echo "Xephyr executable not found. Please install Xephyr"; exit 1; }
case "$1" in
start)
$XEPHYR -ac -br -noreset -screen 800x600 :1 &
sleep 1
DISPLAY=:1.0 $AWESOME -c $RC_LUA &
sleep 1
echo Awesome ready for tests. PID is $(awesome_pid)
;;
stop)
echo -n "Stopping Nested Awesome... "
if [ -z $(xephyr_pid) ]; then
echo "Not running: not stopped :)"
exit 0
else
kill $(xephyr_pid)
echo "Done."
fi
;;
restart)
echo -n "Restarting Awesome... "
kill -s SIGHUP $(awesome_pid)
;;
run)
shift
DISPLAY=:1.0 "$@" &
;;
*)
usage
;;
esac
#
#{
# /bin/pidof Xephyr | cut -d\ -f1
#}
#
#[ $# -lt 1 ] && usage
#
## If rc.lua.new is missing, make a default one.
#RC_LUA=~/.config/awesome/rc.lua.new
#test -f $RC_LUA || /bin/cp /etc/xdg/awesome/rc.lua $RC_LUA
#
## Just in case we're not running from /usr/bin
#AWESOME=`which awesome`
#XEPHYR=`which Xephyr`
#
#test -x $AWESOME || { echo "Awesome executable not found. Please install Awesome"; exit 1; }
#test -x $XEPHYR || { echo "Xephyr executable not found. Please install Xephyr"; exit 1; }
#
#case "$1" in
# start)
# $XEPHYR -ac -br -noreset -screen 800x600 :1 &
# sleep 1
# DISPLAY=:1.0 $AWESOME -c $RC_LUA &
# sleep 1
# echo Awesome ready for tests. PID is $(awesome_pid)
# ;;
# stop)
# echo -n "Stopping Nested Awesome... "
# if [ -z $(xephyr_pid) ]; then
# echo "Not running: not stopped :)"
# exit 0
# else
# kill $(xephyr_pid)
# echo "Done."
# fi
# ;;
# restart)
# echo -n "Restarting Awesome... "
# kill -s SIGHUP $(awesome_pid)
# ;;
# run)
# shift
# DISPLAY=:1.0 "$@" &
# ;;
# *)
# usage
# ;;
# esac