removing outdated emacs files (soon to be replaced with recent ones)
[srid.dotfiles.git] / dot-wmii-3 / wmiirc-config.rb
blob58f939e4bef2fda6027d0f34b7e2b10e938727dc
1 # {{{ ======== ruby-wmii CONFIGURATION BEGINS HERE ==============
2  
3 # Set the log level
4 # It defaults to Logger::INFO.
5 # Set to Logger::DEBUG for extra verbosity.
6 #LOGGER.level = Logger::DEBUG
8 # programs to run when wmiirc starts
9 # one per line, they're run sequentially right before the main loop begins
10 START_PROGS = <<EOF
11 xsetroot -solid '#333333'
12 xmodmap  ~/.xmodmap
13 gnome-settings-daemon &
14 gnome-terminal -e "screen -dDR" &
15 sensible-browser &
16 emacs &
17 EOF
19 # {{{ WM CONFIGURATION
20 WMII::Configuration.define do
21   border      1
22   font        "fixed"
23   selcolors   '#FFFFFF #248047 #147027'
24   normcolors  '#4D4E4F #DDDDAA #FFFFCC'
25   colmode     'default'
26   colwidth    0
27   grabmod     'Mod1'
28   rules <<EOF
29 /Kdict.*/ -> dict
30 /XMMS.*/ -> ~
31 /Gimp.*/ -> ~
32 /MPlayer.*/ -> ~
33 /XForm.*/ -> ~
34 /XSane.*/ -> ~
35 /fontforge.*/ -> ~
36 /.*/ -> !
37 /.*/ -> 1
38 EOF
40   # Translate the following names in the on_key and use_binding definitions.
41   key_subs  :MODKEY  => :Mod1,
42             :MODKEY2 => :Mod4,
43             :LEFT    => :h,
44             :RIGHT   => :l,
45             :UP      => :k,
46             :DOWN    => :j
49   # Constant used by the intellisort tag selection mechanism
50   # set it to   0.0 <= value <= 1.0
51   # Lower values make recent choices more likely (modified first order
52   # markovian process with exponential decay):
53   # 0.0 means that only the last transition counts (all others forgotten)
54   # 1.0 means that the probabilities aren't biased to make recent choices more
55   #     likely
56   view_history_decay 0.8
58   # Favor the view we came from in intellisort.
59   # 1.0: that view is the first choice
60   # 0.0: that view comes after all views with non-zero transition probability,
61   #      but before all views we haven't yet jumped to from the current one
62   view_history_prev_bias 0.4
64 # {{{ Plugin config
65   
66   # Uncomment and change to override default on_click actions for the status
67   # bar
68   #plugin_config["standard:status"]["left_click_action"] = lambda{ system "xeyes" }
69   #plugin_config["standard:status"]["right_click_action"] = lambda{ system "xeyes" }
70   #plugin_config["standard:status"]["middle_click_action"] = lambda{ system "xeyes" }
71   
72   plugin_config["standard:status"]["refresh_time"] = 1
73   
74   # Uncomment and change to override default text
75   #currload = nil
76   #Thread.new{ loop { currload = `uptime`.chomp.sub(/.*: /,"").gsub(/,/,""); sleep 10 } }
77   #plugin_config["standard:status"]["text_proc"] = lambda do
78   #  "#{Time.new.strftime("%d/%m/%Y %X %Z")} #{currload}"
79   #end
81   plugin_config["standard"]["x-terminal-emulator"] = "x-terminal-emulator"
83   plugin_config["standard:actions"]["history_size"] = 3  # set to 0 to disable
84   plugin_config["standard:programs"]["history_size"] = 5 # set to 0 to disable
86   plugin_config["standard:volume"]["mixer"] = "Master"
87   
88   plugin_config["standard:mode"]["mode_toggle_keys"] = ["MODKEY2-space"]
90   plugin_config["standard:battery-monitor"]["statefile"] = 
91       '/proc/acpi/battery/BAT0/state'
92   plugin_config["standard:battery-monitor"]["infofile"] =
93       '/proc/acpi/battery/BAT0/info'
94   plugin_config["standard:battery-monitor"]["low"] = 5
95   plugin_config["standard:battery-monitor"]["low_action"] =
96       'echo "Low battery" | xmessage -center -buttons quit:0 -default quit -file -'
97   plugin_config["standard:battery-monitor"]["critical"] = 1
98   plugin_config["standard:battery-monitor"]["critical_action"] =
99     'echo "Critical battery" | xmessage -center -buttons quit:0 -default quit -file -'
100   plugin_config["wireless:wireless"]["interface"] = "eth1"
101   plugin_config["wireless:wireless"]["interval"] = 5
103   # Allows you to override the default internal actions and define new ones:
104   #plugin_config["standard:actions"]["internal"].update({
105   #  "screenshot" => nil,    # remove default screenshot action
106   #  "google" => lambda do |wmii, *selection|
107   #    require 'cgi'
108   #    if selection && !selection.empty?
109   #      selection = CGI.escape(selection.join(" "))
110   #    else
111   #      selection = CGI.escape(%!#{`wmiipsel`.strip}!)
112   #    end
113   #    url = "http://www.google.com/search?q=#{selection}"
114   #    case browser = ENV["BROWSER"]
115   #    when nil: system "wmiisetsid /etc/alternatives/x-www-browser '#{url}' &"
116   #    else system "wmiisetsid #{browser} '#{url}' &"
117   #    end
118   #  end,
119   #  "foo" => lambda do |wmii, *args|
120   #    IO.popen("xmessage -file -", "w"){|f| f.puts "Args: #{args.inspect}"; f.close_write }
121   #  end
122   #})
124 #{{{ Import bindings and bar applets
125   from "standard"  do
126     use_bar_applet "volume", 999
127     use_bar_applet "mode", 900
128     use_bar_applet "status", 100
129     #use_bar_applet "cpuinfo", 150
130     #use_bar_applet "mpd", 110
131     #use_bar_applet "battery-monitor
133     use_binding "dict-lookup"
134     use_binding "lock-x"
135     use_binding "execute-program-with-tag"
136     use_binding "execute-action"
137     use_binding "execute-program"
138     (0..9).each{|k| use_binding "numeric-jump-#{k}"  }
139     use_binding "tag-jump"
140     use_binding "retag"
141     use_binding "retag-jump"
142     use_binding "namespace-retag"
143     use_binding "namespace-retag-jump"
144     ('a'..'z').each{|k| use_binding "letter-jump-#{k}" }
145     (0..9).each{|k| use_binding "numeric-retag-#{k}" }
146     use_binding "move-prev"
147     use_binding "move-next"
148     use_binding "namespace-move-prev"
149     use_binding "namespace-move-next"
150     use_binding "history-move-forward"
151     use_binding "history-move-back"
153     use_binding "bookmark"
154     use_binding "bookmark-open"
155   end
157   
158   from "wireless" do
159     use_bar_applet "wireless", 400
160   end
162   from "notifier" do
163     use_bar_applet "notifier", 1
164   end
166   from "yubnub" do
167     use_binding "menu"
168   end
169   
170   # {{{ del.icio.us bookmark import
171   #plugin_config["standard:bookmark"]["del.icio.us-user"] = 'myusername'
172   #plugin_config["standard:bookmark"]["del.icio.us-password"] = 'mypass'
175   # {{{ Click on view bars
176   on_barclick(/./, MOUSE_BUTTON_LEFT){|name,| view name}
177   on_barclick(/./, MOUSE_BUTTON_RIGHT){|name,| view name}
179   # {{{ Tag all browser instances as 'web' in addition to the current tag
180   # browsers = %w[Firefox Konqueror]
181   # browser_re = /^#{browsers.join("|")}/
182   # on_createclient(condition{|c| browser_re =~ read("/client/#{c}/class")}) do |cid|
183   #   write("/client/#{cid}/tags", normalize(read("/client/#{cid}/tags") + "+web"))
184   # end
186 #{{{ Simpler key bindings --- not defined in plugins
187   on_key("MODKEY-LEFT"){ write "/view/ctl", "select prev" }
188   on_key("MODKEY-RIGHT"){ write "/view/ctl", "select next" }
189   on_key("MODKEY-DOWN"){ write "/view/sel/ctl", "select next" }
190   on_key("MODKEY-UP"){ write "/view/sel/ctl", "select prev" }
191   on_key("MODKEY-space"){ write "/view/ctl", "select toggle" }
192   on_key("MODKEY-Shift-d"){ write "/view/sel/mode", "default" }
193   on_key("MODKEY-s"){ write "/view/sel/mode", "stack" }
194   on_key("MODKEY-m"){ write "/view/sel/mode", "max" }
195   on_key("MODKEY-Shift-f"){ write "/view/0/sel/geom", "0 0 east south" }
196   on_key("MODKEY-i"){ write "/view/sel/sel/geom", "+0 +0 +0 +48" }
197   on_key("MODKEY-Shift-i"){ write "/view/sel/sel/geom", "+0 +0 +0 -48" }
198   on_key("MODKEY-Return") do 
199     term = plugin_config["standard"]["x-terminal-emulator"] || "xterm"
200     system "wmiisetsid #{term} &"
201   end
202   on_key("MODKEY-Shift-LEFT"){ write "/view/sel/sel/ctl", "sendto prev" }
203   on_key("MODKEY-Shift-RIGHT"){ write "/view/sel/sel/ctl", "sendto next" }
204   on_key("MODKEY-Shift-DOWN"){ write "/view/sel/sel/ctl", "swap down" }
205   on_key("MODKEY-Shift-UP"){ write "/view/sel/sel/ctl", "swap up" }
206   on_key("MODKEY-Shift-space"){ write "/view/sel/sel/ctl", "sendto toggle" }
207   on_key("MODKEY-Shift-c"){ write "/view/sel/sel/ctl", "kill" }
208   on_key("MODKEY-r"){ view prev_view }
209   on_key("MODKEY-Control-LEFT") { write "/view/sel/sel/ctl", "swap prev" }
210   on_key("MODKEY-Control-RIGHT"){ write "/view/sel/sel/ctl", "swap next" }
212   
213 # {{{ ======== CONFIGURATION ENDS HERE ==============