3 -- Copyrigh (c) 2007, Bart Trojanowski <bart@jukie.net>
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
10 -- http://www.jukie.net/~bart/blog/tag/wmiirc-lua
11 -- git://www.jukie.net/wmiirc-lua.git/
14 io
.stderr
:write ("----------------------------------------------\n")
17 local wmiidir
= ("%HOME_WMII%"):gsub("^~", os
.getenv("HOME"))
18 package
.path
= wmiidir
.. "/core/?.lua;" ..
19 wmiidir
.. "/plugins/?.lua;" ..
24 -- Setup my environment (completely optional)
26 local hostname
= os
.getenv("HOSTNAME")
27 local homedir
= os
.getenv("HOME") or "~"
30 -- conditionally load up my xmodmaprc
31 if type(hostname) == 'string' and hostname:match("^oxygen") then
32 os.execute ("xmodmap ~/.xmodmaprc")
35 -- add ssh keys if they are not in the agent already
36 os.execute ("if ( ! ssh-add -l >/dev/null ) || test $(ssh-add -l | wc -l) = 0 ; then "
37 .. "ssh-add </dev/null ; fi")
39 -- this lets me have progyfonts in ~/.fonts
40 os.execute ("~/.fonts/rebuild")
42 -- restore the mixer settings
43 os.execute ("aumix -L")
45 -- this hids the mouse cursor after a timeout
46 os.execute ("unclutter &")
49 os.execute ("xset r on")
50 os.execute ("xset r rate 200 25")
51 os.execute ("xset b off")
52 os.execute ("xrandr --dpi 96")
54 -- clear the background
55 os.execute ("xsetroot -solid black")
57 -- this will prime the alt-p menu's cache
58 os.execute ("dmenu_path>/dev/null&")
61 -- This is the base configuration of wmii, it writes to the /ctl file.
64 font
= '-windows-proggytiny-medium-r-normal--10-80-96-96-c-60-iso8859-1',
65 focuscolors
= '#FFFFaa #007700 #88ff88',
66 normcolors
= '#FFFFFF #222222 #333333',
70 -- Set slightly different colors on each screen.
71 wmii
.set_screen_ctl(0, {
72 focuscolors
= '#FFFFaa #007700 #88ff88'
74 wmii
.set_screen_ctl(1, {
75 focuscolors
= '#FFFFaa #770000 #ff8888'
77 wmii
.set_screen_ctl(2, {
78 focuscolors
= '#FFFFaa #000077 #8888ff'
81 -- This overrides some variables that are used by event and key handlers.
82 -- TODO: need to have a list of the standard ones somewhere.
83 -- For now look in the wmii.lua for the key_handlers table, it
84 -- will reference the variables as getconf("varname").
85 -- If you add your own actions, or key handlers you are encouraged to
86 -- use configuration values as appropriate with wmii.setconf("var", "val"), or
87 -- as a table like the example below.
89 xterm
= 'x-terminal-emulator',
90 -- xlock = '/usr/bin/xtrlock',
94 -- colrules file contains a list of rules which affect the width of newly
95 -- created columns. Rules have a form of
96 -- /regexp/ -> width[+width[+width...]]
97 -- When a new column, n, is created on a view whose name matches regex, the
98 -- n'th given width percentage of the screen is given to it. If there is
99 -- no nth width, 1/ncolth of the screen is given to it.
101 wmii
.write ("/colrules", "/.*/ -> 50+50\n"
102 .. "/gaim/ -> 80+20\n")
104 -- tagrules file contains a list of riles which affect which tags are
105 -- applied to a new client. Rules has a form of
106 -- /regexp/ -> tag[+tag[+tag...]]
107 -- When client's name:class:title matches regex, it is given the
108 -- tagstring tag(s). There are two special tags:
109 -- sel (or the deprecated form: !) represents the current tag, and
110 -- ~ which represents the floating layer
111 wmii
.write ("/tagrules", "/XMMS.*/ -> ~\n"
112 .. "/Firefox.*/ -> www\n"
113 .. "/Iceweasel.*/ -> www\n"
114 .. "/vimperator/ -> www\n"
115 .. "/a[Kk]regator/ -> www\n"
117 .. "/Gimp.*/ -> gimp\n"
118 .. "/Gaim.*/ -> gaim\n"
120 .. "/MPlayer.*/ -> ~\n"
121 .. "/x?vnc[^ ]*viewer.*/ -> ~\n"
122 .. "/VNC.*:VNC.*/ -> ~\n"
127 wmii
.load_plugin ("messages")
128 wmii
.load_plugin ("clock")
129 wmii
.load_plugin ("loadavg")
130 wmii
.load_plugin ("volume")
131 wmii
.load_plugin ("browser")
132 wmii
.load_plugin ("view_workdir")
133 wmii
.load_plugin ("cpu")
135 wmii
.load_plugin ("battery")
136 wmii
.set_conf("battery.names", "BAT0")
138 wmii
.load_plugin ("ssh")
139 wmii
.add_key_handler ("Mod1-z", ssh
.show_menu
)
143 wmii
.add_key_handler ('XF86KbdBrightnessUp', function (key
) os
.execute("xbacklight -steps 1 -time 0 -inc 10") end)
144 wmii
.add_key_handler ('XF86KbdBrightnessDown', function (key
) os
.execute("xbacklight -steps 1 -time 0 -dec 10") end)
146 wmii
.add_action_handler ("hibernate-disk",
148 os
.execute ('gksudo hibernate-disk')
153 -- here are some other examples...
156 -- use Mod1-tab to flip to the previous view
157 wmii.remap_key_handler ("Mod1-r", "Mod1-tab")
161 -- ------------------------------------------------------------------------
162 -- configuration is finished, run the event loop
163 wmii
.run_event_loop()