From 568117dae1821e408ce02c45a6d4885ca0336b9b Mon Sep 17 00:00:00 2001 From: Tim Conrad Date: Fri, 4 Apr 2008 09:29:40 -0400 Subject: [PATCH] [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 --- awesomerc.5.txt | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/awesomerc.5.txt b/awesomerc.5.txt index ba1408c9..3471a8aa 100644 --- a/awesomerc.5.txt +++ b/awesomerc.5.txt @@ -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