diff --git a/rc/rc.wmii b/rc/rc.wmii index bd80442c..ec3e92a0 100755 --- a/rc/rc.wmii +++ b/rc/rc.wmii @@ -81,11 +81,13 @@ menulast = '' 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 --git a/rc/wmiirc b/rc/wmiirc index 011d857d..3e3b82f5 100644 --- a/rc/wmiirc +++ b/rc/wmiirc @@ -1,5 +1,6 @@ #!/bin/sh # Configure wmii +set -f # Configuration Variables MODKEY=Mod1 @@ -14,9 +15,14 @@ WMII_FOCUSCOLORS='#ffffff #153F1F #2A7F3F' 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 <\$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 </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 --git a/wmiiloop b/wmiiloop index 45ef19eb..e9a20650 100644 --- a/wmiiloop +++ b/wmiiloop @@ -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() }