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