Project

General

Profile

unexist.dev

/

subtle

Assorted tidbits and projects

subtle.rb

Subtle Configuration - Hartwig De Colle, 10/30/2010 12:45 PM

 
1
#
2
# Version: 1.0.0
3
#
4

    
5
# Following options change behaviour and sizes of the window manager:{{{
6
#
7
# Border size in pixel of the windows
8
set :border, 1
9

    
10
# Window move/resize steps in pixel per keypress
11
set :step, 5
12

    
13
# Window screen border snapping
14
set :snap, 10
15

    
16
# Default starting gravity for windows (0 = gravity of last client)
17
set :gravity, :center
18

    
19
# Make transient windows urgent
20
set :urgent, false
21

    
22
# Enable respecting of size hints globally
23
set :resize, false
24

    
25
# Screen size padding (left, right, top, bottom)
26
set :padding, [ 0, 0, 0, 0 ]
27

    
28
# Honor randr (doesn't work with nvidia)
29
set :randr, true
30
# Font string either take from e.g. xfontsel or use xft
31
set :font, "xft:DejaVu Sans Mono:pixelsize=14"
32
#set :font, "-*-*-medium-*-*-*-14-*-*-*-*-*-*-*" xft:DejaVu Sans Mono:pixelsize=14
33
#set :font, "xft:sans-8"
34

    
35
# Space around windows
36
set :gap, 0
37

    
38
# Separator between sublets
39
set :separator, "|"
40

    
41
# Outline border size in pixel of panel items
42
set :outline, 0
43

    
44
#}}}
45
# == Panel{{{
46
# 
47
# The next configuration values determine the layout and placement of the panel.
48
# Generally, the panel in subtle consists of two independent bars, one on the
49
# top and one at the bottom of the screen. In Xinerama setups there will only
50
# be panels visible on the first screen.
51
#
52
# The top and bottom bar can contain different items and will be hidden when
53
# empty.
54
#
55
# Following items are available:
56
#
57
# [*:views*]     List of views with buttons
58
# [*:title*]     Title of the current active window
59
# [*:tray*]      Systray icons (Can be used once)
60
# [*:sublets*]   Catch-all for installed sublets
61
# [*:sublet*]    Name of a sublet for direct placement
62
# [*:spacer*]    Variable spacer (free width / count of spacers)
63
# [*:center*]    Enclose items with :center to center them on the panel
64
# [*:separator*] Insert separator
65
#
66
# === Link
67
#
68
# http://subforge.org/wiki/subtle/Panel
69
#}}}
70
#Screen Configuration {{{
71
screen 1 do
72
  # Add stipple to panels
73
  stipple false
74

    
75
  # Content of the top panel
76
  top     [  :title, :spacer,  :sublets ]
77

    
78
  # Content of the bottom panel
79
  bottom  [:views, :space, :tray]
80
end
81

    
82
#}}}
83
# == Colors{{{
84
#
85
# Colors directly define the look of subtle, valid values are:
86
#
87
# [*hexadecimal*] #0000ff
88
# [*decimal*]     (0, 0, 255)
89
# [*names*]       blue
90
#
91
# Whenever there is no valid value for a color set - subtle will use a default
92
# one. There is only one exception to this: If no background color is given no
93
# color will be set. This will ensure a custom background pixmap won't be
94
# overwritten.
95
#
96
# === Link
97
#
98
# http://subforge.org/wiki/subtle/Themes
99
#}}}
100
#Color Definition {{{
101
# Foreground color of panel and separator
102
color :fg_panel,      "#757575"
103

    
104
  # Foreground color of view button
105
color :fg_views,      "#757575"
106

    
107
# Foreground color of sublets
108
color :fg_sublets,    "#757575"
109

    
110
# Foreground color of focus window titles and active views
111
color :fg_focus,      "#fecf35"
112

    
113
# Foreground color of urgent window titles and views
114
color :fg_urgent,     "#FF9800"
115

    
116
# Background color of panel
117
color :bg_panel,      "#202020"
118

    
119
# Background color of view button
120
color :bg_views,      "#202020"
121

    
122
  # Background color of sublets
