5 path=($PLAN9/bin $path)
14 WMII_NORMCOLORS=('#222222' '#5FBF77' '#2A7F3F')
15 WMII_FOCUSCOLORS=('#ffffff' '#153F1F' '#2A7F3F')
16 WMII_BACKGROUND='#333333'
21 dmenu -b -fn $WMII_FONT \
22 -nf $WMII_NORMCOLORS(1) -nb $WMII_NORMCOLORS(2) \
23 -sf $WMII_FOCUSCOLORS(1) -sb $WMII_FOCUSCOLORS(2)
27 wmii9menu -font $WMII_FONT \
28 -^(nf nb br)^$WMII_NORMCOLORS \
29 -^(sf sb br)^$WMII_FOCUSCOLORS $*
33 confpath=`{echo $WMII_CONFPATH | sed 'y/:/ /'}
35 echo `{{path=$confpath whatis $prog} | grep -v '=|^fn '} $*
38 if(echo $0 | grep -vs '/rc.wmii$') {
39 echo Fatal: This file should only be run as rc.wmii >[1=2]
43 if(! test -x $PLAN9/bin/read) {
44 echo 'Can''t find the ''read'' command' >[1=2]
45 xmessage -file - <<'!'
46 exec `{config_whatis wmiirc}
49 You have a Plan 9 utilities installed, but are missing the 'read' command.
50 This likely means that you have an out-of-date 9base installed.
52 wmiirc will be run instead.
55 # Source Variables, &c
56 local = `{config_whatis rc.wmii.local}
57 . <{awk '//; /^# Overrides/ { exit }' $local </dev/null}
60 wmiir write /colrules <<!
65 wmiir write /tagrules <<!
74 echo -n `{uptime | sed 's/.*://; s/,//g'} '|' `{date}
78 fn viewtitle { echo $* }
89 fn Event-Key { eval Key-$1 $1 }
91 fn Event-CreateTag { echo $WMII_NORMCOLORS `{viewtitle $*} | wmiir create /lbar/$"* }
92 fn Event-DestroyTag { wmiir remove /lbar/$"* }
93 fn Event-FocusTag { wmiir xwrite /lbar/$"* $WMII_FOCUSCOLORS `{viewtitle $*} }
94 fn Event-UnfocusTag { wmiir xwrite /lbar/$"* $WMII_NORMCOLORS `{viewtitle $*} }
95 fn Event-UrgentTag { shift; wmiir xwrite /lbar/$"* '*'$"* }
96 fn Event-NotUrgentTag { shift; wmiir xwrite /lbar/$"* $"* }
98 fn Event-LeftBarClick { shift; wmiir xwrite /ctl view $* }
101 fn Event-ClientMouseDown {
102 client = $1; button = $2
104 do=`{9menu -initial $menulast Nop Delete}
107 wmiir xwrite /client/$client/ctl kill
117 if(whatis Action-$action | grep -s '^fn ') {
120 run_command `{config_whatis $action} $* &
123 fn Action-rehash { proglist $PATH >$progs_file }
124 fn Action-quit { wmiir xwrite /ctl quit }
128 if(wmiir remove /rbar/status >[2]/dev/null)
130 echo $WMII_NORMCOLORS | wmiir create /rbar/status
131 while(status | wmiir write /rbar/status)
136 fn Key-$MODKEY-Control-t {
137 switch(`{wmiir read /keys | wc -l}) {
140 wmiir xwrite /ctl grabmod $MODKEY
142 wmiir xwrite /keys $MODKEY-Control-t
143 wmiir xwrite /ctl grabmod Mod3
147 fn Key-$MODKEY-$LEFT { wmiir xwrite /tag/sel/ctl select left }
148 fn Key-$MODKEY-$RIGHT { wmiir xwrite /tag/sel/ctl select right }
149 fn Key-$MODKEY-$DOWN { wmiir xwrite /tag/sel/ctl select down }
150 fn Key-$MODKEY-$UP { wmiir xwrite /tag/sel/ctl select up }
152 fn Key-$MODKEY-Shift-$LEFT { wmiir xwrite /tag/sel/ctl send sel left }
153 fn Key-$MODKEY-Shift-$RIGHT { wmiir xwrite /tag/sel/ctl send sel right }
154 fn Key-$MODKEY-Shift-$DOWN { wmiir xwrite /tag/sel/ctl send sel down }
155 fn Key-$MODKEY-Shift-$UP { wmiir xwrite /tag/sel/ctl send sel up }
157 fn Key-$MODKEY-space { wmiir xwrite /tag/sel/ctl select toggle }
158 fn Key-$MODKEY-Shift-space { wmiir xwrite /tag/sel/ctl send sel toggle }
160 fn Key-$MODKEY-d { wmiir xwrite /tag/sel/ctl colmode sel default }
161 fn Key-$MODKEY-s { wmiir xwrite /tag/sel/ctl colmode sel stack }
162 fn Key-$MODKEY-m { wmiir xwrite /tag/sel/ctl colmode sel max }
164 fn Key-$MODKEY-Shift-c { wmiir xwrite /client/sel/ctl kill }
166 fn Key-$MODKEY-a { Action `{actionlist | wmiimenu} & }
167 fn Key-$MODKEY-p { run_command `{wmiimenu <$progs_file} & }
168 fn Key-$MODKEY-Return { run_command $WMII_TERM & }
169 fn Key-$MODKEY-t { wmiir xwrite /ctl view `{read_tags | wmiimenu} & }
170 fn Key-$MODKEY-Shift-t {
171 wmiir xwrite /client/`{wmiir read /client/sel/ctl}^/tags `{read_tags | wmiimenu} &
174 for(i in `{seq 0 9}) {
175 fn Key-$MODKEY-$i { wmiir xwrite /ctl view `{echo $1 | sed 's/.*-//'} }
176 fn Key-Shift-$MODKEY-$i {wmiir xwrite /client/sel/tags `{echo $1 | sed 's/.*-//'} }
181 /bin/ls -lL `{echo $* | sed 'y/:/ /'} >[2]/dev/null \
182 | awk '$1 ~ /^[^d].*x/ { print $NF }' \
187 env | sed -n 's/^fn#'^$1^'-([^=]+).*/\1/p'
191 { proglist $WMII_CONFPATH
197 getfuns Key | wmiir write /keys
201 wmiir ls /tag | sed 's,/,,; /^sel$/d'
216 focuscolors $WMII_FOCUSCOLORS
217 normcolors $WMII_NORMCOLORS
219 xsetroot -solid $WMII_BACKGROUND
222 . <{awk '/^# Overrides/, 0' $local </dev/null}
226 progs_file=$WMII_NS_DIR/proglist.$pid
227 proglist $PATH >$progs_file &
231 '{ for(bar in `{comm -23 <{wmiir ls /lbar} <{read_tags}})
232 wmiir remove /lbar/$bar
233 seltag=`{wmiir read /tag/sel/ctl}
234 for(tag in `{read_tags}) {
236 echo $WMII_FOCUSCOLORS `{viewtitle $tag} | wmiir create /lbar/$tag
238 echo $WMII_NORMCOLORS `{viewtitle $tag} | wmiir create /lbar/$tag
245 if(echo Start wmiirc | ! wmiir write /event >[2]/dev/null)
253 } >[2]/dev/null </dev/null