[doc] Added socket checks for the examples

In the examples in awesomerc.5.txt, they kind of assume that awesome is
already running. If you run them from your .xinitrc, they'll fail, because
the awesome socket isn't available.

This patch adds a quick check to make sure the socket is there before
starting up.

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Tim Conrad 2008-04-04 09:29:40 -04:00 committed by Julien Danjou
parent 038e52c699
commit 568117dae1
1 changed files with 28 additions and 10 deletions

View File

@ -84,12 +84,21 @@ Simple textbox example
4. Create ~/bin/awesome-clock 4. Create ~/bin/awesome-clock
#!/bin/sh #!/bin/sh
while true
do
# if you start this from .xinitrc, the script will start before
# awesome, and will fail.
if [ -S ~/.awesome_ctl.0 ]; then
while true while true
do do
echo "0 widget_tell bottom clock text `date`" echo "0 widget_tell bottom clock text `date`"
echo "" # an empty line flushes data inside awesome echo "" # an empty line flushes data inside awesome
sleep 1 sleep 1
done | awesome-client done | awesome-client
else
sleep 1
fi
done
Note: What we're saying is "awesome-client, tell the bottom status bar's Note: What we're saying is "awesome-client, tell the bottom status bar's
widget named 'clock' to set it's 'text' property to date's output". widget named 'clock' to set it's 'text' property to date's output".
@ -148,12 +157,21 @@ Simple progressbar example
4. Create ~/bin/awesome-diskusage 4. Create ~/bin/awesome-diskusage
#!/bin/sh #!/bin/sh
while true
do
# if you start this from .xinitrc, the script will start before
# awesome, and will fail.
if [ -S ~/.awesome_ctl.0 ]; then
while true; do while true; do
usage = `df /dev/sda5 | awk '/\/dev\/sda5/ { print 100-$5 }'` usage = `df /dev/sda5 | awk '/\/dev\/sda5/ { print 100-$5 }'`
echo "0 widget_tell bottom diskusage data disk ${usage}" echo "0 widget_tell bottom diskusage data disk ${usage}"
echo "" # an empty line flushes data inside awesome echo "" # an empty line flushes data inside awesome
sleep 600; sleep 600;
done | awesome-client done | awesome-client
else
sleep 1
fi
done
Note: What we're saying is "awesome-client, tell the bottom status bar's Note: What we're saying is "awesome-client, tell the bottom status bar's