commit 2da0d1b75d6a9a63e4a6bdaba124223e8bbf592f
parent f56a70589e555e8b9dfd14fab357b19abbfcbbaf
Author: Kris Maglione <jg@suckless.org>
Date: Thu, 22 Feb 2007 19:07:58 -0500
More wmiiloop/newrc updates.
Diffstat:
| rc/newrc | | | 76 | ++++++++++++++++++++++++++++++++++++++++------------------------------------ |
| wmiiloop | | | 9 | +++------ |
| wmiiloop.1 | | | 4 | ++-- |
3 files changed, 45 insertions(+), 44 deletions(-)
diff --git a/rc/newrc b/rc/newrc
@@ -8,26 +8,16 @@ DOWN=j
LEFT=h
RIGHT=l
-WMII_FONT='-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*'
# Colors tuples are "<text> <background> <border>"
WMII_NORMCOLORS='#222222 #5FBF77 #2A7F3F'
WMII_FOCUSCOLORS='#ffffff #153F1F #2A7F3F'
WMII_BACKGROUND='#333333'
+WMII_FONT='-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*'
-WMII_MENU="dmenu -b -fn '$WMII_FONT' -nb '#5FBF77' -nf '#222222' -sb '#153F1F' -sf '#ffffff'"
WMII_TERM="xterm"
-
+WMII_MENU="dmenu -b -fn '$WMII_FONT' -nb '#5FBF77' -nf '#222222' -sb '#153F1F' -sf '#ffffff'"
export WMII_MENU WMII_FONT WMII_FOCUSCOLORS WMII_SELCOLORS WMII_NORMCOLORS WMII_TERM
-# WM Configuration
-wmiir write /ctl << EOF
-font $WMII_FONT
-focuscolors $WMII_FOCUSCOLORS
-normcolors $WMII_NORMCOLORS
-grabmod $MODKEY
-border 1
-EOF
-
# Column Rules
wmiir write /colrules <<EOF
/.*/ -> 58+42
@@ -42,28 +32,9 @@ wmiir write /tagrules <<EOF
/.*/ -> 1
EOF
-# Stop any running instances of wmiirc
-echo Start wmiirc | wmiir write /event || exit 1
-
-# Setup Tag Bar
-wmiir ls /lbar |
-while read bar
-do
- wmiir remove "/lbar/$bar"
-done
-
-seltag="$(wmiir read /tag/sel/ctl 2>/dev/null)"
-wmiir ls /tag | sed -e 's|/||; /^sel$/d' |
-while read tag
-do
- if [ "X$tag" = "X$seltag" ]; then
- echo "$WMII_FOCUSCOLORS" "$tag" | wmiir create "/lbar/$tag"
- else
- echo "$WMII_NORMCOLORS" "$tag" | wmiir create "/lbar/$tag"
- fi
-done
-
-{ cat <<EOF
+# Event processing
+{
+cat <<EOF
# Status Bar Info
status() {
echo -n \$(uptime | sed 's/.*://; s/,//g') '|' \$(date)
@@ -92,6 +63,7 @@ Event NotUrgentTag
Event LeftBarClick
shift
wmiir xwrite /ctl view "\$@"
+# Actions
Action quit
wmiir xwrite /ctl quit
Action rehash
@@ -104,6 +76,7 @@ Action status
while status | wmiir write /rbar/status; do
sleep 1
done
+# Key Bindings
Key $MODKEY-$LEFT
wmiir xwrite /tag/sel/ctl select left
Key $MODKEY-$RIGHT
@@ -187,8 +160,39 @@ Action() {
# Misc
PROGS_FILE="$WMII_NS_DIR/.proglist"
Action status &
-xsetroot -solid "$WMII_BACKGROUND" &
proglist $PATH >$PROGS_FILE &
EOF
-} | wmiiloop | sh
+xsetroot -solid "$WMII_BACKGROUND" &
+
+# WM Configuration
+wmiir write /ctl << EOF
+font $WMII_FONT
+focuscolors $WMII_FOCUSCOLORS
+normcolors $WMII_NORMCOLORS
+grabmod $MODKEY
+border 1
+EOF
+
+# Setup Tag Bar
+wmiir ls /lbar |
+while read bar
+do
+ wmiir remove "/lbar/$bar"
+done
+
+seltag="$(wmiir read /tag/sel/ctl 2>/dev/null)"
+wmiir ls /tag | sed -e 's|/||; /^sel$/d' |
+while read tag
+do
+ if [ "X$tag" = "X$seltag" ]; then
+ echo "$WMII_FOCUSCOLORS" "$tag" | wmiir create "/lbar/$tag"
+ else
+ echo "$WMII_NORMCOLORS" "$tag" | wmiir create "/lbar/$tag"
+ fi
+done
+
+# Stop any running instances of wmiirc
+echo Start wmiirc | wmiir write /event || exit 1
+
+} | wmiiloop | tee /dev/fd/2 | sh
diff --git a/wmiiloop b/wmiiloop
@@ -1,13 +1,10 @@
-#!/usr/bin/awk
-// && !begin, /# Events/ {
+#!/usr/bin/awk -f
+/^#/ && $2 !~ /^Events|Actions|Key$/ || !begin, \
+/^#/ && $2 ~ /^(Events|Actions|Key)$/ {
begin = 1
print
next
}
-/^#/ && $2 != "Events", 0 {
- print
- next
-}
BEGIN {
arg[1] = "Nop"
diff --git a/wmiiloop.1 b/wmiiloop.1
@@ -20,8 +20,8 @@ syntax to simplify writing a wmii event loop.
.B eventloop
sends any text up to the first line containing
.I #
-.IR Events ,
-and any text after any line begining with
+.IR Events|Actions|Key ,
+and any text after any other line begining with
.IR # ,
directly to its standard output. Any other line is processed based
on its first word, with every indented line after it taken as its