-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsubtle.rb
More file actions
444 lines (373 loc) · 9.94 KB
/
subtle.rb
File metadata and controls
444 lines (373 loc) · 9.94 KB
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
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
#
# This program can be distributed under the terms of the GNU GPL.
# See the file COPYING.
#
# $Id: .config/subtle/subtle.rb,v 403 2011/11/08 16:03:21 unexist $
#
require "socket"
# Contrib {{{
begin
require "#{ENV["HOME"]}/bin/launcher/launcher.rb"
require "#{ENV["HOME"]}/selector.rb"
Subtle::Contrib::Selector.font = "xft:Dejavu Sans Mono-9:antialias=true:hinting=true:hintstyle=medium"
Subtle::Contrib::Launcher.fonts = [
"xft:Dejavu Sans Mono:bold:pixelsize=40",
"xft:Dejavu Sans Mono:bold:pixelsize=10"
]
Subtle::Contrib::Launcher.browser_screen_num = 0
rescue LoadError
end # }}}
# Options {{{
set :step, 5
set :snap, 10
set :gravity, :center
set :urgent, true
set :resize, false
set :tiling, false
set :skip_pointer_warp, false
# }}}
# Screens {{{
screen 1 do
arch = Subtlext::Icon.new("/home/paul/.icons/subtle/subtle1.xbm")
cloud = Subtlext::Icon.new("/home/paul/.icons/subtle/subtle2.xbm")
top [ :spacer, :mpd, :separator, cloud, :meteoprog, :spacer ]
bottom [ :views, :separator, :title, :spacer, :separator, :cpucolored, :separator, :battery, :separator, :nettraffic, :separator, :clock2, :separator, :tray, :separator, arch ]
end
# }}}
# Colours { {{
background_1 = "#181512"
background_2 = "#212121"
color_above = "#373737"
color_light = "#a6594a"
color_medium = "#DCC58F"
color_dark = "#3F5454"
# }}}
# Styles {{{
style :all do
icon color_light
padding 0, 3, 3, 3
font "xft:Dejavu Sans:regular:size=13"
end
style :title do
foreground color_medium
background background_1
end
style :views do
foreground color_medium
background background_1
icon color_medium
style :focus do
foreground color_medium
background color_light
icon color_medium
end
style :occupied do
foreground color_light
background background_1
icon color_light
end
style :urgent do
foreground color_light
background background_1
icon color_light
end
end
style :sublets do
foreground color_medium
background background_1
icon color_light
end
style :clients do
active color_light, 2
inactive color_medium, 2
margin 10
end
style :separator do
foreground background_1
background background_1
separator " | "
end
style :subtle do
margin 0, 0, 0, 0
panel_top background_1
panel_bottom background_1
end # }}}
# Gravities {{{
# Top Left
gravity :top_left, [ 0, 0, 50, 50 ]
gravity :top_left66, [ 0, 0, 50, 66 ]
gravity :top_left33, [ 0, 0, 50, 34 ]
gravity :top, [ 0, 0, 100, 50 ]
gravity :top66, [ 0, 0, 100, 66 ]
gravity :top33, [ 0, 0, 100, 34 ]
# Top right
gravity :top_right, [ 50, 0, 50, 50 ]
gravity :top_right66, [ 50, 0, 50, 66 ]
gravity :top_right33, [ 50, 0, 50, 33 ]
# Left
gravity :left, [ 0, 0, 50, 100 ]
gravity :left66, [ 0, 0, 66, 100 ]
gravity :left33, [ 0, 0, 33, 100 ]
# Center
gravity :center, [ 0, 0, 100, 100 ]
gravity :center66, [ 17, 17, 66, 66 ]
gravity :center33, [ 33, 33, 33, 33 ]
# Right
gravity :right, [ 50, 0, 50, 100 ]
gravity :right66, [ 34, 0, 66, 100 ]
gravity :right33, [ 67, 0, 33, 100 ]
# Bottom left
gravity :bottom_left, [ 0, 50, 50, 50 ]
gravity :bottom_left66, [ 0, 34, 50, 66 ]
gravity :bottom_left33, [ 0, 67, 50, 33 ]
# Bottom
gravity :bottom, [ 0, 50, 100, 50 ]
gravity :bottom66, [ 0, 34, 100, 66 ]
gravity :bottom33, [ 0, 67, 100, 33 ]
# Bottom right
gravity :bottom_right, [ 50, 50, 50, 50 ]
gravity :bottom_right66, [ 50, 34, 50, 66 ]
gravity :bottom_right33, [ 50, 67, 50, 33 ]
#Gimp
gravity :gimp_image, [ 10, 0, 80, 100 ]
gravity :gimp_toolbox, [ 0, 0, 10, 100 ]
gravity :gimp_dock, [ 90, 0, 10, 100 ]
# Scratchpad
gravity :scratchpad, [ 20, 50, 60, 45 ]
# Pidgin
gravity :pidgin, [ 0, 50, 25, 100 ]
# }}}
# Grabs {{{
# Host specific
modkey = "W"
gravkeys = [ "1", "2", "3", "4", "5", "6", "7", "8", "9" ]
# Views and screens
(1..9).each do |i|
grab modkey + "-#{i}", "ViewSwitch#{i}".to_sym
grab modkey + "-S-#{i}", "ViewJump#{i}".to_sym
end
# Windows
grab modkey + "-q", [ :top_left ]
grab modkey + "-w", [ :top ]
grab modkey + "-e", [ :top_right ]
grab modkey + "-a", [ :left ]
grab modkey + "-s", [ :center ]
grab modkey + "-d", [ :right ]
grab modkey + "-z", [ :bottom_left ]
grab modkey + "-x", [ :bottom ]
grab modkey + "-v", [ :bottom_right ]
grab modkey + "-B1", :WindowMove
grab modkey + "-B3", :WindowResize
grab modkey + "-f", :WindowFloat
grab modkey + "-C-b", :WindowBorderless
grab modkey + "-S-space", :WindowFull
grab modkey + "-s", :WindowStick
grab modkey + "-r", :WindowRaise
grab modkey + "-l", :WindowLower
grab modkey + "-Left", :WindowLeft
grab modkey + "-Down", :WindowDown
grab modkey + "-Up", :WindowUp
grab modkey + "-Right", :WindowRight
grab modkey + "-S-c", :WindowKill
grab modkey + "-h", lambda { |c| c.retag }
grab "A-Tab" do
clients = Subtlext::Client.visible
clients.last.instance_eval do
focus
raise
end
end
grab "A-S-Tab" do
clients = Subtlext::Client.visible
clients.first.instance_eval do
lower
end
clients.first.instance_eval do
focus
end
end
# Reload/restart
grab modkey + "-C-q", :SubtleQuit
grab modkey + "-C-r", :SubtleReload
grab modkey + "-C-A-r", :SubtleRestart
# Multimedia keys
grab "XF86AudioMute", :VolumeToggle
grab "XF86AudioRaiseVolume", "dvol.sh -i 2"
grab "XF86AudioLowerVolume", "dvol.sh -d 2"
grab "XF86AudioPlay", :MpdToggle
grab "XF86AudioStop", :MpdStop
grab "XF86AudioNext", :MpdNext
grab "XF86AudioPrev", :MpdPrevious
# Programs
grab modkey + "-Return", "xterm"
grab modkey + "-c", "firefox-developer-edition"
grab modkey + "-p", "interrobang"
grab modkey + "-t", "xterm -name ranger -e ranger"
grab modkey + "-m", "xterm -name mutt -e mutt"
grab modkey + "-n", "xterm -name ncmpcpp -e ncmpcpp"
grab modkey + "-Escape", "pygtk-shutdown-systemd"
grab modkey + "-f", "xterm -name freenas -e 'ssh -X -p 45002 paul@192.168.1.12'"
grab "W-y" do
Subtle::Contrib::Launcher.run
end
grab "W-S-s" do
if (c = Subtlext::Client.first("scratchpad"))
c.toggle_stick
c.focus
c.raise
elsif (c = Subtlext::Client.spawn("xterm -name scratchpad"))
c.tags = []
c.flags = [ :stick ]
end
end
# Tags {{{
tag "u" do
match instance: "xterm|urxvtc|urxvt|terminal|mutt|freenas|ncmpcpp"
gravity :center
resize true
end
tag "S" do
match "navigator|(google\-)?chrom[eium]|vlc"
gravity :center
end
tag "t" do
match "[g]?vim|gedit|pluma|mousepad"
resize true
end
tag "b" do
match "nautilus|thunar|ranger|spacefm"
end
tag "l" do
match "mplayer"
float true
end
tag "e" do
match "calibre"
gravity :center
end
tag "float" do
match :name => "Copying*";
match :name => "Moving*";
match :name => "File*";
match "smplayer";
float true
end
tag "scratchpad" do
match :instance => "scratchpad"
gravity :scratchpad
urgent false
stick true
end
tag "stick" do
match "dialog|subtly|python|gtk.rb|display|pychrom|skype|xev|evince|exe|<unknown>|plugin-container"
stick true
float true
end
tag "urgent" do
stick true
urgent true
float true
end
tag "dialogs" do
match "sun-awt-X11-XDialogPeer"
match type: [ :dialog, :splash ]
stick true
end
tag "terms" do
match "terms"
gravity :center
end
tag "gimp_image" do
match role: "gimp-image-window"
gravity :gimp_image
end
tag "gimp_toolbox" do
match role: "gimp-toolbox$"
gravity :gimp_toolbox
end
tag "gimp_dock" do
match role: "gimp-dock"
gravity :gimp_dock
end
tag "gimp_scum" do
match role: "gimp-.*|screenshot"
end
# }} }
# View s {{{
net = "S"
terms = "u"
file = "b"
media = "t"
edit = "l"
stuff = "e"
icons = false
iconpath = "#{ENV["HOME"]}/.icons/subtle"
space = {
:net => Subtlext::Icon.new("#{iconpath}/invader1.xbm"),
:terms => Subtlext::Icon.new("#{iconpath}/invader2.xbm"),
:file => Subtlext::Icon.new("#{iconpath}/invader3.xbm"),
# :im => Subtlext::Icon.new("#{iconpath}/balloon.xbm"),
:media => Subtlext::Icon.new("#{iconpath}/movie.xbm"),
:edit => Subtlext::Icon.new("#{iconpath}/binder.xbm"),
:stuff => Subtlext::Icon.new("#{iconpath}/ghost.xbm"),
:gimp => Subtlext::Icon.new("#{iconpath}/pencil.xbm"),
:libre => Subtlext::Icon.new("#{iconpath}/mouse.xbm")
}
view "S" do
match net
icon_only false
end
view "u" do
match terms
icon_only false
end
view "b" do
match file
icon_only false
end
view "t" do
match media
icon_only false
end
view "l" do
match edit
icon_only false
end
view "e" do
match stuff
icon_only false
end
on :start do
Subtlext::Client.spawn "setxkbmap gb"
end
on :start do
Subtlext::Client.spawn "setxkbmap -option terminate:ctrl_alt_bksp"
end
sublet :clock2 do
time_format "%H:%M"
date_format "%d/%m/%y"
time_color "#4a7b6c"
date_color "#4a7b6c"
end
sublet :battery do
color_text true
colors 10 => "#FF0000", 20 => "#399bff", 100 => "#33cc00"
path "/sys/class/power_supply/BAT0"
end
sublet :mpd do
not_running_text "No Music :("
show_colors true
pause_text "Paused"
stop_text "Stopped"
note_color "#00ff00"
show_icons false
format_string "%note% %artist% - %title%"
artist_color "#0066cc"
album_color "#ccff33"
title_color "#cc0033"
track_color "#33ff33"
id_color "#ccff33"
pause_color "#00ff00"
stop_color "#00ff00"
end
# }}}