123
color :bg_sublets,    "#202020"
124

    
125
# Background color of focus window titles and active views
126
color :bg_focus,      "#202020"
127

    
128
# Background color of urgent window titles and views
129
color :bg_urgent,     "#202020"
130

    
131
# Border color of focus windows
132
#color :border_focus,  "#303030"
133
color :border_focus,  "#ff0000"
134

    
135
# Border color of normal windows
136
color :border_normal, "#202020"
137

    
138
# Border color of panel items
139
color :border_panel,  "#303030"
140

    
141
# Background color of root background
142
#color :background,    "#3d3d3d"
143

    
144
# Color of the separator
145
color :separator,     "#757575"
146

    
147
#}}}
148

    
149
# == Gravities{{{
150
#
151
# Gravities are predefined sizes a window can be set to. There are several ways
152
# to set a certain gravity, most convenient is to define a gravity via a tag or
153
# change them during runtime via grab. Subtler and subtlext can also modify
154
# gravities.
155
#
156
# A gravity consists of four values which are a percentage value of the screen
157
# size. The first two values are x and y starting at the center of the screen
158
# and he last two values are the width and height.
159
#
160
# === Example
161
#
162
# Following defines a gravity for a window with 100% width and height:
163
#
164
#   gravity :example, [ 0, 0, 100, 100 ]
165
#
166
# === Link
167
#
168
# http://subforge.org/wiki/subtle/Gravity
169
#}}}
170

    
171
# Gravitiy Configuration {{{
172
  # Top left
173
gravity :top_left,       [   0,   0,  50,  50 ]
174
gravity :top_left66,     [   0,   0,  50,  66 ]
175
gravity :top_left33,     [   0,   0,  50,  34 ]
176

    
177
  # Top
178
gravity :top,            [   0,   0, 100,  50 ]
179
gravity :top66,          [   0,   0, 100,  66 ]
180
gravity :top33,          [   0,   0, 100,  34 ]
181

    
182
  # Top right
183
gravity :top_right,      [ 100,   0,  50,  50 ]
184
gravity :top_right66,    [ 100,   0,  50,  66 ]
185
gravity :top_right33,    [ 100,   0,  50,  34 ]
186

    
187
  # Left
188
gravity :left,           [   0,   0,  50, 100 ]
189
gravity :left66,         [   0,  50,  50,  34 ]
190
gravity :left33,         [   0,  50,  25,  34 ]
191

    
192
  # Center
193
gravity :center,         [   0,   0, 100, 100 ]
194
gravity :center66,       [   0,  50, 100,  34 ]
195
gravity :center33,       [  50,  50,  50,  34 ]
196

    
197
  # Right
198
gravity :right,          [ 100,   0,  50, 100 ]
199
gravity :right66,        [ 100,  50,  50,  34 ]
200
gravity :right33,        [ 100,  50,  25,  34 ]
201

    
202
  # Bottom left
203
gravity :bottom_left,    [   0, 100,  50,  50 ]
204
gravity :bottom_left66,  [   0, 100,  50,  66 ]
205
gravity :bottom_left33,  [   0, 100,  50,  34 ]
206

    
207
  # Bottom
208
gravity :bottom,         [   0, 100, 100,  50 ]
209
gravity :bottom66,       [   0, 100, 100,  66 ]
210
gravity :bottom33,       [   0, 100, 100,  34 ]
211

    
212
  # Bottom right
213
gravity :bottom_right,   [ 100, 100,  50,  50 ]
214
gravity :bottom_right66, [ 100, 100,  50,  66 ]
215
gravity :bottom_right33, [ 100, 100,  50,  34 ]
216

    
217
  # Gimp
