remove history from TODO
[wmiirc-lua.git] / wmiirc.lua
blobb6f30691c53ff5ae1408dc7e06778a0108503252
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 -- http://www.jukie.net/~bart/blog/tag/wmiirc-lua
11 -- git://www.jukie.net/wmiirc-lua.git/
14 io.stderr:write ("----------------------------------------------\n")
16 -- load wmii.lua
17 local wmiidir = os.getenv("HOME") .. "/.wmii-3.5"
18 package.path = wmiidir .. "/core/?.lua;" ..
19 wmiidir .. "/plugins/?.lua;" ..
20 package.path
21 require "wmii"
23 -- Setup my environment (completely optional)
25 --[[
26 -- conditionally load up my xmodmaprc
27 hostname = os.getenv("HOSTNAME")
28 if type(hostname) == 'string' and hostname:match("^oxygen") then
29 os.execute ("xmodmap ~/.xmodmaprc")
30 end
32 -- add ssh keys if they are not in the agent already
33 os.execute ("if ( ! ssh-add -l >/dev/null ) || test $(ssh-add -l | wc -l) = 0 ; then "
34 .. "ssh-add </dev/null ; fi")
36 -- this lets me have progyfonts in ~/.fonts
37 os.execute ("~/.fonts/rebuild")
39 -- restore the mixer settings
40 os.execute ("aumix -L")
42 -- this hids the mouse cursor after a timeout
43 os.execute ("unclutter &")
45 -- configure X
46 os.execute ("xset r on")
47 os.execute ("xset r rate 200 25")
48 os.execute ("xset b off")
50 -- clear the background
51 os.execute ("xsetroot -solid black")
52 --]]
54 -- This is the base configuration of wmii, it writes to the /ctl file.
55 wmii.set_ctl ({
56 view = 1,
57 border = 1,
58 font = '-windows-proggytiny-medium-r-normal--10-80-96-96-c-60-iso8859-1',
59 focuscolors = '#FFFFaa #007700 #88ff88',
60 normcolors = '#888888 #222222 #333333',
61 grabmod = 'Mod1'
64 -- This overrides some variables that are used by event and key handlers.
65 -- TODO: need to have a list of the standard ones somewhere.
66 -- For now look in the wmii.lua for the key_handlers table, it
67 -- will reference the variables as getconf("varname").
68 -- If you add your own actions, or key handlers you are encouraged to
69 -- use configuration values as appropriate with wmii.setconf("var", "val"), or
70 -- as a table like the example below.
71 wmii.set_conf ({
72 xterm = 'x-terminal-emulator'
75 -- colrules file contains a list of rules which affect the width of newly
76 -- created columns. Rules have a form of
77 -- /regexp/ -> width[+width[+width...]]
78 -- When a new column, n, is created on a view whose name matches regex, the
79 -- n'th given width percentage of the screen is given to it. If there is
80 -- no nth width, 1/ncolth of the screen is given to it.
82 wmii.write ("/colrules", "/.*/ -> 50+50\n"
83 .. "/gaim/ -> 80+20\n")
85 -- tagrules file contains a list of riles which affect which tags are
86 -- applied to a new client. Rules has a form of
87 -- /regexp/ -> tag[+tag[+tag...]]
88 -- When client's name:class:title matches regex, it is given the
89 -- tagstring tag(s). There are two special tags:
90 -- sel (or the deprecated form: !) represents the current tag, and
91 -- ~ which represents the floating layer
92 wmii.write ("/tagrules", "/XMMS.*/ -> ~\n"
93 .. "/Firefox.*/ -> www\n"
94 .. "/Gimp.*/ -> ~\n"
95 .. "/Gimp.*/ -> gimp\n"
96 .. "/Gaim.*/ -> gaim\n"
97 .. "/MPlayer.*/ -> ~\n"
98 .. "/.*/ -> sel\n"
99 .. "/.*/ -> 1\n")
101 -- load some plugins
102 wmii.load_plugin ("messages")
103 wmii.load_plugin ("clock")
104 wmii.load_plugin ("dstat_load")
105 wmii.load_plugin ("browser")
108 -- here are some other examples...
109 --[[
111 -- use Mod1-tab to flip to the previous view
112 wmii.remap_key_handler ("Mod1-r", "Mod1-tab")
114 --]]
116 -- ------------------------------------------------------------------------
117 -- configuration is finished, run the event loop
118 wmii.run_event_loop()