wmii

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

commit 2047d9f1abd5afeb846f9605a9356853d5841166
parent 5b3e057a96a73c3e0fb4bff00d357c29a50eb2e8
Author: Kris Maglione <jg@suckless.org>
Date:   Wed,  2 May 2007 16:46:26 -0400

Sync wmiirc and wmiiloop with -test. Fix dividers when making columns with the mouse.

Diffstat:
cmd/wmii/mouse.c | 2++
cmd/wmiiloop.awk | 35-----------------------------------
cmd/wmiiloop.sh | 49+++++++++++++++++++++++++++++++++++++++++++++++++
rc/wmiirc.sh | 39+++++++++++++++++++--------------------
4 files changed, 70 insertions(+), 55 deletions(-)

diff --git a/cmd/wmii/mouse.c b/cmd/wmii/mouse.c @@ -222,6 +222,7 @@ find_droppoint(Frame *frame, int x, int y, XRectangle *rect, Bool do_move) { a = new_column(v, a_prev, 0); send_to_area(a, frame); focus(frame->client, False); + focus_view(screen, v); } return; } @@ -231,6 +232,7 @@ find_droppoint(Frame *frame, int x, int y, XRectangle *rect, Bool do_move) { a = new_column(v, a, 0); send_to_area(a, frame); focus(frame->client, False); + focus_view(screen, v); } return; } diff --git a/cmd/wmiiloop.awk b/cmd/wmiiloop.awk @@ -1,35 +0,0 @@ -#!AWKPATH -f -BEGIN { - arg[1] = "Nop" - body = ""; - writekeys = "wmiir write /keys" - print "IFS=''" -} - -function addevent() { - if(arg[1] == "Key") - keys[arg[2]] = 1; - - var = arg[1] "s" - print var "=\"$" var " " arg[2] "\"" - - gsub("[^a-zA-Z_0-9]", "_", arg[2]); - if(body != "") - print arg[1] "_" arg[2] "() {" body "\n}" -} - -/^(Event|Key|Action)[ \t]/ { - addevent() - split($0, arg) - body = "" -} -/^[ \t]/ { - body = body"\n"$0 -} - -END { - addevent() - for(key in keys) - print key | writekeys; - close(writekeys); -} diff --git a/cmd/wmiiloop.sh b/cmd/wmiiloop.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +eval "text() { + cat <<! +$(sed '/^[[:blank:]]/s/\([$`]\)/\\\1/g') +! +}" + +script() { + cat <<'!' + BEGIN { + arg[1] = "Nop" + body = ""; + writekeys = "wmiir write /keys" + print "IFS=''" + } + + function addevent() { + if(arg[1] == "Key") + keys[arg[2]] = 1; + + var = arg[1] "s" + print var "=\"$" var " " arg[2] "\"" + + gsub("[^a-zA-Z_0-9]", "_", arg[2]); + if(body != "") + print arg[1] "_" arg[2] "() {" body "\n}" + } + + /^(Event|Key|Action)[ \t]/ { + addevent() + split($0, arg) + body = "" + } + /^[ \t]/ { + body = body"\n"$0 + } + + END { + addevent() + for(key in keys) + print key | writekeys; + close(writekeys); + } +! +} + +text | awk "`script`" + diff --git a/rc/wmiirc.sh b/rc/wmiirc.sh @@ -13,7 +13,7 @@ WMII_NORMCOLORS='#222222 #5FBF77 #2A7F3F' WMII_FOCUSCOLORS='#ffffff #153F1F #2A7F3F' WMII_BACKGROUND='#333333' -WMII_FONT='-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*' +WMII_FONT='-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*' set -- $(echo $WMII_NORMCOLORS $WMII_FOCUSCOLORS) WMII_MENU="dmenu -b -fn $WMII_FONT -nf $1 -nb $2 -sf $4 -sb $5" @@ -39,7 +39,8 @@ status() { } # Event processing -# processed later by `wmiiloop' and evaled +# Processed later by `wmiiloop' and evaled. +# Duplicate the eval line and replace 'eval' with 'echo' for details. eventstuff() { cat <<'!' # Events @@ -97,20 +98,12 @@ eventstuff() { Key $MODKEY-Control-t case $(wmiir read /keys | wc -l | tr -d ' \t\n') in 0|1) - echo -n $Keys | tr ' ' '\012' | wmiir write /keys + echo -n \$Keys | tr ' ' '\012' | wmiir write /keys wmiir xwrite /ctl grabmod $MODKEY;; *) wmiir xwrite /keys $MODKEY-Control-t wmiir xwrite /ctl grabmod Mod3;; esac - Key $MODKEY-$LEFT - wmiir xwrite /tag/sel/ctl select left - Key $MODKEY-$RIGHT - wmiir xwrite /tag/sel/ctl select right - Key $MODKEY-$DOWN - wmiir xwrite /tag/sel/ctl select down - Key $MODKEY-$UP - wmiir xwrite /tag/sel/ctl select up Key $MODKEY-space wmiir xwrite /tag/sel/ctl select toggle Key $MODKEY-d @@ -127,6 +120,20 @@ eventstuff() { wmiir xwrite /ctl "view $(tagsmenu)" & Key $MODKEY-Return $WMII_TERM & + Key $MODKEY-Shift-space + wmiir xwrite /tag/sel/ctl send sel toggle + Key $MODKEY-Shift-c + wmiir xwrite /client/sel/ctl kill + Key $MODKEY-Shift-t + wmiir xwrite "/client/$(wmiir read /client/sel/ctl)/tags" "$(tagsmenu)" & + Key $MODKEY-$LEFT + wmiir xwrite /tag/sel/ctl select left + Key $MODKEY-$RIGHT + wmiir xwrite /tag/sel/ctl select right + Key $MODKEY-$DOWN + wmiir xwrite /tag/sel/ctl select down + Key $MODKEY-$UP + wmiir xwrite /tag/sel/ctl select up Key $MODKEY-Shift-$LEFT wmiir xwrite /tag/sel/ctl send sel left Key $MODKEY-Shift-$RIGHT @@ -135,12 +142,6 @@ eventstuff() { wmiir xwrite /tag/sel/ctl send sel down Key $MODKEY-Shift-$UP wmiir xwrite /tag/sel/ctl send sel up - Key $MODKEY-Shift-space - wmiir xwrite /tag/sel/ctl send sel toggle - Key $MODKEY-Shift-c - wmiir xwrite /client/sel/ctl kill - Key $MODKEY-Shift-t - wmiir xwrite "/client/$(wmiir read /client/sel/ctl)/tags" "$(tagsmenu)" & ! for i in 0 1 2 3 4 5 6 7 8 9; do cat <<! @@ -162,9 +163,7 @@ border 1 EOF # Feed events to `wmiiloop' for processing -IFS='' -eval $(eventstuff | sed "s/\\\$MODKEY/$MODKEY/g;s/^[ ]//" | wmiiloop) -unset IFS +eval "$(eventstuff | sed 's/^[ ]//' | wmiiloop)" # Functions Action() {