[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:
parent
038e52c699
commit
568117dae1
|
@ -86,10 +86,19 @@ Simple textbox example
|
|||
#!/bin/sh
|
||||
while true
|
||||
do
|
||||
echo "0 widget_tell bottom clock text `date`"
|
||||
echo "" # an empty line flushes data inside awesome
|
||||
sleep 1
|
||||
done | awesome-client
|
||||
# if you start this from .xinitrc, the script will start before
|
||||
# awesome, and will fail.
|
||||
if [ -S ~/.awesome_ctl.0 ]; then
|
||||
while true
|
||||
do
|
||||
echo "0 widget_tell bottom clock text `date`"
|
||||
echo "" # an empty line flushes data inside awesome
|
||||
sleep 1
|
||||
done | awesome-client
|
||||
else
|
||||
sleep 1
|
||||
fi
|
||||
done
|
||||
|
||||
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".
|
||||
|
@ -148,12 +157,21 @@ Simple progressbar example
|
|||
4. Create ~/bin/awesome-diskusage
|
||||
|
||||
#!/bin/sh
|
||||
while true; do
|
||||
usage = `df /dev/sda5 | awk '/\/dev\/sda5/ { print 100-$5 }'`
|
||||
echo "0 widget_tell bottom diskusage data disk ${usage}"
|
||||
echo "" # an empty line flushes data inside awesome
|
||||
sleep 600;
|
||||
done | awesome-client
|
||||
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
|
||||
usage = `df /dev/sda5 | awk '/\/dev\/sda5/ { print 100-$5 }'`
|
||||
echo "0 widget_tell bottom diskusage data disk ${usage}"
|
||||
echo "" # an empty line flushes data inside awesome
|
||||
sleep 600;
|
||||
done | awesome-client
|
||||
else
|
||||
sleep 1
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
Note: What we're saying is "awesome-client, tell the bottom status bar's
|
||||
|
|
Loading…
Reference in New Issue