[hackers] [wmii] Add support for sh.wmii.local.

From: Kris Maglione <jg_AT_suckless.org>
Date: Tue Jun 26 23:02:32 2007

changeset: 2166:896a3ea2651d
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Tue Jun 26 17:01:47 2007 -0400
summary: Add support for sh.wmii.local.

diff -r 8d79cae4cb0e -r 896a3ea2651d cmd/wmii/dat.h
--- a/cmd/wmii/dat.h Tue Jun 26 14:16:22 2007 -0400
+++ b/cmd/wmii/dat.h Tue Jun 26 17:01:47 2007 -0400
@@ -42,7 +42,7 @@ enum {
         CurNormal,
         CurNECorner, CurNWCorner, CurSECorner, CurSWCorner,
         CurDHArrow, CurMove, CurInput, CurSizing, CurIcon,
- CurInvisible,
+ CurNone,
         CurLast
 };
 
diff -r 8d79cae4cb0e -r 896a3ea2651d cmd/wmii/main.c
--- a/cmd/wmii/main.c Tue Jun 26 14:16:22 2007 -0400
+++ b/cmd/wmii/main.c Tue Jun 26 17:01:47 2007 -0400
@@ -177,7 +177,7 @@ init_cursors(void) {
                         display, scr.root.w,
                         (char[]){0}, 1, 1);
 
