wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit c2e18957f9c58724ae8b0f5aefe0fba0d9fe21a2
parent 29995771554d4f8cdb3b7722e710b44b4e3f4587
Author: Kris Maglione <jg@suckless.org>
Date:   Mon, 21 Jan 2008 18:22:42 -0500

Sync wmiirc with rc.wmii.

Diffstat:
cmd/wmii.sh.sh | 26+++++++++++++++-----------
rc/rc.wmii.rc | 6++++--
rc/wmiirc.sh | 31++++++++++++++++++++++++++++---
3 files changed, 47 insertions(+), 16 deletions(-)

diff --git a/cmd/wmii.sh.sh b/cmd/wmii.sh.sh @@ -9,27 +9,31 @@ Keys="" Actions="" Events="" +wi_nl=' +' + _wi_script() { cat <<'!' BEGIN { arg[1] = "Nop" + narg = 1; body = ""; } function addevent() { - if(arg[1] == "Key") - keys[arg[2]] = 1; - var = arg[1] "s" - printf "%s=\"$%s\n%s\"\n", var, var, arg[2] - - gsub("[^a-zA-Z_0-9]", "_", arg[2]); - if(body != "") - printf "%s_%s() { %s\n }\n", arg[1], arg[2], body + for(i=2; i <= narg; i++) { + printf "%s=\"$%s\n%s\"\n", var, var, arg[i] + gsub("[^a-zA-Z_0-9]", "_", arg[i]); + if(body != "") { + printf "%s_%s() { %s\n }\n", arg[1], arg[i], body + body = sprintf("%s_%s \"$@\"", arg[1], arg[2]) + } + } } - /^(Event|Key|Action)[ \t]/ { addevent() split($0, arg) + narg = NF body = "" } /^[ \t]/ { @@ -129,8 +133,8 @@ wi_eventloop() { wmiir read /event | while read wi_event do - OIFS="$IFS"; IFS="$(echo)" - wi_args=$(echo "$wi_event" | sed 's/^[^ ]+ //') + OIFS="$IFS"; IFS="$wi_nl" + wi_arg=$(echo "$wi_event" | sed 's/^[^ ]* //') IFS="$OIFS" set -- $wi_event event=$1; shift diff --git a/rc/rc.wmii.rc b/rc/rc.wmii.rc @@ -71,9 +71,11 @@ fn Event-FocusTag { fn Event-UnfocusTag { wmiir xwrite /lbar/$"* $wmiinormcol $*} fn Event-UrgentTag { - shift; wmiir xwrite /lbar/$"* '*'$"*} + shift + wmiir xwrite /lbar/$"* '*'$"*} fn Event-NotUrgentTag { - shift; wmiir xwrite /lbar/$"* $"*} + shift + wmiir xwrite /lbar/$"* $"*} fn Event-Unresponsive { client = $1; shift diff --git a/rc/wmiirc.sh b/rc/wmiirc.sh @@ -9,6 +9,10 @@ DOWN=j LEFT=h RIGHT=l +# Bars +noticetimeout=5 +noticebar=/rbar/!notice + # Colors tuples: "<text> <background> <border>" WMII_NORMCOLORS='#000000 #c1c48b #81654f' WMII_FOCUSCOLORS='#000000 #81654f #000000' @@ -37,6 +41,8 @@ status() { echo -n $(uptime | sed 's/.*://; s/,//g') '|' $(date) } +echo $WMII_NORMCOLORS | wmiir create $noticebar + # Event processing wi_events -s ' ' <<'!' # Events @@ -54,9 +60,26 @@ wi_events -s ' ' <<'!' Event NotUrgentTag shift wmiir xwrite "/lbar/$@" "$@" - Event LeftBarClick + Event LeftBarClick LeftBarDND shift wmiir xwrite /ctl view "$@" + Event Unresponsive + { + client=$1; shift + msg="The following client is not responding. What would you like to do?$wi_nl" + resp=$(wihack -transient $client \ + xmessage -nearmouse -buttons Kill,Wait -print \ + "$msg $(wmiir read /client/sel/label)") + if [ "$resp" = Kill ]; then + wmiir xwrite /client/$client/ctl slay & + fi + }& + Event Notice + wmiir xwrite $noticebar $wi_arg + + kill $xpid 2>/dev/null # Let's hope this isn't reused... + { sleep $noticetimeout; wmiir xwrite $noticebar ' '; }& + xpid = $! # Actions Action quit wmiir xwrite /ctl quit @@ -166,8 +189,10 @@ Action status & wi_proglist $PATH >$progsfile & # Setup Tag Bar -(IFS="$(echo)"; wmiir rm $(wmiir ls /lbar | sed 's,^,/lbar/,')) -seltag="$(wmiir read /tag/sel/ctl | sed 1q)" +OIFS="$IFS"; IFS="$wi_nl" +wmiir rm $(wmiir ls /lbar | sed 's,^,/lbar/,') +seltag=$(wmiir read /tag/sel/ctl | sed 1q) +IFS="$OIFS" wi_tags | while read tag do if [ "$tag" = "$seltag" ]; then