[hackers] [wmii] Deprecate '# Overrides'

From: Kris Maglione <jg_AT_suckless.org>
Date: Wed Jun 27 04:42:48 2007

changeset: 2169:80267db05675
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Tue Jun 26 22:39:03 2007 -0400
summary: Deprecate '# Overrides'

diff -r fba62db5fae7 -r 80267db05675 man/wmii.1
--- a/man/wmii.1 Tue Jun 26 20:26:04 2007 -0400
+++ b/man/wmii.1 Tue Jun 26 22:39:03 2007 -0400
@@ -1,5 +1,5 @@
 '\" t
-.\" Manual page created with latex2man on Mon Jun 11 15:48:33 EDT 2007
+.\" Manual page created with latex2man on Tue Jun 26 20:44:34 EDT 2007
 .\" NOTE: This file is generated, DO NOT EDIT.
 .de Vb
 .ft CW
@@ -10,7 +10,7 @@
 
 .fi
 ..
-.TH "WMII" "1" "11 June 2007" "" ""
+.TH "WMII" "1" "26 June 2007" "" ""
 .SH NAME
 wmii\-VERSION
 .PP
@@ -436,16 +436,15 @@ Rules are specified:
 \fB \fP
 .br
 When a client\&'s \fIname\fP:\fIclass\fP:\fItitle\fP
-matches \fIregex\fP,
-it is given the tagstring
-\fItag\fP\&.
-There are two special tags. \fI!\fP,
-which
-will be replaced with \fIsel\fP
-in the future,
+matches
+\fIregex\fP,
+it is given the tagstring \fItag\fP\&.
+There are
+two special tags. \fI!\fP,
+which is deprecated, and identical
+to \fIsel\fP,
 represents the current tag. \fI^\fP
-represents the
-floating layer.
+represents the floating layer.
 .TP
 keys
 The \fIkeys\fP
diff -r fba62db5fae7 -r 80267db05675 man/wmii.tex
--- a/man/wmii.tex Tue Jun 26 20:26:04 2007 -0400
+++ b/man/wmii.tex Tue Jun 26 22:39:03 2007 -0400
@@ -202,7 +202,7 @@ follows.
 \begin{description}
 \item[colrules] The \emph{colrules} file contains a list of
         rules which affect the width of newly created columns.
- Rules have the form: \\ \SP % Yuck!
+ Rules have the form: \\ \SP % Yuck! (kludge)
         \MANbr
         \SP\SP /\Arg{regex}/ -> \Arg{width}\oArg{+width...} \\ \SP
         \MANbr
@@ -218,12 +218,11 @@ follows.
         \MANbr
         \SP\SP /\Arg{regex}/ -> \Arg{tag}\oArg{+tag...} \\ \SP
         \MANbr
- When a client's \Arg{name}:\Arg{class}:\Arg{title}
- matches \Arg{regex}, it is given the tagstring
- \Arg{tag}. There are two special tags. \emph{!}, which
- will be replaced with \emph{sel} in the future,
- represents the current tag. \emph{\Circum} represents the
- floating layer.
+ When a client's \Arg{name}:\Arg{class}:\Arg{title} matches
+ \Arg{regex}, it is given the tagstring \Arg{tag}. There are
+ two special tags. \emph{!}, which is deprecated, and identical
+ to \emph{sel}, represents the current tag. \emph{\Circum}
+ represents the floating layer.
 \item[keys] The \emph{keys} file contains a list of keys which
         \Prog{wmii} will grab. Whenever these key combinations
         are pressed, the string which represents them are