218
gravity :gimp_image,     [  50,  50,  80, 100 ]
219
gravity :gimp_toolbox,   [   0,   0,  10, 100 ]
220
gravity :gimp_dock,      [ 100,   0,  10, 100 ]
221

    
222
#vlc
223
gravity :vlc_video,     [  0,  0,   50, 100 ]
224
gravity :vlc_playlist,      [ 100,   0,  50, 100 ]
225

    
226
#}}}
227

    
228
# == Grabs{{{
229
#
230
# Grabs are keyboard and mouse actions within subtle, every grab can be
231
# assigned either to a key and/or to a mouse button combination. A grab
232
# consists of a chain and an action.
233
#
234
# === Finding keys
235
#
236
# The best resource for getting the correct key names is
237
# */usr/include/X11/keysymdef.h*, but to make life easier here are some hints
238
# about it:
239
#
240
# * Numbers and letters keep their names, so *a* is *a* and *0* is *0*
241
# * Keypad keys need *KP_* as prefix, so *KP_1* is *1* on the keypad
242
# * Strip the *XK_* from the key names if looked up in
243
#   /usr/include/X11/keysymdef.h
244
# * Keys usually have meaningful english names
245
# * Modifier keys have special meaning (Alt (A), Control (C), Meta (M),
246
#   Shift (S), Super (W))
247
#
248
# === Chaining
249
#
250
# Chains are a combination of keys and modifiers to one key and can be used in
251
# various ways to trigger an action. In subtle there are two ways to define
252
# chains for grabs:
253
#
254
#   1. Default way*: Add modifiers to a key and use it for a grab
255
#
256
#      *Example*: grab "W-Return", "urxvt"
257
#
258
#   2. *Escape way*: Define an escape grab that needs to be pressed before
259
#      *any* other grab can be used like in screen/tmux.
260
#
261
#      *Example*: grab "C-y", :SubtleEscape
262
#                 grab "Return", "urxvt"
263
#
264
# ==== Mouse buttons
265
#
266
# [*B1*] = Button1 (Left mouse button)
267
# [*B2*] = Button2 (Middle mouse button)
268
# [*B3*] = Button3 (Right mouse button)
269
# [*B4*] = Button4 (Mouse wheel up)
270
# [*B5*] = Button5 (Mouse wheel down)
271
#
272
# ==== Modifiers
273
#
274
# [*A*] = Alt key
275
# [*C*] = Control key
276
# [*M*] = Meta key
277
# [*S*] = Shift key
278
# [*W*] = Super (Windows) key
279
#
280
# === Action
281
#
282
# An action is something that happens when a grab is activated, this can be one
283
# of the following:
284
#
285
# [*symbol*] Run a subtle action
286
# [*string*] Start a certain program
287
# [*array*]  Cycle through gravities
288
# [*lambda*] Run a Ruby proc
289
#
290
# === Example
291
#
292
# This will create a grab that starts a urxvt when Alt+Enter are pressed:
293
#
294
#   grab "A-Return", "urxvt"
295
#
296
# === Link
297
#
298
# http://subforge.org/wiki/subtle/Grabs
299
#
300

    
301
# Escape grab
302
#  grab "C-y", :SubtleEscape
303
#}}}
304

    
305
# Grab Configuration {{{
306
# Jump to view1, view2, ...
307
grab "W-S-1", :ViewJump1
308
grab "W-S-2", :ViewJump2
309
grab "W-S-3", :ViewJump3
310
grab "W-S-4", :ViewJump4
311

    
312
# Switch current view
313
grab "W-1", :ViewSwitch1
314
grab "W-2", :ViewSwitch2
315
grab "W-3", :ViewSwitch3
316
grab "W-4", :ViewSwitch4
317
grab "W-5", :ViewSwitch5
318
grab "W-6", :ViewSwitch6
319

    
320
# Select next and prev view */
321
grab "KP_Add",      :ViewNext
322
grab "KP_Subtract", :ViewPrev
323

    
324
grab "A-Tab",      :ViewNext
325
grab "S-A-Tab", :ViewPrev
326
# Move mouse to screen1, screen2, ...
327
grab "W-A-1", :ScreenJump1
328
grab "W-A-2", :ScreenJump2
329
grab "W-A-3", :ScreenJump3
330
grab "W-A-4", :ScreenJump4
331

    
332
# Move window to screen1, screen2, ...
333
grab "A-S-1", :WindowScreen1
334
grab "A-S-2", :WindowScreen2
335
grab "A-S-3", :WindowScreen3
336
grab "A-S-4", :WindowScreen4
337

    
338
# Force reload of sublets
339
grab "W-C-s", :SubletsReload
340

    
341
# Force reload of config
342
grab "W-C-r", :SubtleReload
343

    
344
# Force restart of subtle
345
grab "W-C-S-r", :SubtleRestart
346

    
347
# Quit subtle
348
grab "W-C-q", :SubtleQuit
349

    
350
# Move current window
351
grab "W-B1", :WindowMove
352

    
353
# Resize current window
354
grab "W-B3", :WindowResize
355

    
356
# Toggle floating mode of window
357
grab "W-f", :WindowFloat
358

    
359
# Toggle fullscreen mode of window
360
grab "W-space", :WindowFull
361

    
362
# Toggle sticky mode of window (will be visible on all views)
363
grab "W-p", :WindowStick
364

    
365
# Raise window
366
grab "W-u", :WindowRaise
367

    
368
# Lower window
369
grab "W-n", :WindowLower
370

    
371
# Select next windows
372
grab "W-h",  :WindowLeft
373
grab "W-j",  :WindowDown
374
grab "W-k",    :WindowUp
375
grab "W-l", :WindowRight
376

    
377
# Kill current window
378
grab "W-S-k", :WindowKill
379

    
380
# Cycle between given gravities
381
grab "W-q", [ :top_left,     :top_left66,     :top_left33     ]
382
grab "W-w", [ :top,          :top66,          :top33          ]
383
grab "W-e", [ :top_right,    :top_right66,    :top_right33    ]
384
grab "W-a", [ :left,         :left66,         :left33         ]
385
grab "W-s", [ :center,       :center66,       :center33       ]
386
grab "W-d", [ :right,        :right66,        :right33        ]
387
grab "W-y", [ :bottom_left,  :bottom_left66,  :bottom_left33  ]
388
grab "W-x", [ :bottom,       :bottom66,       :bottom33       ]
389
grab "W-c", [ :bottom_right, :bottom_right66, :bottom_right33 ]
390

    
391
# Exec programs
392
grab "W-Return", "urxvt -tr -fg white -sh 70"
393
grab "W-g", "gvim"
394
grab "W-o", "opera"
395

    
396
# Run Ruby lambdas
397
grab "S-F2" do |c|
398
  puts c.name
