config.yaml (15387B)
1 # 2 # High-level wmii configuration. 3 # 4 # Ruby code in this file has access 5 # to a CONFIG constant which contains 6 # the data in this configuration file. 7 # 8 #-- 9 # Copyright protects this work. 10 # See LICENSE file for details. 11 #++ 12 13 14 ## 15 # Program preferences. 16 # 17 program: 18 terminal: @TERMINAL@ 19 browser: firefox 20 editor: mousepad 21 filer: thunar 22 23 24 ## 25 # Appearance settings. 26 # 27 display: 28 29 ## 30 # Where to display the horizontal status bar? 31 # 32 # Possible choices are "top" and "bottom". 33 # 34 bar: bottom 35 36 ## 37 # The font to use in all text drawn by wmii. 38 # 39 font: -*-fixed-medium-r-*-*-13-*-*-*-*-*-*-* 40 41 ## 42 # Thickness of client border (measured in pixels). 43 # 44 border: 1 45 46 ## 47 # Number of seconds a notice should be displayed. 48 # 49 notice: 5 50 51 ## 52 # Color schemes for everything drawn by wmii. 53 # 54 # <scheme>: "<text> <background> <border>" 55 # 56 # You can find more color schemes here: 57 # 58 # http://wmii.suckless.org/scripts_n_snips/themes 59 # 60 color: 61 normal: "#000000 #c1c48b #81654f" 62 focus: "#000000 #81654f #000000" 63 error: "#000000 #81654f #000000" 64 notice: "#000000 #a1956d #413328" 65 success: "#000000 #c1c48b #81654f" 66 67 ## 68 # Color of desktop background. 69 # 70 background: "#333333" 71 72 ## 73 # Settings for columns drawn by wmii. 74 # 75 # mode: <the wmii "colmode" setting> 76 # rule: <the wmii "colrules" setting> 77 # 78 column: 79 mode: default 80 rule: | 81 /gimp/ -> 17+83+41 82 /.*/ -> 62+38 # Golden Ratio 83 84 ## 85 # Mapping of clients to views they must appear on. 86 # 87 # - <client props regular expression> : <tags to apply> 88 # 89 # These mappings are processed in top-to-bottom order. 90 # Processing stops after the first matching mapping is applied. 91 # 92 client: 93 - /MPlayer|VLC/ : ~ 94 95 ## 96 # Self-refreshing buttons on the status bar. 97 # 98 # - <button name>: 99 # refresh: <number of seconds to wait before refreshing the content> 100 # content: <Ruby code whose result is displayed as the content> 101 # click: <Ruby code to handle mouse clicks on the status button. 102 # This code has access to a "mouse_button" variable which is 103 # an integer representing the mouse button that was clicked.> 104 # 105 # You can refresh a particular status button in Ruby using: 106 # 107 # status "your button name" 108 # 109 # The horizontal order in which these buttons appear on the status 110 # bar reflects the vertical order in which they are defined below. 111 # 112 status: 113 - system_load: 114 refresh: 10 115 content: | 116 load_averages = File.read('/proc/loadavg').split.first(3) 117 current_load = load_averages.first.to_f 118 119 # visually indicate the intensity of system load 120 color = case 121 when current_load > 3.0 then CONFIG['display']['color']['error'] 122 when current_load > 1.5 then CONFIG['display']['color']['notice'] 123 end 124 125 [color, *load_averages] 126 127 - clock: 128 refresh: 5 129 content: Time.now.to_s 130 131 132 ## 133 # Interaction settings. 134 # 135 control: 136 137 ## 138 # The wmii "grabmod" setting. 139 # 140 grab: Mod4 141 142 ## 143 # Key sequence prefixes. 144 # 145 mod: Mod4 146 move: Mod4-Shift 147 swap: Mod4-w 148 view: Mod4-v 149 group: Mod4-g 150 151 ## 152 # Direction keys. 153 # 154 up: k 155 down: j 156 left: h 157 right: l 158 159 ## 160 # Sequence keys. 161 # 162 prev: b 163 next: n 164 165 ## 166 # Key bindings. 167 # 168 # <key sequence>: <Ruby code to execute> 169 # 170 # A key sequence may contain ${...} expressions which 171 # are replaced with the value corresponding to '...' 172 # in the 'control' section of this configuration file. 173 # 174 # For example, if the 'control' section of 175 # this configuration file appeared like this: 176 # 177 # control: 178 # foo: Mod4 179 # bar: y 180 # 181 # and the following key sequence was used: 182 # 183 # ${foo}-${bar},${bar} 184 # 185 # then after ${...} expression replacement, 186 # that key sequence would appear like this: 187 # 188 # Mod4-y,y 189 # 190 key: 191 #--------------------------------------------------------------------------- 192 # focus 193 #--------------------------------------------------------------------------- 194 195 ${mod}-${up}: | # focus above client 196 curr_view.select(:up) rescue nil 197 198 ${mod}-${down}: | # focus below client 199 curr_view.select(:down) rescue nil 200 201 ${mod}-${left}: | # focus left client 202 curr_view.select(:left) rescue nil 203 204 ${mod}-${right}: | # focus right client 205 curr_view.select(:right) rescue nil 206 207 ${mod}-space: | # focus floating area (toggle) 208 curr_view.select(:toggle) 209 210 ${mod}-${prev}: | # focus previous view 211 prev_view.focus 212 213 ${mod}-${next}: | # focus next view 214 next_view.focus 215 216 # focus the view whose index or name equals the pressed number 217 ${mod}-1: focus_view tags[0] || 1 218 ${mod}-2: focus_view tags[1] || 2 219 ${mod}-3: focus_view tags[2] || 3 220 ${mod}-4: focus_view tags[3] || 4 221 ${mod}-5: focus_view tags[4] || 5 222 ${mod}-6: focus_view tags[5] || 6 223 ${mod}-7: focus_view tags[6] || 7 224 ${mod}-8: focus_view tags[7] || 8 225 ${mod}-9: focus_view tags[8] || 9 226 ${mod}-0: focus_view tags[9] || 10 227 228 # focus the view whose name begins with the pressed alphabet 229 ${view},a: t = tags.grep(/^a/i).first and focus_view(t) 230 ${view},b: t = tags.grep(/^b/i).first and focus_view(t) 231 ${view},c: t = tags.grep(/^c/i).first and focus_view(t) 232 ${view},d: t = tags.grep(/^d/i).first and focus_view(t) 233 ${view},e: t = tags.grep(/^e/i).first and focus_view(t) 234 ${view},f: t = tags.grep(/^f/i).first and focus_view(t) 235 ${view},g: t = tags.grep(/^g/i).first and focus_view(t) 236 ${view},h: t = tags.grep(/^h/i).first and focus_view(t) 237 ${view},i: t = tags.grep(/^i/i).first and focus_view(t) 238 ${view},j: t = tags.grep(/^j/i).first and focus_view(t) 239 ${view},k: t = tags.grep(/^k/i).first and focus_view(t) 240 ${view},l: t = tags.grep(/^l/i).first and focus_view(t) 241 ${view},m: t = tags.grep(/^m/i).first and focus_view(t) 242 ${view},n: t = tags.grep(/^n/i).first and focus_view(t) 243 ${view},o: t = tags.grep(/^o/i).first and focus_view(t) 244 ${view},p: t = tags.grep(/^p/i).first and focus_view(t) 245 ${view},q: t = tags.grep(/^q/i).first and focus_view(t) 246 ${view},r: t = tags.grep(/^r/i).first and focus_view(t) 247 ${view},s: t = tags.grep(/^s/i).first and focus_view(t) 248 ${view},t: t = tags.grep(/^t/i).first and focus_view(t) 249 ${view},u: t = tags.grep(/^u/i).first and focus_view(t) 250 ${view},v: t = tags.grep(/^v/i).first and focus_view(t) 251 ${view},w: t = tags.grep(/^w/i).first and focus_view(t) 252 ${view},x: t = tags.grep(/^x/i).first and focus_view(t) 253 ${view},y: t = tags.grep(/^y/i).first and focus_view(t) 254 ${view},z: t = tags.grep(/^z/i).first and focus_view(t) 255 256 #--------------------------------------------------------------------------- 257 # move 258 #--------------------------------------------------------------------------- 259 260 ${move}-${up}: | # move grouping toward the top 261 grouping.each {|c| c.send(:up) rescue nil } 262 263 ${move}-${down}: | # move grouping toward the bottom 264 grouping.each {|c| c.send(:down) rescue nil } 265 266 ${move}-${left}: | # move grouping toward the left 267 grouping.each {|c| c.send(:left) rescue nil } 268 269 ${move}-${right}: | # move grouping toward the right 270 grouping.each {|c| c.send(:right) rescue nil } 271 272 ${move}-space: | # move grouping to floating area (toggle) 273 grouping.each {|c| c.send(:toggle) rescue nil } 274 275 ${move}-t: | # move grouping to chosen view 276 # 277 # Changes the tag (according to a menu choice) of 278 # each grouped client and returns the chosen tag. 279 # 280 # The +tag -tag idea is from Jonas Pfenniger: 281 # 282 # http://zimbatm.oree.ch/articles/2006/06/15/wmii-3-and-ruby 283 # 284 choices = tags.map {|t| [t, "+#{t}", "-#{t}"] }.flatten 285 286 if target = key_menu(choices, 'tag as:') 287 grouping.each {|c| c.tags = target } 288 end 289 290 # move grouping to the view whose index or name equals the pressed number 291 ${move}-1: grouping.each {|c| c.tags = tags[0] || 1 } 292 ${move}-2: grouping.each {|c| c.tags = tags[1] || 2 } 293 ${move}-3: grouping.each {|c| c.tags = tags[2] || 3 } 294 ${move}-4: grouping.each {|c| c.tags = tags[3] || 4 } 295 ${move}-5: grouping.each {|c| c.tags = tags[4] || 5 } 296 ${move}-6: grouping.each {|c| c.tags = tags[5] || 6 } 297 ${move}-7: grouping.each {|c| c.tags = tags[6] || 7 } 298 ${move}-8: grouping.each {|c| c.tags = tags[7] || 8 } 299 ${move}-9: grouping.each {|c| c.tags = tags[8] || 9 } 300 ${move}-0: grouping.each {|c| c.tags = tags[9] || 10 } 301 302 #--------------------------------------------------------------------------- 303 # group 304 #--------------------------------------------------------------------------- 305 306 ${group},g: | # toggle current client from grouping 307 curr_client.group! 308 309 ${group},c: | # add clients in current area to grouping 310 curr_area.group 311 312 ${group},Shift-c: | # remove clients in current area from grouping 313 curr_area.ungroup 314 315 ${group},f: | # add clients in floating area to grouping 316 Area.floating.group 317 318 ${group},Shift-f: | # remove clients in floating area from grouping 319 Area.floating.ungroup 320 321 ${group},m: | # add clients in managed areas to grouping 322 curr_view.managed_areas.each {|a| a.group } 323 324 ${group},Shift-m: | # remove clients in managed areas from grouping 325 curr_view.managed_areas.each {|a| a.ungroup } 326 327 ${group},v: | # add clients in current view to grouping 328 curr_view.group 329 330 ${group},Shift-v: | # remove clients in current view from grouping 331 curr_view.ungroup 332 333 ${group},i: | # invert the grouping in the current view 334 curr_view.group! 335 336 ${group},Shift-i: | # invert the grouping in all views 337 Rumai.group! 338 339 ${group},n: | # remove all clients everywhere from grouping 340 Rumai.ungroup 341 342 #--------------------------------------------------------------------------- 343 # swap 344 #--------------------------------------------------------------------------- 345 346 ${swap},${up}: | # swap with above client 347 curr_client.swap(:up) rescue nil 348 349 ${swap},${down}: | # swap with below client 350 curr_client.swap(:down) rescue nil 351 352 ${swap},${left}: | # swap with left client 353 curr_client.swap(:left) rescue nil 354 355 ${swap},${right}: | # swap with right client 356 curr_client.swap(:right) rescue nil 357 358 # swap current client with the column whose index equals the pressed number 359 ${swap},1: curr_client.swap 1 360 ${swap},2: curr_client.swap 2 361 ${swap},3: curr_client.swap 3 362 ${swap},4: curr_client.swap 4 363 ${swap},5: curr_client.swap 5 364 ${swap},6: curr_client.swap 6 365 ${swap},7: curr_client.swap 7 366 ${swap},8: curr_client.swap 8 367 ${swap},9: curr_client.swap 9 368 ${swap},0: curr_client.swap 10 369 370 #--------------------------------------------------------------------------- 371 # client 372 #--------------------------------------------------------------------------- 373 374 ${mod}-f: | # zoom client to fullscreen (toggle) 375 curr_client.fullscreen! 376 377 ${mod}-Shift-c: | # kill the current client 378 curr_client.kill 379 380 #--------------------------------------------------------------------------- 381 # column 382 #--------------------------------------------------------------------------- 383 384 ${mod}-d: | # apply equal-spacing layout to current column 385 curr_area.layout = 'default-max' 386 387 ${mod}-s: | # apply stacked layout to current column 388 curr_area.layout = 'stack-max' 389 390 ${mod}-m: | # apply maximized layout to current column 391 curr_area.layout = 'stack+max' 392 393 #--------------------------------------------------------------------------- 394 # menu 395 #--------------------------------------------------------------------------- 396 397 ${mod}-a: | # run internal action chosen from a menu 398 if choice = key_menu(actions, 'run action:') 399 action choice 400 end 401 402 ${mod}-p: | # run external program chosen from a menu 403 if choice = key_menu(@programs, 'run program:') 404 launch choice 405 end 406 407 ${mod}-t: | # focus view chosen from a menu 408 if choice = key_menu(tags, 'show view:') 409 focus_view choice 410 end 411 412 #--------------------------------------------------------------------------- 413 # launcher 414 #--------------------------------------------------------------------------- 415 416 ${mod}-Return: | # launch a terminal 417 # 418 # Launch a new terminal and set its 419 # working directory to be the same 420 # as the currently focused terminal. 421 # 422 work = ENV['HOME'] 423 424 label = curr_client.label.read rescue '' 425 426 # iterate in reverse order because 427 # paths are usually at end of label 428 label.split(' ').reverse_each do |s| 429 path = File.expand_path(s) 430 431 if File.exist? path 432 unless File.directory? path 433 path = File.dirname(path) 434 end 435 436 work = path 437 break 438 end 439 end 440 441 require 'fileutils' 442 FileUtils.cd work do 443 launch CONFIG['program']['terminal'] 444 end 445 446 ## 447 # Event handlers. 448 # 449 # <event name>: <Ruby code to execute> 450 # 451 # The Ruby code has access to an "argv" variable which 452 # is a list of arguments that were passed to the event. 453 # 454 event: 455 CreateTag: | 456 tag = argv[0] 457 but = fs.lbar[tag] 458 but.create unless but.exist? 459 but.write "#{CONFIG['display']['color']['normal']} #{tag}" 460 461 DestroyTag: | 462 tag = argv[0] 463 but = fs.lbar[tag] 464 but.remove if but.exist? 465 466 FocusTag: | 467 tag = argv[0] 468 but = fs.lbar[tag] 469 but.write "#{CONFIG['display']['color']['focus']} #{tag}" if but.exist? 470 471 UnfocusTag: | 472 tag = argv[0] 473 but = fs.lbar[tag] 474 but.write "#{CONFIG['display']['color']['normal']} #{tag}" if but.exist? 475 476 UrgentTag: | 477 tag = argv[1] 478 but = fs.lbar[tag] 479 but.write "#{CONFIG['display']['color']['notice']} #{tag}" if but.exist? 480 481 NotUrgentTag: | 482 tag = argv[1] 483 but = fs.lbar[tag] 484 color = curr_view.id == tag ? 'focus' : 'normal' 485 but.write "#{CONFIG['display']['color'][color]} #{tag}" if but.exist? 486 487 LeftBarClick: &LeftBarClick | 488 mouse_button, view_id = argv 489 490 if mouse_button == '1' # primary button 491 focus_view view_id 492 end 493 494 ## 495 # allows the user to drag a file over a 496 # view button and activate that view while 497 # still holding on to their dragged file! 498 # 499 LeftBarDND: *LeftBarClick 500 501 RightBarClick: | 502 status_click *argv.reverse 503 504 ClientMouseDown: | 505 client_id, mouse_button = argv 506 507 if mouse_button == '3' # secondary button 508 client = Client.new(client_id) 509 510 case click_menu %w[stick group fullscreen kill slay], 'client' 511 when 'stick' then client.stick! 512 when 'group' then client.group! 513 when 'fullscreen' then client.fullscreen! 514 when 'kill' then client.kill 515 when 'slay' then client.slay 516 end 517 end 518 519 ## 520 # Internal scripts. 521 # 522 # <action name>: <Ruby code to execute> 523 # 524 action: 525 526 527 ## 528 # Arbitrary logic. 529 # 530 # script: 531 # before: <Ruby code to execute before processing this file> 532 # after: <Ruby code to execute after processing this file> 533 # 534 script: 535 before: 536 after: