event-loop documentation update
[wmiirc-lua.git] / wmiirc.lua
blob50d124f718747033f849c784f6c2b0717b329875
1 #!/usr/bin/env lua
2 --
3 -- Copyrigh (c) 2007, Bart Trojanowski <bart@jukie.net>
4 --
5 -- Some stuff below will eventually go to a separate file, and configuration
6 -- will remain here similar to the split between the wmii+ruby wmiirc and
7 -- wmiirc-config. For now I just want to get the feel of how things will
8 -- work in lua.
9 --
10 -- git://www.jukie.net/wmiirc-lua.git/
12 io.stderr:write ("----------------------------------------------\n")
14 -- load wmii.lua
15 package.path = package.path
16 .. ";" .. os.getenv("HOME") .. "/.wmii-3.5/core/?.lua"
17 .. ";" .. os.getenv("HOME") .. "/.wmii-3.5/plugins/?.lua"
18 require "wmii"
20 -- This is the base configuration of wmii, it writes to the /ctl file.
21 wmii.set_ctl ({
22 view = 1,
23 border = 1,
24 font = '-windows-proggytiny-medium-r-normal--10-80-96-96-c-60-iso8859-1',
25 focuscolors = '#FFFFaa #007700 #88ff88',
26 normcolors = '#888888 #222222 #333333',
27 grabmod = 'Mod1'
30 -- This overrides some variables that are used by event and key handlers.
31 -- TODO: need to have a list of the standard ones somewhere.
32 -- For now look in the wmii.lua for the key_handlers table, it
33 -- will reference the variables as getconf("varname").
34 -- If you add your own actions, or key handlers you are encouraged to
35 -- use configuration values as appropriate with wmii.setconf("var", "val"), or
36 -- as a table like the example below.
37 wmii.set_conf ({
38 xterm = 'x-terminal-emulator'
41 -- colrules file contains a list of rules which affect the width of newly
42 -- created columns. Rules have a form of
43 -- /regexp/ -> width[+width[+width...]]
44 -- When a new column, n, is created on a view whose name matches regex, the
45 -- n'th given width percentage of the screen is given to it. If there is
46 -- no nth width, 1/ncolth of the screen is given to it.
48 wmii.write ("/colrules", "/.*/ -> 50+50\n"
49 .. "/gaim/ -> 80+20\n")
51 -- tagrules file contains a list of riles which affect which tags are
52 -- applied to a new client. Rules has a form of
53 -- /regexp/ -> tag[+tag[+tag...]]
54 -- When client's name:class:title matches regex, it is given the
55 -- tagstring tag(s). There are two special tags:
56 -- sel (or the deprecated form: !) represents the current tag, and
57 -- ~ which represents the floating layer
58 wmii.write ("/tagrules", "/XMMS.*/ -> ~\n"
59 .. "/Firefox.*/ -> www\n"
60 .. "/Gimp.*/ -> ~\n"
61 .. "/Gimp.*/ -> gimp\n"
62 .. "/Gaim.*/ -> gaim\n"
63 .. "/MPlayer.*/ -> ~\n"
64 .. "/.*/ -> sel\n"
65 .. "/.*/ -> 1\n")
67 -- load some plugins
68 require "clock"
69 require "dstat_load"
71 -- ------------------------------------------------------------------------
72 -- configuration is finished, run the event loop
73 wmii.run_event_loop()