399
end
400

    
401
grab "S-F3" do
402
  puts Subtlext::VERSION
403
end
404

    
405
#}}}
406

    
407
# == Tags{{{
408
#
409
# Tags are generally used in subtle for placement of windows. This placement is
410
# strict, that means that - aside from other tiling window managers - windows
411
# must have a matching tag to be on a certain view. This also includes that
412
# windows that are started on a certain view will not automatically be placed
413
# there.
414
#
415
# There are to ways to define a tag:
416
#
417
# [*string*]  With a WM_CLASS/WM_NAME
418
# [*hash*]    With a hash of properties
419
#
420
# === Default
421
#
422
# Whenever a window has no tag it will get the default tag and be placed on the
423
# default view. The default view can either be set by the user with adding the
424
# default tag to a view by choice or otherwise the first defined view will be
425
# chosen automatically.
426
#
427
# === Properties
428
#
429
# Additionally tags can do a lot more then just control the placement - they
430
# also have properties than can define and control some aspects of a window
431
# like the default gravity or the default screen per view.
432
#
433
# [*float*]   This property either sets the tagged client floating or prevents
434
#              it from being floating depending on the value.
435
#
436
#              Example: float true
437
#
438
# [*full*]    This property either sets the tagged client to fullscreen or
439
#              prevents it from being set to fullscreen depending on the value.
440
#
441
#              Example: full true
442
#
443
# [*gravity*] This property sets a certain to gravity to the tagged client,
444
#              but only on views that have this tag too.
445
#
446
#              Example: gravity :center
447
#
448
# [*match*]   This property adds matching patterns to a tag, a tag can have
449
#              more than one. Matching works either via plaintext, regex
450
#              (see man regex(7)) or window id. Per default tags will only
451
#              match the WM_NAME and the WM_CLASS portion of a client, this
452
#              can be changed with following possible values:
453
#
454
#              [*:name*]      Match the WM_NAME
455
#              [*:instance*]  Match the first (instance) part from WM_CLASS
456
#              [*:class*]     Match the second (class) part from WM_CLASS
457
#              [*:role*]      Match the window role
458
#
459
#              Example: match :instance => "urxvt"
460
#                       match [:role, :class] => "test"
461
#                       match "[xa]+term"
462
#
463
# [*exclude*] This property works exactly the same way as *match*, but it
464
#              excludes clients that match from this tag. That can be helpful
465
#              with catch-all tags e.g. for console apps.
466
#
467
#              Example: exclude :instance => "irssi"
468
#
469
# [*resize*]  This property either enables or disables honoring of client
470
#              resize hints and is independent of the global option.
471
#
472
#              Example: resize true
473
#
474
# [*size*]    This property sets a certain to size as well as floating to the
475
#              tagged client, but only on views that have this tag too. It
476
#              expects an array with x, y, width and height values.
477
#
478
#              Example: size [100, 100, 50, 50]
479
#
480
# [*stick*]   This property either sets the tagged client to stick or prevents
481
#              it from being set to stick depending on the value. Stick clients
482
#              are visible on every view.
483
#
484
#              Example: stick true
485
#
486
# [*type*]    This property sets the [[Tagging|tagged]] client to be treated
487
#              as a specific window type though as the window sets the type
488
#              itself. Following types are possible:
489
#
490
#              [*:desktop*]  Treat as desktop window (_NET_WM_WINDOW_TYPE_DESKTOP)
491
#              [*:dock*]     Treat as dock window (_NET_WM_WINDOW_TYPE_DOCK)
492
#              [*:toolbar*]  Treat as toolbar windows (_NET_WM_WINDOW_TYPE_TOOLBAR)
493
#              [*:splash*]   Treat as splash window (_NET_WM_WINDOW_TYPE_SPLASH)
494
#              [*:dialog*]   Treat as dialog window (_NET_WM_WINDOW_TYPE_DIALOG)
495
#
496
#              Example: type :desktop
497
#
498
# [*urgent*]  This property either sets the tagged client to be urgent or
499
#              prevents it from being urgent depending on the value. Urgent
500
#              clients will get keyboard and mouse focus automatically.
501
#
502
#              Example: urgent true
503
#
504
# === Link
505
#
506
# http://subforge.org/wiki/subtle/Tagging
507
#}}}
508

    
509
# Tags Configuration {{{
510

    
511
tag "opera", "opera"
512
# Placement
513

    
514
tag "terms",   do
515
  match :name => "xterm|[u]?rxvt"