- cursor[CurInvisible] = XCreatePixmapCursor(display,
+ cursor[CurNone] = XCreatePixmapCursor(display,
                         pix, pix,
                         &black, &black,
                         0, 0);
diff -r 8d79cae4cb0e -r 896a3ea2651d cmd/wmii/mouse.c
--- a/cmd/wmii/mouse.c Tue Jun 26 14:16:22 2007 -0400
+++ b/cmd/wmii/mouse.c Tue Jun 26 17:01:47 2007 -0400
@@ -535,7 +535,7 @@ mouse_resizecol(Divide *d) {
         cwin = createwindow(&scr.root, r, 0, InputOnly, &wa, 0);
         mapwin(cwin);
 
- if(!grabpointer(&scr.root, cwin, cursor[CurInvisible], MouseMask))
+ if(!grabpointer(&scr.root, cwin, cursor[CurNone], MouseMask))
                 goto done;
 
         for(;;) {
diff -r 8d79cae4cb0e -r 896a3ea2651d rc/rc.wmii.rc
--- a/rc/rc.wmii.rc Tue Jun 26 14:16:22 2007 -0400
+++ b/rc/rc.wmii.rc Tue Jun 26 17:01:47 2007 -0400
@@ -172,10 +172,8 @@ fn Key-$MODKEY-Shift-t {
         wmiir xwrite /client/`{wmiir read /client/sel/ctl}^/tags `{read_tags | wmiimenu} &
 }
 
-for(i in `{seq 0 9}) {
- fn Key-$MODKEY-$i { wmiir xwrite /ctl view `{echo $1 | sed 's/.*-//'} }
- fn Key-Shift-$MODKEY-$i {wmiir xwrite /client/sel/tags `{echo $1 | sed 's/.*-//'} }
-}
+fn Key-$MODKEY-^`{seq 0 9} { wmiir xwrite /ctl view `{echo $1 | sed 's/.*-//'} }
+fn Key-Shift-$MODKEY-^`{seq 0 9} { wmiir xwrite /client/sel/tags `{echo $1 | sed 's/.*-//'} }
 
 # Functions
 fn proglist {
diff -r 8d79cae4cb0e -r 896a3ea2651d rc/sh.wmii
--- a/rc/sh.wmii Tue Jun 26 14:16:22 2007 -0400
+++ b/rc/sh.wmii Tue Jun 26 17:01:47 2007 -0400
@@ -7,6 +7,8 @@ argv0 = $0
 #mount -Aa {os dial unix!/tmp/ns.kris.:1/wmii >[1=0]} / || raise mount
 #mount -Aa {styxmon {os rc -c 'dial $WMII_ADDRESS' >[1=0]}} / || raise mount
 mount -Aa {os rc -c 'dial $WMII_ADDRESS' >[1=0]} / || raise mount
+
+{`{read} && echo halt>/dev/sysctl}&
 
 MODKEY=Mod1
 UP=k
@@ -15,7 +17,6 @@ RIGHT=l
 RIGHT=l
 
 WMII_FONT=fixed
-WMII_FONT='drift,-*-fixed-*-*-*-*-9-*-*-*-*-*-*-*'
 WMII_NORMCOLORS=('#222222' '#5FBF77' '#2A7F3F')
 WMII_FOCUSCOLORS=('#ffffff' '#153F1F' '#2A7F3F')
 WMII_BACKGROUND='#333333'
@@ -64,14 +65,30 @@ subfn ftl {
 
 subfn lines {
         ifs := "{echo}
- arg = $*
+ arg := $*
         result = `{$arg}
+}
+
+fn dofn {
+ (cmd args) := $*
+ if {~ "{whatis $cmd >[2]/dev/null} 'load std; fn '*} {$cmd $args;{}}
+}
+
+fn run_command {
+ os -b -d ${hostenv HOME} $* &
 }
 
 fn dprint {
         arg := $*
         or {~ $#debug 0} {~ $debug '' 0} { echo $arg }
 }
+
+subfn config_whatis {
+ result=${lines {os rc -c 'PATH=$WMII_CONFPATH which $*' $* </dev/null} $*}
+}
+
+local := $home/.wmii-3.5/sh.wmii.local
+if {ftest -x $local} {run $local}
 
 # Status Bar Info
 fn status {
@@ -122,11 +139,7 @@ fn Event-ClientMouseDown {
 # Actions
 fn Action {
         (action args) := $*
- if {~ "{whatis Action-$action >[2]/dev/null} 'load std; fn '*} {
- Action-$action $args
- } {
- run_command ${config_whatis $action} $args
- }
+ or {dofn Action-$action $args} {run_command ${config_whatis $action} $args}
 }
 fn Action-quit { echo quit >>/ctl }
 fn Action-rehash {
@@ -183,26 +196,12 @@ fn Key-$MODKEY-Shift-t {
         read_tags | wmiimenu >/client/$sel/tags
 }
 
-fn next_tag {
- os awk -v curtag'='${lines sed 1q /tag/sel/ctl} '
- NR==1 {first = $0}
- $0==curtag { if(getline) print $0; else print first; exit }'
-}
-fn Key-$MODKEY-n {
- echo view `{read_tags | next_tag} >/ctl
-}
-fn Key-$MODKEY-b {
- echo view `{read_tags | tail -r | next_tag} >/ctl
-}
-
-for(i in ${seq 0 9}) {
- fn Key-$MODKEY-$i { echo view ${tl ${splitr $1 -}} >/ctl }
- fn Key-Shift-$MODKEY-$i { echo ${tl ${splitr $1 -}} >/client/sel/tags}
-}
+fn Key-$MODKEY-^${seq 0 9} { echo view ${tl ${splitr $1 -}} >/ctl }
+fn Key-Shift-$MODKEY-${seq 0 9} { echo ${tl ${splitr $1 -}} >/client/sel/tags}
 
 # Functions
 fn proglist {
- os find ${split : $"*} -maxdepth 1 -type f | sed 's,.*/,,' | sort | uniq
+ os find ${split : $"*} -maxdepth 1 -type f </dev/null | sed 's,.*/,,' | sort | uniq
         #for(d in /n/local^${split : $"*}) {
         # fs filter {mode -d} $d
         #} | sed 's,.*/,,' | sort | uniq
@@ -226,14 +225,6 @@ fn initkeys {
 
 fn read_tags {
         ls -p /tag | grep -v '^sel$'
-}
-
-subfn config_whatis {
- result=${lines os rc -c 'PATH=$WMII_CONFPATH which $*' $*}
-}
-
-fn run_command {
- os -b -d ${hostenv HOME} $* &
 }
 
 # WM Configuration
@@ -246,10 +237,12 @@ fn run_command {
 } >/ctl
 
 # Misc Setup
-os xsetroot -solid $WMII_BACKGROUND
+os xsetroot -solid $WMII_BACKGROUND </dev/null
 Action status &
 progs_file=/tmp/proglist.${pid}
 Action rehash &
+
+dofn Local-Overrides
 
 # Tag Bar Setup
 seltag=${lines sed 1q /tag/sel/ctl}
Received on Tue Jun 26 2007 - 23:02:32 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:57:23 UTC