[hackers] [wmii] Create Action_ functions immediately. Quote $WMII_NORMCOLORS in Action_status

From: Kris Maglione <jg_AT_suckless.org>
Date: Sun Feb 25 21:01:25 2007

changeset: 1955:8f704c707daf
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Sun Feb 25 14:59:32 2007 -0500
summary: Create Action_ functions immediately. Quote $WMII_NORMCOLORS in Action_status

diff -r ed20ca19765e -r 8f704c707daf rc/wmiirc
--- a/rc/wmiirc Sun Feb 25 14:25:42 2007 -0500
+++ b/rc/wmiirc Sun Feb 25 14:59:32 2007 -0500
@@ -72,7 +72,7 @@ Action status
         if wmiir remove /rbar/status 2>/dev/null; then
                 sleep 2
         fi
- echo $WMII_NORMCOLORS | wmiir create /rbar/status
+ echo "$WMII_NORMCOLORS" | wmiir create /rbar/status
         while status | wmiir write /rbar/status; do
                 sleep 1
         done
@@ -142,7 +142,7 @@ actionlist() {
 }
 
 conf_which () {
- echo \$(PATH="$WMII_CONFPATH:$PATH" which \$1) "\$@"
+ echo \$({export PATH="$WMII_CONFPATH:$PATH"; which \$1}) "\$@"
 }
 
 tagsmenu() {
@@ -194,4 +194,4 @@ done
 # Stop any running instances of wmiirc
 echo Start wmiirc | wmiir write /event || exit 1
 
-} | wmiiloop | tee /dev/fd/2 | sh
+} | wmiiloop | sh
diff -r ed20ca19765e -r 8f704c707daf wmiiloop
--- a/wmiiloop Sun Feb 25 14:25:42 2007 -0500
+++ b/wmiiloop Sun Feb 25 14:59:32 2007 -0500
@@ -10,6 +10,7 @@ BEGIN {
         arg[1] = "Nop"
         writekeys = "wmiir write /keys"
         readevent = "wmiir read /event"
+ print "ACTIONS=\"\""
 }
 
 function addevent() {
@@ -20,7 +21,11 @@ function addevent() {
                 events[arg[2]] = body
         }
         else if(arg[1] == "Action") {
- actions[arg[2]] = body
+ action = arg[2];
+ actions[action] = body
+ gsub("\"", "\\\"", action)
+ print "ACTIONS=\"$ACTIONS\n" action "\""
+ print "Action_" action "() {" actions[action] "\n}"
         }
 }
 
@@ -37,12 +42,6 @@ END {
         for(key in keys)
                 print key | writekeys
         close(writekeys)
- print "ACTIONS=\"\""
- for(action in actions) {
- gsub("\"", "\\\"", action)
- print "ACTIONS=\"$ACTIONS\n" action "\""
- print "Action_" action "() {" actions[action] "\n}"
- }
         while(readevent | getline) {
                 split($0, arg)
                 sub("^[a-zA-Z]+[ \t]+", "")
Received on Sun Feb 25 2007 - 21:01:25 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:55:55 UTC