diff -r fba62db5fae7 -r 80267db05675 rc/rc.wmii.rc
--- a/rc/rc.wmii.rc Tue Jun 26 20:26:04 2007 -0400
+++ b/rc/rc.wmii.rc Tue Jun 26 22:39:03 2007 -0400
@@ -31,8 +31,10 @@ fn 9menu {
 
 fn config_whatis {
         confpath=`{echo $WMII_CONFPATH | sed 'y/:/ /'}
- prog=$1; shift
- echo `{{path=$confpath whatis $prog} | grep -v '=|^fn '} $*
+ prog = `{{path=$confpath whatis $1} | grep -v '^fn|= '}; shift
+ if(~ $#prog 0)
+ prog = /dev/null
+ echo $prog $*
 }
 
 if(echo $0 | grep -vs '/rc.wmii$') {
@@ -52,10 +54,6 @@ wmiirc will be run instead.
 wmiirc will be run instead.
 !
 
-# Source Variables, &c
-local = `{config_whatis rc.wmii.local}
-. <{awk '//; /^# Overrides/ { exit }' $local </dev/null}
-
 # Column Rules
 wmiir write /colrules <<!
 /./ -> 60+40
@@ -65,7 +63,7 @@ wmiir write /tagrules <<!
 wmiir write /tagrules <<!
 /XMMS.*/ -> ~
 /MPlayer.*/ -> ~
-/.*/ -> !
+/.*/ -> sel
 /.*/ -> 1
 !
 
@@ -74,18 +72,37 @@ fn status {
         echo -n `{uptime | sed 's/.*://; s/,//g'} '|' `{date}
 }
 
+# Functions
 fn viewtitle { echo $* }
 
-# Events
-fn Event-Start {
- switch($1) {
- case wmiirc
- rm -f $progs_file
- exit
- }
-}
-
-fn Event-Key { eval Key-$1 $1 }
+fn proglist {
+ /bin/ls -lL `{echo $* | sed 'y/:/ /'} >[2]/dev/null \
+ | awk '$1 ~ /^[^d].*x/ { print $NF }' \
+ | sort | uniq
+}
+
+fn getfuns {
+ env | sed -n 's/^fn#'^$1^'-([^=]+).*/\1/p'
+}
+
+fn actionlist {
+ { proglist $WMII_CONFPATH
+ getfuns Action
+ } | sort | uniq
+}
+
+fn initkeys {
+ getfuns Key | wmiir write /keys
+}
+
+fn read_tags {
+ wmiir ls /tag | sed 's,/,,; /^sel$/d'
+}
+
+fn run_command {
+ rfork ns
+ path=$oldpath { eval exec $* }
+}
 
 fn Event-CreateTag { echo $WMII_NORMCOLORS `{viewtitle $*} | wmiir create /lbar/$"* }
 fn Event-DestroyTag { wmiir remove /lbar/$"* }
@@ -112,14 +129,16 @@ fn Event-ClientMouseDown {
         }
 }
 
+fn 'fn?' {rc -c 'whatis '$1 >[2]/dev/null | grep -s '^fn ' }
+
 # Actions
 fn Action {
- action=$1; shift
- if(whatis Action-$action | grep -s '^fn ') {
- Action-$action $* &
- };if not {
- run_command `{config_whatis $action} $* &
- }
+ cmd=$1 action=Action-$cmd { shift
+ if('fn?' $action)
+ $action $*
+ if not
+ run_command `{config_whatis $cmd} $*
+ } &
 }
 fn Action-rehash { proglist $PATH >$progs_file }
 fn Action-quit { wmiir xwrite /ctl quit }
@@ -133,6 +152,30 @@ fn Action-status {
                 sleep 1
 }
 
+# Events
+fn Event-Start {
+ switch($1) {
+ case wmiirc
+ rm -f $progs_file
+ exit
+ }
+}
+fn Event-Key { eval Key-$1 $1 }
+
+# Source Variables, &c
+local = `{config_whatis rc.wmii.local}
+. <{awk '//;
+ /^# Overrides/ {
+ print "xmessage -file - <<!"
+ print "rc.wmii: Warning:"
+ print " Your rc.wmii.local contains an ''# Overrides'' line."
+ print " This line has a deprecated special meaning. Functions"
+ print " you wish to override should be defined in a function"
+ print " called Action-overridekeys"
+ print "!"
+ exit
+ }' $local </dev/null}
+
 # Key Bindings
 fn Key-$MODKEY-Control-t {
         switch(`{wmiir read /keys | wc -l}) {
@@ -175,38 +218,6 @@ fn Key-$MODKEY-^`{seq 0 9} { wmiir xwrit
 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 {
- /bin/ls -lL `{echo $* | sed 'y/:/ /'} >[2]/dev/null \
- | awk '$1 ~ /^[^d].*x/ { print $NF }' \
- | sort | uniq
-}
-
-fn getfuns {
- env | sed -n 's/^fn#'^$1^'-([^=]+).*/\1/p'
-}
-
-fn actionlist {
- { proglist $WMII_CONFPATH
- getfuns Action
- } | sort | uniq
-}
-
-fn initkeys {
- getfuns Key | wmiir write /keys
-}
-
-fn read_tags {
- wmiir ls /tag | sed 's,/,,; /^sel$/d'
-}
-
-fn run_command {
- @{ rfork ns
- path=$oldpath
- eval exec $*
- }
-}
-
 # WM Configuration
 wmiir write /ctl <<!
 grabmod $MODKEY
@@ -219,9 +230,13 @@ xsetroot -solid $WMII_BACKGROUND
 
 # Source Overrides
 . <{awk '/^# Overrides/, 0' $local </dev/null}
+if('fn?' Action-overridekeys)
+ Action-overridekeys
+if not
+ . `{config_whatis overridekeys}
 
 # Misc Setup
-Action status &
+Action status
 progs_file=$WMII_NS_DIR/proglist.$pid
 proglist $PATH >$progs_file &
 
diff -r fba62db5fae7 -r 80267db05675 rc/wmiirc.sh
--- a/rc/wmiirc.sh Tue Jun 26 20:26:04 2007 -0400
+++ b/rc/wmiirc.sh Tue Jun 26 22:39:03 2007 -0400
@@ -29,7 +29,7 @@ wmiir write /tagrules <<!
 wmiir write /tagrules <<!
 /XMMS.*/ -> ~
 /MPlayer.*/ -> ~
-/.*/ -> !
+/.*/ -> sel
 /.*/ -> 1
 !
 
Received on Wed Jun 27 2007 - 04:42:48 UTC

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