blob: 8c508d156233f6e98dbbbdd1642bd0aa3e052f0b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
|
#!/bin/dash -f
# Configure wmii
wmiiscript=wmiirc # For wmii.sh
. wmii.sh
# Configuration Variables
MODKEY=Mod1
UP=k
DOWN=j
LEFT=h
RIGHT=l
# Bars
noticetimeout=5
noticebar=/rbar/!notice
# Colors tuples: "<text> <background> <border>"
export WMII_NORMCOLORS='#ffffff #0b0c2c #333333'
export WMII_FOCUSCOLORS='#ffffff #000000 #333333'
export WMII_BACKGROUND='#000000'
export WMII_LOWBATTERYCOLORS='#ffffff #ff0000 #333333'
export WMII_FONT='-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*'
set -- $(echo $WMII_NORMCOLORS $WMII_FOCUSCOLORS)
export WMII_TERM="urxvt"
export PATH=$HOME/bin:$PATH
if ! test -d "${WMII_CONFPATH%%:*}"; then
mkdir "${WMII_CONFPATH%%:*}"
res=$(wihack -type DIALOG xmessage -nearmouse -buttons Windows,Alt -print -fn $WMII_FONT \
"Welcome to wmii,$wi_newline$wi_newline" \
"Most of wmii's default key bindings make use of the$wi_newline" \
"Windows key, or equivalent. For keyboards lacking such$wi_newline" \
"a key, many users change this to the Alt key.$wi_newline$wi_newline" \
"Which would you prefer?")
[ "$res" = "Alt" ] && MODKEY=Mod1
echo "MODKEY=$MODKEY" >"${WMII_CONFPATH%%:*}/wmiirc_local"
chmod +x "${WMII_CONFPATH%%:*}/wmiirc_local"
fi
echo "bar on bottom" | wmiir write /ctl
mp_watcher 2> /dev/null &
bat_watcher 2> /dev/null &
# Menu history
hist="${WMII_CONFPATH%%:*}/history"
histnum=5000
# Column Rules
wmiir write /colrules <<!
#/gimp/ -> 17+83+41
/.*/ -> 62+38 # Golden Ratio
!
# Tagging Rules
wmiir write /tagrules <<!
#/MPlayer|VLC/ -> ~
/terminal/ -> sel # Ignore terminal window groups.
!
local_events() { true;}
wi_runconf -s wmiirc_local
echo $WMII_NORMCOLORS | wmiir create $noticebar
# Event processing
events() {
cat <<'!'
# Events
Event CreateTag
echo "$WMII_NORMCOLORS" "$@" | wmiir create "/lbar/$@"
Event DestroyTag
wmiir remove "/lbar/$@"
Event FocusTag
wmiir xwrite "/lbar/$@" "$WMII_FOCUSCOLORS" "$@"
Event UnfocusTag
wmiir xwrite "/lbar/$@" "$WMII_NORMCOLORS" "$@"
Event UrgentTag
shift
wmiir xwrite "/lbar/$@" "*$@"
Event NotUrgentTag
shift
wmiir xwrite "/lbar/$@" "$@"
Event LeftBarClick LeftBarDND
shift
wmiir xwrite /ctl view "$@"
Event Unresponsive
{
client=$1; shift
msg="The following client is not responding. What would you like to do?$wi_newline"
resp=$(wihack -transient $client \
xmessage -nearmouse -buttons Kill,Wait -print
-fn "${WMII_FONT%%,*}" "$msg $(wmiir read /client/sel/label)")
if [ "$resp" = Kill ]; then
wmiir xwrite /client/$client/ctl slay &
fi
}&
Event Notice
wmiir xwrite $noticebar $wi_arg
kill $xpid 2>/dev/null # Let's hope this isn't reused...
{ sleep $noticetimeout; wmiir xwrite $noticebar ' '; }&
xpid = $!
# Menus
Menu Client-3-Delete
wmiir xwrite /client/$1/ctl kill
Menu Client-3-Kill
wmiir xwrite /client/$1/ctl slay
Menu Client-3-Fullscreen
wmiir xwrite /client/$1/ctl Fullscreen on
Event ClientMouseDown
wi_fnmenu Client $2 $1 &
Menu LBar-3-Delete
tag=$1; clients=$(wmiir read "/tag/$tag/index" | awk '/[^#]/{print $2}')
for c in $clients; do
if [ "$tag" = "$(wmiir read /client/$c/tags)" ]; then
wmiir xwrite /client/$c/ctl kill
else
wmiir xwrite /client/$c/tags -$tag
fi
if [ "$tag" = "$(wi_seltag)" ]; then
newtag=$(wi_tags | awk -v't='$tag '
$1 == t { if(!l) getline l
print l
exit }
{ l = $0 }')
wmiir xwrite /ctl view $newtag
fi
done
Event LeftBarMouseDown
wi_fnmenu LBar "$@" &
# Actions
Action showkeys
echo "$KeysHelp" | xmessage -file - -fn ${WMII_FONT%%,*}
Action quit
wmiir xwrite /ctl quit
Action exec
wmiir xwrite /ctl exec "$@"
Action rehash
wi_proglist $PATH >$progsfile
Action action_date
set +xv
if wmiir remove /rbar/99 2>/dev/null; then
sleep 2
fi
echo "$WMII_NORMCOLORS" | wmiir create /rbar/99date
while echo -n $(date '+%D -- %I:%M %p') | wmiir write /rbar/99date; do
sleep 1
done
# Key Bindings
KeyGroup Multimedia
Key XF86AudioRaiseVolume
amixer -q -- set Master 05%+ &
Key XF86AudioLowerVolume
amixer -q -- set Master 05%- &
Key $MODKEY-Control-0
amixer -q -- set Master 05%+ &
Key $MODKEY-Control-9
amixer -q -- set Master 05%- &
Key XF86AudioMute
amixer -q -- set Master toggle &
Key XF86HomePage
firefox &
Key Pause
mplayer_control pause &
Key $MODKEY-Shift-Right
mplayer_control "seek +5 0" &
Key $MODKEY-Shift-Left
mplayer_control "seek -5 0" &
Key $MODKEY-Shift-Up
mplayer_control "seek +60 0" &
Key $MODKEY-Shift-Down
mplayer_control "seek -60 0" &
Key $MODKEY-Shift-Prior
mplayer_control "seek +600 0" &
Key $MODKEY-Shift-Next
mplayer_control "seek -600 0" &
Key $MODKEY-KP_Right
mplayer_control "pt_step +1" &
Key $MODKEY-KP_Left
mplayer_control "pt_step -1" &
Key Scroll_Lock
lock &
Key XF86PowerOff
lock &
Key XF86Calculator
xterm calc &
KeyGroup Moving around
Key $MODKEY-$LEFT # Select the client to the left
wmiir xwrite /tag/sel/ctl select left
Key $MODKEY-$RIGHT # Select the client to the right
wmiir xwrite /tag/sel/ctl select right
Key $MODKEY-$UP # Select the client above
wmiir xwrite /tag/sel/ctl select up
Key $MODKEY-$DOWN # Select the client below
wmiir xwrite /tag/sel/ctl select down
Key $MODKEY-space # Toggle between floating and managed layers
wmiir xwrite /tag/sel/ctl select toggle
KeyGroup Moving through stacks
Key $MODKEY-Control-$UP # Select the stack above
wmiir xwrite /tag/sel/ctl select up stack
Key $MODKEY-Control-$DOWN # Select the stack below
wmiir xwrite /tag/sel/ctl select down stack
KeyGroup Moving clients around
Key $MODKEY-Shift-$LEFT # Move selected client to the left
wmiir xwrite /tag/sel/ctl send sel left
Key $MODKEY-Shift-$RIGHT # Move selected client to the right
wmiir xwrite /tag/sel/ctl send sel right
Key $MODKEY-Shift-$UP # Move selected client up
wmiir xwrite /tag/sel/ctl send sel up
Key $MODKEY-Shift-$DOWN # Move selected client down
wmiir xwrite /tag/sel/ctl send sel down
Key $MODKEY-Shift-space # Toggle selected client between floating and managed layers
wmiir xwrite /tag/sel/ctl send sel toggle
KeyGroup Client actions
Key $MODKEY-f # Toggle selected client's fullsceen state
wmiir xwrite /client/sel/ctl Fullscreen toggle
Key $MODKEY-Shift-c # Close client
wmiir xwrite /client/sel/ctl kill
KeyGroup Changing column modes
Key $MODKEY-d # Set column to default mode
wmiir xwrite /tag/sel/ctl colmode sel default-max
Key $MODKEY-s # Set column to stack mode
wmiir xwrite /tag/sel/ctl colmode sel stack-max
Key $MODKEY-m # Set column to max mode
wmiir xwrite /tag/sel/ctl colmode sel stack+max
KeyGroup Running programs
Key $MODKEY-a # Open wmii actions menu
action $(wi_actions | wimenu -h "${hist}.actions" -n $histnum) &
Key $MODKEY-p # Open program menu
eval wmiir setsid "$(wimenu -h "${hist}.progs" -n $histnum <$progsfile)" &
Key $MODKEY-Return # Launch a terminal
eval wmiir setsid $WMII_TERM &
KeyGroup Other
Key $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
KeyGroup Tag actions
Key $MODKEY-t # Change to another tag
(tag=$(wi_tags | wimenu -h "${hist}.tags" -n 50) && wmiir xwrite /ctl view $tag) &
Key $MODKEY-Shift-t # Retag the selected client
c=$(wi_selclient)
(tag=$(wi_tags | wimenu -h "${hist}.tags" -n 50) && wmiir xwrite /client/$c/tags $tag) &
!
for i in 0 1 2 3 4 5 6 7 8 9; do
cat <<!
Key $MODKEY-$i # Move to the numbered view
wmiir xwrite /ctl view "$i"
Key $MODKEY-Shift-$i # Retag selected client with the numbered tag
wmiir xwrite /client/sel/tags "$i"
!
done
cat <<!
Key $MODKEY-5
wmiir xwrite /ctl view "5 Media"
Key $MODKEY-Shift-5
wmiir xwrite /client/sel/tags "5 Media"
Key $MODKEY-9
wmiir xwrite /ctl view "9 Network"
Key $MODKEY-Shift-9
wmiir xwrite /client/sel/tags "9 Network"
!
}
wi_events events local_events
# WM Configuration
wmiir write /ctl <<!
font $WMII_FONT
focuscolors $WMII_FOCUSCOLORS
normcolors $WMII_NORMCOLORS
grabmod $MODKEY
border 1
!
feh --bg-fill ~/Images/background
# Misc
progsfile="$(wmiir namespace)/.proglist"
action action_date &
wi_proglist $PATH >$progsfile &
# Setup Tag Bar
IFS="$wi_newline"
wmiir rm $(wmiir ls /lbar | sed 's,^,/lbar/,') >/dev/null
seltag=$(wmiir read /tag/sel/ctl | sed 1q)
unset IFS
wi_tags | while read tag
do
if [ "$tag" = "$seltag" ]; then
echo "$WMII_FOCUSCOLORS" "$tag"
else
echo "$WMII_NORMCOLORS" "$tag"
fi | wmiir create "/lbar/$tag"
done
wi_eventloop
|