516
end
517

    
518
tag "editor" do
519
  match  "[g]?vim"
520
  exclude :role => "tt8-editor"
521
  resize true
522
end
523

    
524
tag "fixed" do
525
  geometry [ 10, 10, 100, 100 ]
526
  stick    true
527
end
528

    
529
tag "resize" do
530
  match  "sakura|gvim"
531
  resize true
532
end
533

    
534
tag "gravity" do
535
  gravity :center
536
end
537

    
538
# Modes
539
tag "stick" do
540
  match "mplayer"
541
  float true
542
  stick true
543
end
544

    
545
tag "float" do
546
  match "display"
547
  float true
548
end
549

    
550
# Gimp
551
tag "gimp_image" do
552
  match   :role => "gimp-image-window"
553
  gravity :gimp_image
554
end
555

    
556
tag "gimp_toolbox" do
557
  match   :role => "gimp-toolbox"
558
  gravity :gimp_toolbox
559
end
560

    
561
tag "gimp_dock" do
562
  match   :role => "gimp-dock"
563
  gravity :gimp_dock
564
end
565

    
566
tag "vlc_all","vlc"
567
tag "vlc_video" do
568
  match :name =>"VLC.*"
569
  gravity :vlc_video
570
end
571

    
572
tag "vlc_playlist" do
573
  match :name => "Playlist"
