wmiirc-rumai

git clone git://oldgit.suckless.org/wmiirc-rumai/
Log | Files | Refs | README | LICENSE

commit 201e919dd25bd8d6f72597f200f7b0629a51034d
parent 20527abd9f827ea6b50492490d8c60e80f0922a5
Author: Suraj N. Kurapati <sunaku@gmail.com>
Date:   Thu, 31 Aug 2006 03:38:03 -0700

[project @ 0d07971c2a9f50301d0d59a7a02b22e554440a6a]

[project @ 18]
method names are written in_snake_case

Diffstat:
wmii.rb | 22+++++++++++-----------
wmiirc | 40++++++++++++++++++++--------------------
2 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/wmii.rb b/wmii.rb @@ -132,12 +132,12 @@ class Wmii end # Shows the view with the given name. - def showView aName + def focus_view aName View.new(self, "/#{aName}").focus! end # Shows a WM menu with the given content and returns its output. - def showMenu aContent + def show_menu aContent output = nil IO.popen('wmiimenu', 'r+') do |menu| @@ -151,7 +151,7 @@ class Wmii end # Shows the client which has the given ID. - def showClient aClientId + def focus_client aClientId views.each do |v| v.areas.each do |a| a.clients.each do |c| @@ -169,19 +169,19 @@ class Wmii DETACHED_TAG = 'status' # Detach the currently selected client - def detachClient + def detach_current_client current_client.tags = DETACHED_TAG end # Attach the most recently detached client - def attachClient + def attach_last_client if c = View.new(self, "/#{DETACHED_TAG}").areas.first.clients.first c.tags = read('/view/name') end end # Changes the current view to an adjacent one (:left or :right). - def cycleView aTarget + def cycle_view aTarget tags = self.tags curTag = current_view.name curIndex = tags.index(curTag) @@ -199,12 +199,12 @@ class Wmii end % tags.length - showView tags[newIndex] + focus_view tags[newIndex] end =begin # Renames the given view and sends its clients along for the ride. - def renameView aOld, aNew + def rename_view aOld, aNew read('/client').split.each do |id| tags = read("/client/#{id}/tags") @@ -214,7 +214,7 @@ class Wmii =end # Applies wmii-2 style tiling layout to the current view while maintaining the order of clients in the current view. Only the first client in the primary column is kept; all others are evicted to the *top* of the secondary column. Any teritiary, quaternary, etc. columns are squeezed into the *bottom* of the secondary column. - def applyTilingLayout + def apply_tiling_layout areaList = read('/view').split.grep(/^[^0]\d*$/) unless areaList.empty? @@ -244,7 +244,7 @@ class Wmii end # Applies wmii-2 style grid layout to the current view while maintaining the order of clients in the current view. If the maximum number of clients per column, the distribution of clients among the columns is calculated according to wmii-2 style. Only the first client in the primary column is kept; all others are evicted to the *top* of the secondary column. Any teritiary, quaternary, etc. columns are squeezed into the *bottom* of the secondary column. - def applyGridLayout aMaxClientsPerColumn = nil + def apply_grid_layout aMaxClientsPerColumn = nil # determine client distribution unless aMaxClientsPerColumn numClients = 0 @@ -304,7 +304,7 @@ class Wmii end # Returns a list of program names available in the given paths. - def findPrograms *aPaths + def find_programs *aPaths list = [] Find.find(*aPaths) do |f| diff --git a/wmiirc b/wmiirc @@ -63,8 +63,8 @@ EOF # system 'xsetroot -solid "#333333"' system 'status &' -PROGRAM_MENU = WM.findPrograms(*ENV['PATH'].split(':')).join("\n") -ACTION_MENU = WM.findPrograms('/home/sun/dry/apps/wmii/etc/wmii-3', '~/.wmii-3').join("\n") +PROGRAM_MENU = WM.find_programs(*ENV['PATH'].split(':')).join("\n") +ACTION_MENU = WM.find_programs('/home/sun/dry/apps/wmii/etc/wmii-3', '~/.wmii-3').join("\n") # KEY CONFIGURATION @@ -105,11 +105,11 @@ SHORTCUTS = { "#{SELECT}comma" => lambda do - WM.cycleView :left + WM.cycle_view :left end, "#{SELECT}period" => lambda do - WM.cycleView :right + WM.cycle_view :right end, @@ -132,11 +132,11 @@ SHORTCUTS = { "#{LAYOUT}t" => lambda do - WM.applyTilingLayout + WM.apply_tiling_layout end, "#{LAYOUT}g" => lambda do - WM.applyGridLayout + WM.apply_grid_layout end, @@ -159,16 +159,16 @@ SHORTCUTS = { "#{MENU}i" => lambda do - action = WM.showMenu(ACTION_MENU) + action = WM.show_menu(ACTION_MENU) system(action << '&') unless action.empty? end, "#{MENU}e" => lambda do - program = WM.showMenu(PROGRAM_MENU) + program = WM.show_menu(PROGRAM_MENU) system(program << '&') unless program.empty? end, - "#{MENU}v" => lambda do WM.showView(WM.showMenu(WM.read('/tags'))) end, + "#{MENU}v" => lambda do WM.focus_view(WM.show_menu(WM.read('/tags'))) end, # focus any client by choosing from a menu "#{MENU}a" => lambda do @@ -182,10 +182,10 @@ SHORTCUTS = { # show the menu and focus the chosen client - target = WM.showMenu(choices.join("\n")) + target = WM.show_menu(choices.join("\n")) unless target.empty? - WM.showClient target.scan(/\d+/).first + WM.focus_client target.scan(/\d+/).first end end, @@ -223,7 +223,7 @@ SHORTCUTS = { # +tag -tag idea from Jonas Pfenniger <http://zimbatm.oree.ch/articles/2006/06/15/wmii-3-and-ruby> "#{SEND}t" => lambda do choices = WM.tags.map {|t| [t, "+#{t}", "-#{t}"]}.flatten - target = WM.showMenu(choices.join("\n")) + target = WM.show_menu(choices.join("\n")) WM.selected_clients.each do |c| c.with_tags do @@ -244,13 +244,13 @@ SHORTCUTS = { "#{SEND}d" => lambda do # WM.with_selection do - WM.detachClient + WM.detach_current_client # end end, "#{SEND}Shift-d" => lambda do # WM.with_selection do - WM.attachClient + WM.attach_last_client # end end, @@ -265,11 +265,11 @@ SHORTCUTS = { # NOTE: columns & layouts are not preserved "#{SEND}r" => lambda do old = WM.read('/view/name') - new = WM.showMenu(WM.read('/tags')) + new = WM.show_menu(WM.read('/tags')) unless new.empty? - WM.renameView old, new - WM.showView new + WM.rename_view old, new + WM.focus_view new end end, =end @@ -286,7 +286,7 @@ SHORTCUTS = { k = (i - 1) % 10 # associate '1' with the leftmost label, instead of '0' SHORTCUTS["#{SELECT}#{i}"] = lambda do - WM.showView(WM.read('/tags').split[k] || i) + WM.focus_view(WM.read('/tags').split[k] || i) end SHORTCUTS["#{SEND}#{i}"] = lambda do @@ -294,7 +294,7 @@ SHORTCUTS = { end SHORTCUTS["#{LAYOUT}#{i}"] = lambda do - WM.applyGridLayout i + WM.apply_grid_layout i end @@ -342,7 +342,7 @@ begin exit if arg == 'wmiirc' when 'BarClick' - WM.showView arg + WM.focus_view arg when 'ClientClick' client, button = arg.split