3 wmiiscript
=wmiirc
# For wmii.sh
7 # Configuration Variables
16 noticebar
=/rbar
/!notice
18 # Colors tuples: "<text> <background> <border>"
19 export WMII_NORMCOLORS
='#000000 #c1c48b #81654f'
20 export WMII_FOCUSCOLORS
='#000000 #81654f #000000'
22 export WMII_BACKGROUND
='#333333'
23 export WMII_FONT
='-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*'
25 set -- $
(echo $WMII_NORMCOLORS $WMII_FOCUSCOLORS)
26 export WMII_TERM
="xterm"
28 # Ask about MODKEY on first run
29 if ! test -d "${WMII_CONFPATH%%:*}"; then
30 mkdir
"${WMII_CONFPATH%%:*}"
31 res
=$
(wihack
-type DIALOG xmessage
-nearmouse -buttons Windows
,Alt
-print -fn $WMII_FONT \
32 "Welcome to wmii,$wi_newline$wi_newline" \
33 "Most of wmii's default key bindings make use of the$wi_newline" \
34 "Windows key, or equivalent. For keyboards lacking such$wi_newline" \
35 "a key, many users change this to the Alt key.$wi_newline$wi_newline" \
36 "Which would you prefer?")
37 [ "$res" = "Alt" ] && MODKEY
=Mod1
38 echo "MODKEY=$MODKEY" >"${WMII_CONFPATH%%:*}/wmiirc_local"
39 chmod +x
"${WMII_CONFPATH%%:*}/wmiirc_local"
43 hist
="${WMII_CONFPATH%%:*}/history"
47 wmiir
write /colrules
<<!
49 /.
*/ -> 62+38 # Golden Ratio
53 wmiir
write /rules
<<!
54 # Apps with system tray icons like to their main windows
55 # Give them permission.
56 /^Pidgin
:/ allow
=+activate
58 # MPlayer and VLC don't float by default, but should.
59 /MPlayer|VLC
/ floating
=on force-tags
=+7
61 # ROX puts all of its windows in the same group, so they open
62 # with the same tags. Disable grouping for ROX Filer.
65 #/SMPlayer.*/ force-tags=+7
70 echo -n label $
(uptime |
sed 's/.*://; s/, / /g') '|' $
(date)
73 # Generic overridable startup details
74 startup
() { witray
& }
76 local_events
() { true
;}
77 wi_runconf
-s wmiirc_local
80 echo colors
$WMII_NORMCOLORS | wmiir create
$noticebar
83 local_events | wi_events
87 echo colors
"$WMII_NORMCOLORS$wi_newline" label
"$@" | wmiir create
"/lbar/$@"
89 wmiir remove
"/lbar/$@"
91 wmiir xwrite
"/lbar/$@" colors
"$WMII_FOCUSCOLORS"
93 wmiir xwrite
"/lbar/$@" colors
"$WMII_NORMCOLORS"
96 wmiir xwrite
"/lbar/$@" label
"*$@"
99 wmiir xwrite
"/lbar/$@" label
"$@"
100 Event LeftBarClick LeftBarDND
102 wmiir xwrite
/ctl view
"$@"
106 msg
="The following client is not responding. What would you like to do?$wi_newline"
107 resp
=$
(wihack
-transient $client \
108 xmessage
-nearmouse -buttons Kill
,Wait
-print \
109 -fn "${WMII_FONT%%,*}" "$msg $(wmiir read /client/sel/label)")
110 if [ "$resp" = Kill
]; then
111 wmiir xwrite
/client
/$client/ctl slay
&
115 wmiir xwrite
$noticebar $wi_arg
117 kill $xpid 2>/dev
/null
# Let's hope this isn't reused...
118 { sleep $noticetimeout; wmiir xwrite
$noticebar ' '; }&
123 wmiir xwrite
/client
/$1/ctl
kill
125 wmiir xwrite
/client
/$1/ctl slay
126 Menu Client-3-Fullscreen
127 wmiir xwrite
/client
/$1/ctl Fullscreen on
128 Event ClientMouseDown
129 wi_fnmenu Client
$2 $1 &
132 tag
=$1; clients
=$
(wmiir
read "/tag/$tag/index" |
awk '/[^#]/{print $2}')
133 for c
in $clients; do
134 if [ "$tag" = "$(wmiir read /client/$c/tags)" ]
135 then wmiir xwrite
/client
/$c/ctl
kill
136 else wmiir xwrite
/client
/$c/ctl tags
-$tag
138 [ "$tag" = "$(wi_seltag)" ] &&
139 wmiir xwrite
/ctl view $
(wi_tags | wi_nexttag
)
141 Event LeftBarMouseDown
142 wi_fnmenu LBar
"$@" &
146 echo "$KeysHelp" | xmessage
-file - -fn ${WMII_FONT%%,*}
148 wmiir xwrite
/ctl quit
150 wmiir xwrite
/ctl
exec "$@"
152 wi_proglist
$PATH >$progsfile
155 if wmiir remove
/rbar
/status
2>/dev
/null
; then
158 echo colors
"$WMII_NORMCOLORS" | wmiir create
/rbar
/status
159 while status | wmiir
write /rbar
/status
; do
164 KeyGroup Moving around
165 Key
$MODKEY-$LEFT # Select the client to the left
166 wmiir xwrite
/tag
/sel
/ctl
select left
167 Key
$MODKEY-$RIGHT # Select the client to the right
168 wmiir xwrite
/tag
/sel
/ctl
select right
169 Key
$MODKEY-$UP # Select the client above
170 wmiir xwrite
/tag
/sel
/ctl
select up
171 Key
$MODKEY-$DOWN # Select the client below
172 wmiir xwrite
/tag
/sel
/ctl
select down
174 Key
$MODKEY-space # Toggle between floating and managed layers
175 wmiir xwrite
/tag
/sel
/ctl
select toggle
177 KeyGroup Moving through stacks
178 Key
$MODKEY-Control-$UP # Select the stack above
179 wmiir xwrite
/tag
/sel
/ctl
select up stack
180 Key
$MODKEY-Control-$DOWN # Select the stack below
181 wmiir xwrite
/tag
/sel
/ctl
select down stack
183 KeyGroup Moving clients around
184 Key
$MODKEY-Shift-$LEFT # Move selected client to the left
185 wmiir xwrite
/tag
/sel
/ctl send sel left
186 Key
$MODKEY-Shift-$RIGHT # Move selected client to the right
187 wmiir xwrite
/tag
/sel
/ctl send sel right
188 Key
$MODKEY-Shift-$UP # Move selected client up
189 wmiir xwrite
/tag
/sel
/ctl send sel up
190 Key
$MODKEY-Shift-$DOWN # Move selected client down
191 wmiir xwrite
/tag
/sel
/ctl send sel down
193 Key
$MODKEY-Shift-space # Toggle selected client between floating and managed layers
194 wmiir xwrite
/tag
/sel
/ctl send sel toggle
196 KeyGroup Client actions
197 Key
$MODKEY-f # Toggle selected client's fullsceen state
198 wmiir xwrite
/client
/sel
/ctl Fullscreen toggle
199 Key
$MODKEY-Shift-c # Close client
200 wmiir xwrite
/client
/sel
/ctl
kill
202 KeyGroup Changing
column modes
203 Key
$MODKEY-d # Set column to default mode
204 wmiir xwrite
/tag
/sel
/ctl colmode sel default-max
205 Key
$MODKEY-s # Set column to stack mode
206 wmiir xwrite
/tag
/sel
/ctl colmode sel stack-max
207 Key
$MODKEY-m # Set column to max mode
208 wmiir xwrite
/tag
/sel
/ctl colmode sel stack
+max
210 KeyGroup Running programs
211 Key
$MODKEY-a # Open wmii actions menu
212 action $
(wi_actions | wimenu
-h "${hist}.actions" -n $histnum) &
213 Key
$MODKEY-p # Open program menu
214 eval wmiir setsid
"$(wimenu -h "${hist}.progs
" -n $histnum <$progsfile)" &
216 Key
$MODKEY-Return # Launch a terminal
217 eval wmiir setsid
$WMII_TERM &
220 Key
$MODKEY-Control-t # Toggle all other key bindings
221 case $
(wmiir
read /keys |
wc -l |
tr -d ' \t\n') in
223 echo -n "$Keys" | wmiir
write /keys
224 wmiir xwrite
/ctl grabmod
$MODKEY;;
226 wmiir xwrite
/keys
$MODKEY-Control-t
227 wmiir xwrite
/ctl grabmod Mod3
;;
231 Key
$MODKEY-t # Change to another tag
232 wmiir xwrite
/ctl view $
(wi_tags | wimenu
-h "${hist}.tags" -n 50) &
233 Key
$MODKEY-Shift-t # Retag the selected client
234 # Assumes left-to-right order of evaluation
235 wmiir xwrite
/client
/$
(wi_selclient
)/ctl tags $
(wi_tags | wimenu
-h "${hist}.tags" -n 50) &
236 Key
$MODKEY-n # Move to the next tag
237 wmiir xwrite
/ctl view $
(wi_tags | wi_nexttag
)
238 Key
$MODKEY-b # Move to the previous tag
239 wmiir xwrite
/ctl view $
(wi_tags |
sort -r | wi_nexttag
)
241 for i
in 0 1 2 3 4 5 6 7 8 9; do
243 Key
$MODKEY-$i # Move to the numbered view
244 wmiir xwrite
/ctl view
"$i"
245 Key
$MODKEY-Shift-$i # Retag selected client with the numbered tag
246 wmiir xwrite
/client
/sel
/ctl tags
"$i"
254 focuscolors
$WMII_FOCUSCOLORS
255 normcolors
$WMII_NORMCOLORS
259 xsetroot
-solid "$WMII_BACKGROUND" &
262 progsfile
="$(wmiir namespace)/.proglist"
264 wi_proglist
$PATH >$progsfile &
268 wmiir
rm $
(wmiir
ls -p /lbar
) >/dev
/null
269 seltag
=$
(wmiir
read /tag
/sel
/ctl |
sed 1q
)
271 wi_tags |
while read tag
273 if [ "$tag" = "$seltag" ]; then
274 echo colors
"$WMII_FOCUSCOLORS"
277 echo colors
"$WMII_NORMCOLORS"
279 fi | wmiir create
"/lbar/$tag"