[hackers] [wmii] Fix wmiirc in shells with POSIX emulation modes.

From: Kris Maglione <jg_AT_suckless.org>
Date: Wed Mar 07 22:13:13 2007

changeset: 2009:a73826e9a6a2
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Wed Mar 07 16:08:19 2007 -0500
summary: Fix wmiirc in shells with POSIX emulation modes.

diff -r 52d79cd76fa4 -r a73826e9a6a2 rc/wmiirc
--- a/rc/wmiirc Wed Mar 07 14:01:02 2007 -0500
+++ b/rc/wmiirc Wed Mar 07 16:08:19 2007 -0500
@@ -43,9 +43,8 @@ status() {
         echo -n $(uptime | sed 's/.*://; s/,//g') '|' $(date)
 }
 
-IFS=''
-eval $({
-cat <<'EOF'
+eventstuff() {
+ cat <<'EOF'
 # Events
 Event Start
         case "$1" in
@@ -98,7 +97,7 @@ Event ClientMouseDown
                 menulast=${do:-"$menulast"}
         esac
 EOF
-cat <<EOF
+ cat <<EOF
 # Key Bindings
 Key $MODKEY-$LEFT
         wmiir xwrite /tag/sel/ctl select left
@@ -139,15 +138,18 @@ Key $MODKEY-Shift-t
 Key $MODKEY-Shift-t
         wmiir xwrite "/client/\$(wmiir read /client/sel/ctl)/tags" "\$(tagsmenu)" &
 EOF
-for i in 0 1 2 3 4 5 6 7 8 9; do
- cat << EOF
+ for i in 0 1 2 3 4 5 6 7 8 9; do
+ cat << EOF
 Key $MODKEY-$i
         wmiir xwrite /ctl view "$i"
 Key $MODKEY-Shift-$i
         wmiir xwrite /client/sel/tags "$i"
 EOF
-done
-} | wmiiloop)
+ done
+}
+
+IFS=''
+eval $(eventstuff | wmiiloop)
 unset IFS
 
 # Functions
diff -r 52d79cd76fa4 -r a73826e9a6a2 wmiiloop
--- a/wmiiloop Wed Mar 07 14:01:02 2007 -0500
+++ b/wmiiloop Wed Mar 07 16:08:19 2007 -0500
@@ -1,6 +1,7 @@
 #!AWKPATH -f
 BEGIN {
         arg[1] = "Nop"
+ body = "";
         writekeys = "wmiir write /keys"
         print "IFS=''"
 }
@@ -13,7 +14,8 @@ function addevent() {
         print var "=\"$" var " " arg[2] "\""
 
         gsub("[^a-zA-Z_0-9]", "_", arg[2]);
- print arg[1] "_" arg[2] "() {" body "\n}"
+ if(body != "")
+ print arg[1] "_" arg[2] "() {" body "\n}"
 }
 
 /^(Event|Key|Action)[ \t]/ {
Received on Wed Mar 07 2007 - 22:13:13 UTC

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