574
  gravity :vlc_playlist
575
end
576

    
577

    
578
tag "rails-server" do
579
  match :name => "rails-server"
580
  gravity :top_left
581
end
582

    
583
tag "rails-irb" do
584
  match :name => "rails-irb"
585
  gravity :bottom_left
586
end
587

    
588
tag "rails-autotest" do
589
  match :name => "rails-autotest"
590
  gravity :right
591
end
592

    
593
tag "tt8-editor" do
594
  match :role => "tt8-editor"
595
  gravity :top
596
end
597

    
598
tag "tt8-console" do
599
  match :name => "tt8-console"
600
  gravity :bottom_left
601
end
602
tag "tt8-view" do
603
  match  :name => "Navigator"
604
  gravity :bottom_right
605
end
606
#}}}
607
# == Views{{{
608
#
609
# Views are the virtual desktops in subtle, they show all windows that share a
610
# tag with them. Windows that have no tag will be visible on the default view
611
# which is the view with the default tag or the first defined view when this
612
# tag isn't set.
613
#
614
# === Link
615
#
616
# http://subforge.org/wiki/subtle/Tagging
617
#}}}
618

    
619
# View Configuration {{{
620
view "terms", "terms"
621
view "www",   "opera"
622
view "dev",   "editor"
623

    
624
view "media",  "vlc.*"
625
view "default",   "default"
626
view "rails", "rails.*"
627
view "tt8", "tt8.*"
628
#}}}
629
#
630
# == Sublets{{{
631
#
632
# Sublets are Ruby scripts that provide data for the panel and can be managed
633
# with the sur script that comes with subtle.
634
#
635
# Follwing properties can be changed directly:
636
#
637
# [*interval*]    Update interval of the sublet
638
# [*foreground*]  Default foreground color
639
# [*background*]  Default background color
640
#
641
# === Example
642
#
643
#  sublet :clock do
644
#    interval      30
645
#    foreground    "#eeeeee"
646
#    background    "#000000"
647
#    format_string "%H:%M:%S"
648
#  end
649
#
650
#  === Link
651
#
652
# http://subforge.org/wiki/subtle/Sublets#Configuration
653
#}}}
654
# Sublets Configuration {{{
655
 sublet :clock do
656
   format_string "%d.%m.%Y %H:%M:%S"
657
 end
658

    
659
#}}}
660

    
661
# == Hooks{{{
662
#
663
# And finally hooks are a way to bind Ruby scripts to a certain event.
664
#
665
# Following hooks exist so far:
666
#
667
# [*:client_create*]    Called whenever a window is created
668
# [*:client_configure*] Called whenever a window is configured
669
# [*:client_focus*]     Called whenever a window gets focus
670
# [*:client_kill*]      Called whenever a window is killed
671
#
672
# [*:tag_create*]       Called whenever a tag is created
673
# [*:tag_kill*]         Called whenever a tag is killed
674
#
675
# [*:view_create*]      Called whenever a view is created
676
# [*:view_configure*]   Called whenever a view is configured
677
# [*:view_jump*]        Called whenever the view is switched
678
# [*:view_kill*]        Called whenever a view is killed
679
#
680
# [*:tile*]             Called on whenever tiling would be needed
681
# [*:reload*]           Called on reload
682
# [*:start*]            Called on start
683
# [*:exit*]             Called on exit
684
#
685
# === Example
686
#
687
# This hook will print the name of the window that gets the focus:
688
#
689
#   on :client_focus do |c|
690
#     puts c.name
691
#   end
692
#
693
# === Link
694
#
695
# http://subforge.org/wiki/subtle/Hooks
696
#
697

    
698
#}}}
699
# vim:ts=2:bs=2:sw=2:et:fdm=marker