changeset: 1993:e9e7dddcacff
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Sat Mar 03 17:51:46 2007 -0500
summary: Added wmii9menu to, and cleaned up rc/wmiirc. Fixed behavior after selection no item with wmii9menu in rc.wmii.
diff -r b477dc47352b -r e9e7dddcacff rc/rc.wmii
--- a/rc/rc.wmii Sat Mar 03 16:01:38 2007 -0500
+++ b/rc/rc.wmii Sat Mar 03 17:51:46 2007 -0500
@@ -81,11 +81,13 @@ fn Event-ClientMouseDown {
fn Event-ClientMouseDown {
client = $1; button = $2
if(~ $button 3) {
- menulast=`{9menu -initial $menulast Nop Delete}
- switch($menulast) {
+ do=`{9menu -initial $menulast Nop Delete}
+ switch($do) {
case Delete
wmiir xwrite /client/$client/ctl kill
}
+ if(! ~ $#do 0)
+ menulast = $do;
}
}
diff -r b477dc47352b -r e9e7dddcacff rc/wmiirc
--- a/rc/wmiirc Sat Mar 03 16:01:38 2007 -0500
+++ b/rc/wmiirc Sat Mar 03 17:51:46 2007 -0500
@@ -1,5 +1,6 @@
#!/bin/sh
# Configure wmii
+set -f
# Configuration Variables
MODKEY=Mod1
@@ -14,9 +15,14 @@ WMII_BACKGROUND='#333333'
WMII_BACKGROUND='#333333'
WMII_FONT='-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*'
+set -- $(echo $WMII_NORMCOLORS $WMII_FOCUSCOLORS)
+
+WMII_MENU="dmenu -b -fn $WMII_FONT -nf $1 -nb $2 -sf $4 -sb $5"
+WMII_9MENU="wmii9menu -font $WMII_FONT -nf $1 -nb $2 -sf $4 -sb $5 -br $6"
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
+
+export WMII_MENU WMII_9MENU WMII_FONT WMII_TERM
+export WMII_FOCUSCOLORS WMII_SELCOLORS WMII_NORMCOLORS
# Column Rules
wmiir write /colrules <<EOF
@@ -34,41 +40,42 @@ EOF
# Event processing
{
-cat <<EOF
+cat <<'EOF'
# Status Bar Info
status() {
- echo -n \$(uptime | sed 's/.*://; s/,//g') '|' \$(date)
+ echo -n $(uptime | sed 's/.*://; s/,//g') '|' $(date)
}
# Events
Event Start
- case "\$1" in
+ case "$1" in
wmiirc)
exit;;
exac
Event CreateTag
- echo "$WMII_NORMCOLORS" "\$@" | wmiir create "/lbar/\$@"
+ echo "$WMII_NORMCOLORS" "$@" | wmiir create "/lbar/$@"
Event DestroyTag
- wmiir remove "/lbar/\$@"
+ wmiir remove "/lbar/$@"
Event FocusTag
- wmiir xwrite "/lbar/\$@" "$WMII_FOCUSCOLORS" "\$@"
+ wmiir xwrite "/lbar/$@" "$WMII_FOCUSCOLORS" "$@"
Event UnfocusTag
- wmiir xwrite "/lbar/\$@" "$WMII_NORMCOLORS" "\$@"
+ wmiir xwrite "/lbar/$@" "$WMII_NORMCOLORS" "$@"
Event UrgentTag
shift
- wmiir xwrite "/lbar/\$@" "*\$@"
+ wmiir xwrite "/lbar/$@" "*$@"
Event NotUrgentTag
shift
- wmiir xwrite "/lbar/\$@" "\$@"
+ wmiir xwrite "/lbar/$@" "$@"
Event LeftBarClick
shift
- wmiir xwrite /ctl view "\$@"
+ wmiir xwrite /ctl view "$@"
# Actions
Action quit
wmiir xwrite /ctl quit
Action rehash
- proglist $PATH >\$PROGS_FILE
+ proglist $PATH >$PROGS_FILE
Action status
+ set +xv
if wmiir remove /rbar/status 2>/dev/null; then
sleep 2
fi
@@ -76,6 +83,19 @@ Action status
while status | wmiir write /rbar/status; do
sleep 1
done
+Event ClientMouseDown
+ client=$1; button=$2
+ case "$button" in
+ 3)
+ do=$($WMII_9MENU -initial "${menulast:-SomeRandomName}" Nop Delete)
+ case "$do" in
+ Delete)
+ wmiir xwrite /client/$client/ctl kill
+ esac
+ menulast=${do:-"$menulast"}
+ esac
+EOF
+cat <<EOF
# Key Bindings
Key $MODKEY-$LEFT
wmiir xwrite /tag/sel/ctl select left
@@ -94,9 +114,9 @@ Key $MODKEY-m
Key $MODKEY-m
wmiir xwrite /tag/sel/ctl colmode sel max
Key $MODKEY-a
- Action \$(actionlist | $WMII_MENU) &
+ Action \$(actionlist | \$WMII_MENU) &
Key $MODKEY-p
- sh -c "\$($WMII_MENU <\$PROGS_FILE)" &
+ sh -c "\$(\$WMII_MENU <\$PROGS_FILE)" &
Key $MODKEY-t
wmiir xwrite /ctl "view \$(tagsmenu)" &
Key $MODKEY-Return
@@ -125,37 +145,45 @@ EOF
EOF
done
-cat <<EOF
+cat <<'EOF'
# Functions
proglist() {
- paths=\$(echo "\$@" | sed 'y/:/ /')
- ls -lL \$paths 2>/dev/null |
- awk '\$1 ~ /^[^d].*x/ { print \$NF }' |
+ paths=$(echo "$@" | sed 'y/:/ /')
+ ls -lL $paths 2>/dev/null |
+ awk '$1 ~ /^[^d].*x/ { print $NF }' |
sort | uniq
}
actionlist() {
{
proglist $WMII_CONFPATH
- echo \$ACTIONS | tr ' ' '\012'
+ echo $ACTIONS | tr ' ' '\012'
} | sort | uniq
}
tagsmenu() {
- wmiir ls /tag | sed "s|/||; /^sel\$/d" | $WMII_MENU
+ wmiir ls /tag | sed "s|/||; /^sel$/d" | $WMII_MENU
+}
+
+conf_which() {
+ prog=$({PATH="$WMII_CONFPATH:$PATH" which $1})
+ shift
+ if [ -n "$prog" ]; then
+ $prog
+ fi
}
Action() {
- action=\$1; shift
- if [ -n "\$action" ]; then
- Action_\$action \$@ || PATH=$WMII_CONFPATH \$action \$@
+ action=$1; shift
+ if [ -n "$action" ]; then
+ Action_$action $@ || conf_which $action $@
fi
}
# Misc
PROGS_FILE="$WMII_NS_DIR/.proglist"
Action status &
-proglist $PATH >\$PROGS_FILE &
+proglist $PATH >$PROGS_FILE &
EOF
xsetroot -solid "$WMII_BACKGROUND" &
diff -r b477dc47352b -r e9e7dddcacff wmiiloop
--- a/wmiiloop Sat Mar 03 16:01:38 2007 -0500
+++ b/wmiiloop Sat Mar 03 17:51:46 2007 -0500
@@ -24,7 +24,7 @@ function addevent() {
action = arg[2];
actions[action] = body
gsub("\"", "\\\"", action)
- print "ACTIONS=\"$ACTIONS\n" action "\""
+ print "ACTIONS=\"$ACTIONS " action "\""
print "Action_" action "() {" actions[action] "\n}"
}
}
@@ -56,7 +56,6 @@ END {
body = events[arg[1]]
}
print "set -- " $0
- print "set +f"
print body
fflush()
}
Received on Sat Mar 03 2007 - 23:54:16 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:56:08 UTC