1 |
#!/usr/bin/env bash |
#!/usr/bin/env bash |
2 |
|
|
3 |
# AntiRight (c) 2002-2005 Jeffrey Bedard antiright@gmail.com |
# AntiRight (c) 2002-2005 Jeffrey Bedard antiright@gmail.com |
4 |
|
|
5 |
# This file is part of AntiRight. |
# This file is part of AntiRight. |
6 |
|
|
7 |
# AntiRight is free software; you can redistribute it and/or |
# AntiRight is free software; you can redistribute it and/or |
29 |
} |
} |
30 |
ACE_Check_Configuration_File() |
ACE_Check_Configuration_File() |
31 |
{ |
{ |
32 |
# This probably should be replaced with a for loop. |
# This probably should be replaced with a for loop. |
33 |
# In such the likely prefixes are what will be processed. |
# In such the likely prefixes are what will be processed. |
34 |
if [ ! -f ~/.antiright ]; then |
if [ ! -f ~/.antiright ]; then |
35 |
if [ -e /usr/local/share/antiright/system.antiright ]; then |
if [ -e /usr/local/share/antiright/system.antiright ]; then |
36 |
cp /usr/local/share/antiright/system.antiright ~/.antiright |
cp /usr/local/share/antiright/system.antiright ~/.antiright |
37 |
elif [ -e /usr/share/antiright/system.antiright ]; then |
elif [ -e /usr/share/antiright/system.antiright ]; then |
38 |
cp /usr/share/antiright/system.antiright ~/.antiright |
cp /usr/share/antiright/system.antiright ~/.antiright |
41 |
# If ~/.antiright doesnt contain the text "revision" it does |
# If ~/.antiright doesnt contain the text "revision" it does |
42 |
# not keep track of revisions and therefore is an old version. |
# not keep track of revisions and therefore is an old version. |
43 |
if [ "$(grep revision ~/.antiright)" = "" ]; then |
if [ "$(grep revision ~/.antiright)" = "" ]; then |
44 |
# Backup customizations. |
# Backup customizations. |
45 |
mv ~/.antiright ~/.antiright.old |
mv ~/.antiright ~/.antiright.old |
46 |
# Restore2 ~/.antiright with a new instance. |
# Restore2 ~/.antiright with a new instance. |
47 |
ACE_Check_Configuration_File |
ACE_Check_Configuration_File |
48 |
# Alert the user. |
# Alert the user. |
49 |
echo 'Your old ~/.antiright has been saved to ~/.antiright.old' |
echo 'Your old ~/.antiright has been saved to ~/.antiright.old' |
50 |
echo 'This is due to the use of a new revision of the file,' |
echo 'This is due to the use of a new revision of the file,' |
51 |
echo 'changing the theme support.' |
echo 'changing the theme support.' |
111 |
Play_Next() |
Play_Next() |
112 |
{ |
{ |
113 |
Setup_Juke_Environment |
Setup_Juke_Environment |
114 |
if [ "$(ps xa | grep mpg123 | grep -v grep | grep -v renice | grep -v pidof)" = "" ]; then |
if [ "$(ps xa | grep mpg123 | grep -v grep | grep -v renice | grep -v pidof)"\ |
115 |
|
= "" ]; then |
116 |
killall $mp3player |
killall $mp3player |
117 |
echo "#!/bin/sh" > /tmp/ACE.$$ |
echo "#!/bin/sh" > /tmp/ACE.$$ |
118 |
echo "$mp3player -Z $mp3dir/*.mp3 2>> ~/.antiright_mp3s" >> /tmp/ACE.$$ |
echo "$mp3player -Z $mp3dir/*.mp3 2>> ~/.antiright_mp3s" >> /tmp/ACE.$$ |
200 |
{ |
{ |
201 |
cal | arshell -Am -Aw -p -geometry 200x200 |
cal | arshell -Am -Aw -p -geometry 200x200 |
202 |
} |
} |
203 |
Desktop() |
desk_init() |
204 |
{ |
{ |
205 |
Setup_Juke_Environment |
Setup_Juke_Environment |
206 |
create_fake_song_file |
create_fake_song_file |
207 |
echo '#!/bin/sh' > /tmp/ACE.$$ |
echo '#!/bin/sh' > /tmp/ACE.$$ |
208 |
arbmdir=$bmdir/antiright |
arbmdir=$bmdir/antiright |
209 |
|
} |
210 |
# POSITION="$(ACE desker_position)" |
Music() |
211 |
# if [ "$POSITION" = "upper_left" ]; then |
{ |
212 |
# GEOMETRY="+0+0" |
desk_init |
213 |
# elif [ "$POSITION" = "upper_right" ]; then |
$ARSHELL -Am -UL 'ACE -A Juke_Song' -r 1\ |
214 |
# GEOMETRY="-0+0" |
-Ai 'ACE -A Play_Next \# Play' $arbmdir/play.xpm\ |
215 |
# elif [ "$POSITION" = "lower_left" ]; then |
-Ai 'ACE -A Stop' $arbmdir/stop.xpm\ |
216 |
# GEOMETRY="+0-0" |
-Ai 'ACE -A Pause' $arbmdir/pause.xpm\ |
217 |
# elif [ "$POSITION" = "lower_right" ]; then |
-Ai 'ACE -A Resume' $arbmdir/resume.xpm & |
218 |
# GEOMETRY="-0-0" |
} |
219 |
# else |
Desktop() |
220 |
# GEOMETRY="+0+0" |
{ |
221 |
# fi |
desk_init |
222 |
|
|
223 |
echo "$ARSHELL -W DESKTOP\\" >> /tmp/ACE.$$ |
echo "$ARSHELL -W DESKTOP\\" >> /tmp/ACE.$$ |
224 |
if [ "$(ACE is_clocked)" = "1" ]; then |
if [ "$(ACE is_clocked)" = "1" ]; then |
225 |
echo " -Ac\\" >> /tmp/ACE.$$ |
echo " -Ac\\" >> /tmp/ACE.$$ |
226 |
fi |
fi |
229 |
if [ "$PAGED" = "1" ]; then |
if [ "$PAGED" = "1" ]; then |
230 |
echo " -Ai 'vdesk 1' $arbmdir/1.xpm -Ai 'vdesk 2' $arbmdir/2.xpm -Ai 'vdesk 3' $arbmdir/3.xpm -Ai 'vdesk 4' $arbmdir/4.xpm\\" >> /tmp/ACE.$$ |
echo " -Ai 'vdesk 1' $arbmdir/1.xpm -Ai 'vdesk 2' $arbmdir/2.xpm -Ai 'vdesk 3' $arbmdir/3.xpm -Ai 'vdesk 4' $arbmdir/4.xpm\\" >> /tmp/ACE.$$ |
231 |
fi |
fi |
232 |
echo " -Ai 'ACE -A Play_Next \# Play' $arbmdir/play.xpm -Ai 'ACE -A Stop' $arbmdir/stop.xpm -Ai 'ACE -A Pause' $arbmdir/pause.xpm -Ai 'ACE -A Resume' $arbmdir/resume.xpm -Ai 'ACE Lock' $arbmdir/lock.xpm -Ai 'ACE -A restart_dialog' $arbmdir/refresh.xpm -Ai 'ACE -A Settings' $arbmdir/settings.xpm -Ai 'ACE' $arbmdir/ace.xpm -Ai 'ACE -L Run' $arbmdir/runner.xpm -Ai 'ACE Terminal' $arbmdir/terminal.xpm -Ai 'ACE -A Alarm' $arbmdir/clock.xpm -Ai 'ACE -A Sticky_Note' $arbmdir/sticky.xpm -Ai 'ACE Calculator' $arbmdir/calculator.xpm -Ai 'ACE -A Background_Editor' $arbmdir/palate.xpm -Ai 'ACE File_Manager' $arbmdir/folder.xpm -Ai 'ACE -A File_System_Panel File_Systems' $arbmdir/disk.xpm -Ai 'ACE Mail' $arbmdir/mail.xpm -Ai 'ACE Cal' $arbmdir/calendar.xpm -Ai 'ACE Load_Meter' $arbmdir/meter.xpm -Ai 'ACE Editor' $arbmdir/text_editor.xpm -Ai 'ACE Browser' $arbmdir/www.xpm -Ai 'ACE CD_Player' $arbmdir/music.xpm -Ai 'afract & # Fractals' $arbmdir/fractal.xpm -Ai 'pongr & # PONGr' $arbmdir/pong.xpm\\" >> /tmp/ACE.$$ |
echo " -Ai 'ACE -A Play_Next \# Play' $arbmdir/play.xpm -Ai 'ACE -A Stop' $arbmdir/stop.xpm -Ai 'ACE -A Pause' $arbmdir/pause.xpm -Ai 'ACE -A Resume' $arbmdir/resume.xpm -Ai 'ACE Lock' $arbmdir/lock.xpm -Ai 'ACE -A restart_dialog' $arbmdir/refresh.xpm -Ai 'ACE -A Settings' $arbmdir/settings.xpm -Ai 'ACE' $arbmdir/ace.xpm -Ai 'ACE -L Run' $arbmdir/runner.xpm -Ai 'ACE Terminal' $arbmdir/terminal.xpm -Ai 'ACE -A Alarm' $arbmdir/clock.xpm -Ai 'ACE -A Sticky_Note' $arbmdir/sticky.xpm -Ai 'ACE Calculator' $arbmdir/calculator.xpm -Ai 'ACE -A Background_Editor' $arbmdir/palate.xpm -Ai 'ACE File_Manager' $arbmdir/folder.xpm -Ai 'ACE -A File_System_Panel File_Systems' $arbmdir/disk.xpm -Ai 'ACE Mail' $arbmdir/mail.xpm -Ai 'ACE Cal' $arbmdir/calendar.xpm -Ai 'ACE Load_Meter' $arbmdir/meter.xpm -Ai 'ACE Editor' $arbmdir/text_editor.xpm -Ai 'ACE Browser' $arbmdir/www.xpm -Ai 'ACE CD_Player' $arbmdir/music.xpm -Ai 'afract & # Fractals' $arbmdir/fractal.xpm -Ai 'pongr & # PONGr' $arbmdir/pong.xpm\\" >> /tmp/ACE.$$ |
233 |
|
|
234 |
|
# Get the full screen geometry. |
235 |
GEOMETRY=$(xdpyinfo | grep dimensions | awk '{print $2}') |
GEOMETRY=$(xdpyinfo | grep dimensions | awk '{print $2}') |
236 |
echo " -geometry $GEOMETRY -xrm '*marginHeight: 0' -xrm '*marginWidth: 0' -xrm '*spacing: 0' -xrm '*XmPushButton.marginWidth: 2' -xrm 'AntiRight.borderWidth: 1' -xrm '*overrideRedirect: True' -xrm '*shadowThickness: 0' -xrm '*background: $(ACE background)' -xrm '*foreground: $(ACE foreground)' -xrm '*borderWidth: 0' -xrm '*borderColor: $(ACE background)' -l &" >> /tmp/ACE.$$ |
|
237 |
|
# This ensures that a correctly rendered window is produced, even |
238 |
|
# if the xdpyinfo binary is not present. |
239 |
|
|
240 |
|
if [ "$GEOMETRY" = "" ]; then |
241 |
|
GEOMETRY='+0+0' |
242 |
|
fi |
243 |
|
|
244 |
|
echo " -geometry $GEOMETRY -xrm '*marginHeight: 0' -xrm '*marginWidth: 0' -xrm '*spacing: 0' -xrm '*XmPushButton.marginWidth: 2' -xrm 'AntiRight.borderWidth: 1' -xrm '*overrideRedirect: True' -xrm '*shadowThickness: 0' -xrm '*background: $(ACE background)' -xrm '*foreground: $(ACE foreground)' -xrm '*borderWidth: 0' -xrm '*borderColor: $(ACE background)' -l -xrm '*XmMenuShell*.background: grey64' -xrm '*XmMenuShell*.shadowThickness: 1' -xrm '*XmMenuShell*.foreground: white' -xrm '*XmMenuShell*.fontList: -*-helvetica-bold-r-*-*-14-*-*-*-*-*-*-*' &" >> /tmp/ACE.$$ |
245 |
chmod +x /tmp/ACE.$$ |
chmod +x /tmp/ACE.$$ |
246 |
/tmp/ACE.$$ |
/tmp/ACE.$$ |
247 |
rm -f /tmp/ACE.$$ |
#rm -f /tmp/ACE.$$ |
248 |
} |
} |
249 |
restart_desktop() |
restart_desktop() |
250 |
{ |
{ |
251 |
ACE -A killdesk |
ACE -A killdesk |
252 |
ACE -A Desktop |
ACE -A Desktop |
253 |
} |
} |
254 |
|
killwm() |
255 |
|
{ |
256 |
|
WINDOWMANAGER=$(cat ~/.xinitrc | grep WINDOWMANAGER | cut -d '=' -f 2) |
257 |
|
if [ "$WINDOWMANAGER" = "" ]; then |
258 |
|
$ARSHELL -ADm "Please set WINDOWMANGER in ~/.xinitrc." |
259 |
|
else |
260 |
|
killall $WINDOWMANAGER |
261 |
|
fi |
262 |
|
} |
263 |
|
ARI() |
264 |
|
{ |
265 |
|
$ARSHELL 'cd /home/jefbed/src/antiright; make install; arshell -ADm Done; echo Install' > /dev/null & |
266 |
|
} |
267 |
restart_dialog() |
restart_dialog() |
268 |
{ |
{ |
269 |
$ARSHELL -E\ |
# Get the full screen geometry. |
270 |
|
GEOMETRY=$(xdpyinfo | grep dimensions | awk '{print $2}') |
271 |
|
X_DIM=$(xdpyinfo | grep dimensions | awk '{print $2}' | cut -d x -f 1) |
272 |
|
Y_DIM=$(xdpyinfo | grep dimensions | awk '{print $2}' | cut -d x -f 2) |
273 |
|
# This ensures that a correctly rendered window is produced, even |
274 |
|
# if the xdpyinfo binary is not present. |
275 |
|
|
276 |
|
if [ "$GEOMETRY" = "" ]; then |
277 |
|
GEOMETRY='+0+0' |
278 |
|
else |
279 |
|
GEOMETRY="+$(($X_DIM/2))+$(($Y_DIM/2))" |
280 |
|
fi |
281 |
|
#echo $GEOMETRY |
282 |
|
$ARSHELL -r 2 -E -W Exit?\ |
283 |
'ACE -A restart_desktop Restart'\ |
'ACE -A restart_desktop Restart'\ |
284 |
'ACE -A killdesk Quit'\ |
'ACE -A killdesk Quit'\ |
285 |
'ACE Lock'\ |
'ACE Lock'\ |
286 |
'echo Cancel' |
'echo Cancel'\ |
287 |
|
-xrm "*fontList: -*-helvetica-bold-r-*-*-25-*-*-*-*-*-*-*"\ |
288 |
|
-xrm "*foreground: white"\ |
289 |
|
-xrm "*background: grey64"\ |
290 |
|
-xrm "*shadowThickness: 1"\ |
291 |
|
-xrm "*transient: True"\ |
292 |
|
-xrm "*overrideRedirect: True"\ |
293 |
|
-geometry $GEOMETRY |
294 |
|
|
295 |
} |
} |
296 |
return_pseudorandom_color() |
return_pseudorandom_color() |
297 |
{ |
{ |
347 |
} |
} |
348 |
Message_Dialog() |
Message_Dialog() |
349 |
{ |
{ |
350 |
$ARSHELL -ADm "$(echo $1 | tr '_' ' ')" |
$ARSHELL -ADm "$(echo $1 | tr '_' ' ')" |
351 |
} |
} |
352 |
Help_Dialog() |
Help_Dialog() |
353 |
{ |
{ |
390 |
mail_or_users="Mail." |
mail_or_users="Mail." |
391 |
fi |
fi |
392 |
fi |
fi |
393 |
# In order to conserve space, only the 5 minute load is given. |
# In order to conserve space, only the 5 minute load is given. |
394 |
echo -n\ |
echo -n\ |
395 |
' ' $date_and_time $(uptime | cut -d : -f 4 | cut -d , -f 2)\ |
' ' $date_and_time $(uptime | cut -d : -f 4 | cut -d , -f 2)\ |
396 |
$mail_or_users |
$mail_or_users |
435 |
{ |
{ |
436 |
local xmcd_path="$(which xmcd)" |
local xmcd_path="$(which xmcd)" |
437 |
|
|
438 |
# This allows the conditional to work with NetBSD's which command. |
# This allows the conditional to work with NetBSD's which command. |
439 |
if [ "$(echo $xmcd_path | cut -d ' ' -f 1)" == "no" ]; then |
if [ "$(echo $xmcd_path | cut -d ' ' -f 1)" == "no" ]; then |
440 |
xmcd_path="" |
xmcd_path="" |
441 |
fi |
fi |
442 |
# Run xmcd if available. |
# Run xmcd if available. |
443 |
if [ "$xmcd_path" != "" ]; then |
if [ "$xmcd_path" != "" ]; then |
444 |
xmcd & |
xmcd & |
445 |
else |
else |
527 |
'ACE -A Load_Meter'\ |
'ACE -A Load_Meter'\ |
528 |
'ACE -A System_Accounting'\ |
'ACE -A System_Accounting'\ |
529 |
"xload -bg red4 -fg yellow -hl yellow & # X_Load" |
"xload -bg red4 -fg yellow -hl yellow & # X_Load" |
|
|
|
530 |
} |
} |
531 |
System_Accounting() |
System_Accounting() |
532 |
{ |
{ |