From c9e73feae3f2f452cbca92193cc297276b36d59f Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 30 Aug 2012 19:34:40 -0400 Subject: fix 2 bugs in wmiirc --- .wmii/wmiirc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to '.wmii/wmiirc') diff --git a/.wmii/wmiirc b/.wmii/wmiirc index 82c424b..92adb8b 100755 --- a/.wmii/wmiirc +++ b/.wmii/wmiirc @@ -47,7 +47,8 @@ Event() { # might complain about /etc/mtab if the x server has already stopped fusermount -u "$WMII_DIR" 2>>/dev/null echo " -> rmdir'ing WMII_DIR=$WMII_DIR..." - rmdir "$WMII_DIR";; + rmdir "$WMII_DIR" + exit;; Warning) ## $@=string notify-send "wmii warning: $*";; Key) ## $1=keystroke @@ -226,7 +227,7 @@ Key() { sel=$(sed 1q $WMII_DIR/client/sel/ctl) { tag=$(lstags | wimenu -h "${hist}.tags" -n 50) || return - wmiir xwrite /client/$sel/tags $tag + wmiir xwrite /client/$sel/tags "$tag" }& ;; esac } ## End Key -- cgit v1.2.3-2-g168b From 4493d30ac4c747b08b2107a440084245a9157bd4 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 15 Oct 2012 12:48:36 -0400 Subject: wmii: use 9mount --- .wmii/wmiirc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to '.wmii/wmiirc') diff --git a/.wmii/wmiirc b/.wmii/wmiirc index 92adb8b..8d77394 100755 --- a/.wmii/wmiirc +++ b/.wmii/wmiirc @@ -5,9 +5,8 @@ wmiir xwrite /event Start . "$HOME/.wmii/include.sh" echo ' ==> Starting wmiirc' -mount9p=/opt/plan9/bin/9pfuse -mkdir -p $WMII_NAMESPACE/mnt -$mount9p $WMII_NAMESPACE/{wmii,mnt} +mkdir -p "$WMII_DIR" +9mount -i "unix!$WMII_NAMESPACE/wmii" "$WMII_DIR" MODKEY=Mod4 # super UP=p @@ -45,7 +44,7 @@ Event() { echo ' ==> Stopping wmiirc' echo " -> unmounting WMII_DIR=$WMII_DIR..." # might complain about /etc/mtab if the x server has already stopped - fusermount -u "$WMII_DIR" 2>>/dev/null + 9umount "$WMII_DIR" echo " -> rmdir'ing WMII_DIR=$WMII_DIR..." rmdir "$WMII_DIR" exit;; -- cgit v1.2.3-2-g168b From f5f19ca8e8d46ba1087f8531e2309ac392c24112 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 15 Oct 2012 14:33:31 -0400 Subject: wmii: phase out wmiir --- .wmii/wmiirc | 84 ++++++++++++++++++++++++++---------------------------------- 1 file changed, 36 insertions(+), 48 deletions(-) (limited to '.wmii/wmiirc') diff --git a/.wmii/wmiirc b/.wmii/wmiirc index 8d77394..1e88128 100755 --- a/.wmii/wmiirc +++ b/.wmii/wmiirc @@ -84,9 +84,9 @@ Event() { { case `wmii9menu Delete Fullscreen` in Delete) - echo kill |a $WMII_DIR/client/$client/ctl;; + echo kill >> $WMII_DIR/client/$client/ctl;; Fullscreen) - echo Fullscreen on |a $WMII_DIR/client/$1/ctl;; + echo Fullscreen on >> $WMII_DIR/client/$1/ctl;; esac }& ;; esac;; @@ -101,7 +101,7 @@ Event() { resp=$(wihack -transient $client \ xmessage -nearmouse -buttons Kill,Wait -print "$msg") if [ "$resp" = Kill ]; then - echo slay |a $WMII_DIR/client/$client/ctl + echo slay >> $WMII_DIR/client/$client/ctl fi }& ;; Fullscreen) ## $1=client $2=[on|off] @@ -110,24 +110,24 @@ Event() { ## Tag events CreateTag) ## $1=tag - echo "$WMII_NORMCOLORS" $@ |a $WMII_DIR/lbar/$1;; + echo "$WMII_NORMCOLORS" $@ >> $WMII_DIR/lbar/$1;; DestroyTag) ## $1=tag rm $WMII_DIR/lbar/$1;; FocusTag) ## $1=tag - echo "$WMII_FOCUSCOLORS" $1 |a $WMII_DIR/lbar/$1;; + echo "$WMII_FOCUSCOLORS" $1 >> $WMII_DIR/lbar/$1;; UnfocusTag) ## $1=tag - echo "$WMII_NORMCOLORS" $1 |a $WMII_DIR/lbar/$1;; + echo "$WMII_NORMCOLORS" $1 >> $WMII_DIR/lbar/$1;; UrgentTag) ## $1=tag $2=[Manager|Client] - echo "$WMII_URGENTCOLORS" $1 |a $WMII_DIR/lbar/$1;; + echo "$WMII_URGENTCOLORS" $1 >> $WMII_DIR/lbar/$1;; NotUrgentTag) ## $1=tag $2=[Manager|Client] - echo "$WMII_NORMCOLORS" $1 |a $WMII_DIR/lbar/$1;; + echo "$WMII_NORMCOLORS" $1 >> $WMII_DIR/lbar/$1;; ## LeftBar events (usually tag buttons) LeftBarMouseDown) ## $1=button $2=bar_item ;; LeftBarClick) ## $1=button $2=bar_item shift # ignore the button - echo view "$@" |a $WMII_DIR/ctl;; + echo view "$@" >> $WMII_DIR/ctl;; LeftMouseDND) ## $1=button $2=bar_item Event LeftBarClick "$@";; @@ -152,50 +152,49 @@ Key() { ## Moving around $MODKEY-$LEFT) ## Select the client to the left - echo select left |a $WMII_DIR/tag/sel/ctl;; + echo select left >> $WMII_DIR/tag/sel/ctl;; $MODKEY-$RIGHT) ## Select the client to the right - echo select right |a $WMII_DIR/tag/sel/ctl;; + echo select right >> $WMII_DIR/tag/sel/ctl;; $MODKEY-$UP) ## Select the client above - echo select up |a $WMII_DIR/tag/sel/ctl;; + echo select up >> $WMII_DIR/tag/sel/ctl;; $MODKEY-$DOWN) ## Select the client below - echo select down |a $WMII_DIR/tag/sel/ctl;; + echo select down >> $WMII_DIR/tag/sel/ctl;; $MODKEY-space) ## Toggle between floating and managed layers - echo select toggle |a $WMII_DIR/tag/sel/ctl;; + echo select toggle >> $WMII_DIR/tag/sel/ctl;; ## Moving clients around $MODKEY-Shift-$LEFT) ## Move selected client to the left - wmiir xwrite /tag/sel/ctl send sel left;; + echo send sel left >> $WMII_DIR/tag/sel/ctl;; $MODKEY-Shift-$RIGHT) ## Move selected client to the right - wmiir xwrite /tag/sel/ctl send sel right;; + echo send sel right >> $WMII_DIR/tag/sel/ctl;; $MODKEY-Shift-$UP) ## Move selected client up - wmiir xwrite /tag/sel/ctl send sel up;; + echo send sel up >> $WMII_DIR/tag/sel/ctl;; $MODKEY-Shift-$DOWN) ## Move selected client down - wmiir xwrite /tag/sel/ctl send sel down;; - + echo send sel down >> $WMII_DIR/tag/sel/ctl;; $MODKEY-Shift-space) ## Toggle selected client between floating and managed layers - wmiir xwrite /tag/sel/ctl send sel toggle;; + echo send sel toggle >> $WMII_DIR/tag/sel/ctl;; ## Moving through stacks $MODKEY-Control-$UP) ## Select the stack above - wmiir xwrite /tag/sel/ctl select up stack;; - $MODKEY-Control-$DOWN) # Select the stack below - wmiir xwrite /tag/sel/ctl select down stack;; + echo select up stack >> $WMII_DIR/tag/sel/ctl;; + $MODKEY-Control-$DOWN) ## Select the stack below + echo select down stack >> $WMII_DIR/tag/sel/ctl;; ## Client actions $MODKEY-shift-1) ## Toggle selected client's fullsceen state - wmiir xwrite /client/sel/ctl Fullscreen toggle;; + echo Fullscreen toggle >> $WMII_DIR/client/sel/ctl;; $MODKEY-shift-0) ## Close client - wmiir xwrite /client/sel/ctl kill;; + echo kill >> $WMII_DIR/client/sel/ctl;; ## Changing column modes $MODKEY-d) ## Set column to default mode - wmiir xwrite /tag/sel/ctl colmode sel default-max;; + echo colmode sel default-max >> $WMII_DIR/tag/sel/ctl;; $MODKEY-s) ## Set column to stack mode - wmiir xwrite /tag/sel/ctl colmode sel stack-max;; + echo colmode sel stack-max >> $WMII_DIR/tag/sel/ctl;; $MODKEY-m) ## Set column to max mode - wmiir xwrite /tag/sel/ctl colmode sel stack+max;; + echo colmode sel stack+max >> $WMII_DIR/tag/sel/ctl;; ## Running programs $MODKEY-a) ## Open wmii actions menu @@ -205,44 +204,33 @@ Key() { $MODKEY-Return) ## Launch a terminal setsid x-terminal-emulator & ;; - ## Other - $MODKEY-Control-t) ## Toggle all other key bindings - case $(wmiir read /keys | wc -l | tr -d ' \t\n') in - 0|1) - echo -n "$Keys" | wmiir write /keys - wmiir xwrite /ctl grabmod $MODKEY;; - *) - wmiir xwrite /keys $MODKEY-Control-t - wmiir xwrite /ctl grabmod Mod3;; - esac;; - ## Tag actions $MODKEY-t) ## Change to another tag { tag=$(lstags | wimenu -h "${hist}.tags" -n 50) || return - wmiir xwrite /ctl view $tag + echo view $tag >> $WMII_DIR/ctl }& ;; $MODKEY-Shift-t) ## Retag the selected client sel=$(sed 1q $WMII_DIR/client/sel/ctl) { tag=$(lstags | wimenu -h "${hist}.tags" -n 50) || return - wmiir xwrite /client/$sel/tags "$tag" + echo "$tag" >> $WMII_DIR/client/$sel/tags }& ;; esac } ## End Key # WM Configuration -echo font xft:Monospace-8 |a $WMII_DIR/ctl -echo focuscolors $WMII_FOCUSCOLORS |a $WMII_DIR/ctl -echo normcolors $WMII_NORMCOLORS |a $WMII_DIR/ctl -echo grabmod $MODKEY |a $WMII_DIR/ctl -echo border 1 |a $WMII_DIR/ctl +echo font xft:Monospace-8 >> $WMII_DIR/ctl +echo focuscolors $WMII_FOCUSCOLORS >> $WMII_DIR/ctl +echo normcolors $WMII_NORMCOLORS >> $WMII_DIR/ctl +echo grabmod $MODKEY >> $WMII_DIR/ctl +echo border 1 >> $WMII_DIR/ctl xsetroot -solid "$WMII_BACKGROUND" & progsfile=$WMII_NAMESPACE/.proglist path_ls $PATH > $progsfile & -eval arg `scansection Key|cut -sf2` |a $WMII_DIR/keys +eval arg `scansection Key|cut -sf2` >> $WMII_DIR/keys # Clear the LBar find $WMII_DIR/lbar -type f -delete @@ -265,6 +253,6 @@ fi trap "Event Quit" EXIT # use wmiir so it doesn't look like an open file -wmiir read /event 2>/dev/null | while read event; do +wmiir read /event | while read event; do Event $event done -- cgit v1.2.3-2-g168b From 4414160a4cce0080f3f2b33f9e7a7583c77c7062 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 15 Oct 2012 17:36:00 -0400 Subject: wmii: refactor --- .wmii/wmiirc | 257 ++--------------------------------------------------------- 1 file changed, 8 insertions(+), 249 deletions(-) (limited to '.wmii/wmiirc') diff --git a/.wmii/wmiirc b/.wmii/wmiirc index 1e88128..c513cd1 100755 --- a/.wmii/wmiirc +++ b/.wmii/wmiirc @@ -1,258 +1,17 @@ #!/bin/bash -# Let any running instances of wmiirc know that we're starting -wmiir xwrite /event Start - . "$HOME/.wmii/include.sh" -echo ' ==> Starting wmiirc' -mkdir -p "$WMII_DIR" -9mount -i "unix!$WMII_NAMESPACE/wmii" "$WMII_DIR" - -MODKEY=Mod4 # super -UP=p -DOWN=n -LEFT=b -RIGHT=f - -# Colors tuples: " " -. `conffile theme-solarized-dark` - -# Menu history -hist="`conffile history`" - -# Tagging Rules -echo '/Emacs|Navigator/ -> +sel' >> $WMII_DIR/tagrules -echo '/Eclipse/ -> +sel' >> $WMII_DIR/tagrules -echo '/panel/ -> /.*/' >> $WMII_DIR/tagrules - -Event() { - event=$1; shift; - case "$event" in - ## Mouse event meanings: - ## MouseDown = mouse down - ## Click = mouse up - ## DND = hover, while dragging something (Drag 'n' Drop) - ## The associated mouse button is always "1" - ## - ## Mouse-button IDs: - ## 1 = left - ## 2 = middle - ## 3 = right - - ## WMII-meta events - Quit) ## No args - echo ' ==> Stopping wmiirc' - echo " -> unmounting WMII_DIR=$WMII_DIR..." - # might complain about /etc/mtab if the x server has already stopped - 9umount "$WMII_DIR" - echo " -> rmdir'ing WMII_DIR=$WMII_DIR..." - rmdir "$WMII_DIR" - exit;; - Warning) ## $@=string - notify-send "wmii warning: $*";; - Key) ## $1=keystroke - Key "$@";; - - ## WMII Window management events - FocusFloating) ## No args - ;; - AreaFocus) ## $1=area - ;; - DestroyArea) ## $1=area - ;; - ColumnFocus) ## $1=column - ;; - CreateColumn) ## $1=column - ;; - - ## Client events - CreateClient) ## $1=client - ;; - DestroyClient) ## $1=client - ;; - Urgent) ## $1=client $2=[Manager|Client] - ;; - NotUrgent) ## $1=client $2=[Manager|Client] - ;; - ClientMouseDown) ## $1=client $2=button - client=$1 - button=$2 - case $button in - 1) ;; - 2) ;; - 3) - { - case `wmii9menu Delete Fullscreen` in - Delete) - echo kill >> $WMII_DIR/client/$client/ctl;; - Fullscreen) - echo Fullscreen on >> $WMII_DIR/client/$1/ctl;; - esac - }& ;; - esac;; - ClientClick) ## $1=client $2=button - ;; - Unresponsive) ## $1=client - client=$1 - client_name=`cat $WMII_DIR/client/$client/label` - msg="The client \`${client_name}' is not responding." - msg+=" What would you like to do?" - { - resp=$(wihack -transient $client \ - xmessage -nearmouse -buttons Kill,Wait -print "$msg") - if [ "$resp" = Kill ]; then - echo slay >> $WMII_DIR/client/$client/ctl - fi - }& ;; - Fullscreen) ## $1=client $2=[on|off] - # TODO: hide any clients with the 'panel' class - ;; - - ## Tag events - CreateTag) ## $1=tag - echo "$WMII_NORMCOLORS" $@ >> $WMII_DIR/lbar/$1;; - DestroyTag) ## $1=tag - rm $WMII_DIR/lbar/$1;; - FocusTag) ## $1=tag - echo "$WMII_FOCUSCOLORS" $1 >> $WMII_DIR/lbar/$1;; - UnfocusTag) ## $1=tag - echo "$WMII_NORMCOLORS" $1 >> $WMII_DIR/lbar/$1;; - UrgentTag) ## $1=tag $2=[Manager|Client] - echo "$WMII_URGENTCOLORS" $1 >> $WMII_DIR/lbar/$1;; - NotUrgentTag) ## $1=tag $2=[Manager|Client] - echo "$WMII_NORMCOLORS" $1 >> $WMII_DIR/lbar/$1;; - - ## LeftBar events (usually tag buttons) - LeftBarMouseDown) ## $1=button $2=bar_item - ;; - LeftBarClick) ## $1=button $2=bar_item - shift # ignore the button - echo view "$@" >> $WMII_DIR/ctl;; - LeftMouseDND) ## $1=button $2=bar_item - Event LeftBarClick "$@";; - - ## RightBar events - RightBarMouseDown) ## $1=button $2=bar_item - ;; - RightBarClick) ## $1=button $2=bar_item - ;; - RightMouseDND) ## $1=button $2=bar_item - Event RightBarClick "$@";; - - ## Custom (non-WMII-generated) events - Start) ## No args - Event Quit;; # get out of the way for a new event loop - esac -} ## End Event - -# Key Bindings -Key() { - key=$1 - case "$key" in - ## Moving around - - $MODKEY-$LEFT) ## Select the client to the left - echo select left >> $WMII_DIR/tag/sel/ctl;; - $MODKEY-$RIGHT) ## Select the client to the right - echo select right >> $WMII_DIR/tag/sel/ctl;; - $MODKEY-$UP) ## Select the client above - echo select up >> $WMII_DIR/tag/sel/ctl;; - $MODKEY-$DOWN) ## Select the client below - echo select down >> $WMII_DIR/tag/sel/ctl;; - - $MODKEY-space) ## Toggle between floating and managed layers - echo select toggle >> $WMII_DIR/tag/sel/ctl;; - - ## Moving clients around - - $MODKEY-Shift-$LEFT) ## Move selected client to the left - echo send sel left >> $WMII_DIR/tag/sel/ctl;; - $MODKEY-Shift-$RIGHT) ## Move selected client to the right - echo send sel right >> $WMII_DIR/tag/sel/ctl;; - $MODKEY-Shift-$UP) ## Move selected client up - echo send sel up >> $WMII_DIR/tag/sel/ctl;; - $MODKEY-Shift-$DOWN) ## Move selected client down - echo send sel down >> $WMII_DIR/tag/sel/ctl;; - $MODKEY-Shift-space) ## Toggle selected client between floating and managed layers - echo send sel toggle >> $WMII_DIR/tag/sel/ctl;; - - ## Moving through stacks - $MODKEY-Control-$UP) ## Select the stack above - echo select up stack >> $WMII_DIR/tag/sel/ctl;; - $MODKEY-Control-$DOWN) ## Select the stack below - echo select down stack >> $WMII_DIR/tag/sel/ctl;; - - ## Client actions - $MODKEY-shift-1) ## Toggle selected client's fullsceen state - echo Fullscreen toggle >> $WMII_DIR/client/sel/ctl;; - $MODKEY-shift-0) ## Close client - echo kill >> $WMII_DIR/client/sel/ctl;; - - ## Changing column modes - $MODKEY-d) ## Set column to default mode - echo colmode sel default-max >> $WMII_DIR/tag/sel/ctl;; - $MODKEY-s) ## Set column to stack mode - echo colmode sel stack-max >> $WMII_DIR/tag/sel/ctl;; - $MODKEY-m) ## Set column to max mode - echo colmode sel stack+max >> $WMII_DIR/tag/sel/ctl;; - - ## Running programs - $MODKEY-a) ## Open wmii actions menu - Action $(path_ls $WMII_CONFPATH | wimenu -h "${hist}.actions" -n 5000) & ;; - $MODKEY-x) ## Open program menu - setsid $(wimenu -h "${hist}.progs" -n 5000 <$progsfile) & ;; - $MODKEY-Return) ## Launch a terminal - setsid x-terminal-emulator & ;; - - ## Tag actions - $MODKEY-t) ## Change to another tag - { - tag=$(lstags | wimenu -h "${hist}.tags" -n 50) || return - echo view $tag >> $WMII_DIR/ctl - }& ;; - $MODKEY-Shift-t) ## Retag the selected client - sel=$(sed 1q $WMII_DIR/client/sel/ctl) - { - tag=$(lstags | wimenu -h "${hist}.tags" -n 50) || return - echo "$tag" >> $WMII_DIR/client/$sel/tags - }& ;; - esac -} ## End Key - -# WM Configuration -echo font xft:Monospace-8 >> $WMII_DIR/ctl -echo focuscolors $WMII_FOCUSCOLORS >> $WMII_DIR/ctl -echo normcolors $WMII_NORMCOLORS >> $WMII_DIR/ctl -echo grabmod $MODKEY >> $WMII_DIR/ctl -echo border 1 >> $WMII_DIR/ctl -xsetroot -solid "$WMII_BACKGROUND" & - -progsfile=$WMII_NAMESPACE/.proglist -path_ls $PATH > $progsfile & - -eval arg `scansection Key|cut -sf2` >> $WMII_DIR/keys - -# Clear the LBar -find $WMII_DIR/lbar -type f -delete - -# Emulate [Create|Focus]Tag events -seltag=`sed 1q $WMII_DIR/tag/sel/ctl` -lstags | while read tag; do - Event CreateTag "$tag" - if [ "$tag" = "$seltag" ]; then - Event FocusTag "$tag" - fi -done - -Action autostart 2>/dev/null & +# Let any running instances of wmiirc know that we're starting +PIDFILE=$WMII_NAMESPACE/.wmii.pid +echo $$ > $PIDFILE -if [ -f "`conffile wmiirc_local`" ]; then - . "`conffile wmiirc_local`" -fi +Event WmiircStart trap "Event Quit" EXIT # use wmiir so it doesn't look like an open file -wmiir read /event | while read event; do - Event $event +wmiir read /event 2>/dev/null | while read event; do + [[ $$ = $(cat $PIDFILE) ]] && Event $event done + +Event WmiircQuit -- cgit v1.2.3-2-g168b From b18a02654e2c8b4a91f7c97352b75464e24c6edb Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 15 Oct 2012 18:59:31 -0400 Subject: wmii: redo the mount/unmount and quit code --- .wmii/wmiirc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to '.wmii/wmiirc') diff --git a/.wmii/wmiirc b/.wmii/wmiirc index c513cd1..1f1ea18 100755 --- a/.wmii/wmiirc +++ b/.wmii/wmiirc @@ -1,17 +1,12 @@ #!/bin/bash . "$HOME/.wmii/include.sh" -# Let any running instances of wmiirc know that we're starting -PIDFILE=$WMII_NAMESPACE/.wmii.pid -echo $$ > $PIDFILE +wmiir xwrite /event WmiircQuit # close any existing wmiirc's Event WmiircStart trap "Event Quit" EXIT -# use wmiir so it doesn't look like an open file wmiir read /event 2>/dev/null | while read event; do - [[ $$ = $(cat $PIDFILE) ]] && Event $event + Event $event done - -Event WmiircQuit -- cgit v1.2.3-2-g168b