NAME SYNOPSIS DESCRIPTION OPTIONS EXAMPLES HACKING VERSIONS AUTHORS CREDITS LICENSE SEE ALSO

rumai(1)

  1. rumai(1)
  2. Version 3.2.3
  3. rumai(1)

NAME

rumai - Ruby interface to the wmii window manager

Rumai is a pure Ruby interface to the wmii window manager. Its name is a portmanteau of "Ruby" and "wmii" (which I pronounce as "vim eye").

Features

Resources

Issue tracker (report bugs, request features, get help)

http://github.com/sunaku/rumai/issues

Source code (browse online or obtain with Git)

http://github.com/sunaku/rumai

API documentation

http://snk.tuxfamily.org/lib/rumai/api/

Announcements feed

http://snk.tuxfamily.org/lib/rumai/ann.xml

Official website

http://snk.tuxfamily.org/lib/ember/

Setup

Prerequisites:

Installing:

gem install rumai

Upgrading:

gem update rumai

Removing:

gem uninstall rumai

SYNOPSIS

rumai [OPTIONS] [IRB_OPTIONS]

DESCRIPTION

Starts an interactive Ruby shell (IRB) session by passing the given IRB_OPTIONS to irb(1). This puts you at a command prompt as follows:

irb(Rumai):001:0>

The irb(Rumai) token in the command prompt indicates that commands will be evaluated inside the Rumai module. As a result, you can omit the "Rumai" prefix from your commands if you wish.

For example, to get the currently selected client, you can type curr_client instead of Rumai.curr_client at the prompt. Both commands achieve the same effect.

The next thing to notice is that TAB completion is enabled. So you can type part of a command and press the TAB key to see a list of possible completions.

OPTIONS

-h, --help

Display this manual and exit.

-v, --version

Print version number and exit.

EXAMPLES

Now that you know how to start the interactive shell (see DESCRIPTION above) let us walk through a series of examples that highlight the main features of Rumai. You can follow along by copying & pasting the presented commands into the interactive shell.

Automated client arrangement

Launch a few terminals so that we have something to work with:

colors = %w[ red green blue black orange brown gray navy gold ]
colors.each {|c| system "xterm -bg #{c} -title #{c} -e sh -c read &" }

Arrange all clients in a grid:

curr_view.arrange_in_grid

Arrange all clients in a diamond shape:

curr_view.arrange_in_diamond

Arrange all clients like LarsWM does:

curr_view.arrange_as_larswm

Close the terminals we launched earlier:

terms = curr_view.clients.select {|c| colors.include? c.label.read }
terms.each {|c| c.kill }

Multiple client grouping

Launch a few terminals so that we have something to work with:

colors = %w[ red green blue black orange brown gray navy gold ]
colors.each {|c| system "xterm -bg #{c} -title #{c} -e sh -c read &" }

Add the red, green, and blue terminals into the "grouping":

terms = curr_view.clients.select do |c|
  %w[red green blue].include? c.label.read
end
terms.each {|c| c.group }

You should now see a new button labelled as "@" on the left-hand side of wmii's bar, indicating that there is now a new view labelled "@" in wmii. Let us inspect what clients this mysterious view contains:

v = View.new "@"
puts v.clients.map {|c| c.label.read }

Aha! The mysterious view contains the red, green, and blue clients we recently "grouped". Thus, by adding a client to the "grouping", we are simply tagging the client with the "@" token.

Now that we have put some clients into the "grouping", let us move all clients in the grouping to the floating area in the current view:

grouping.each {|c| c.send "toggle" }

Neat! Let us bring them back into the managed area:

grouping.each {|c| c.send "toggle" }

Close the terminals we launched earlier:

terms = curr_view.clients.select {|c| colors.include? c.label.read }
terms.each {|c| c.kill }

In summary, you can select multiple clients (by adding them to the "grouping") and perform operations on them. This is useful when you want to do something with a group of clients but do not want to manually focus one, perform the action, focus the next one, and so on.

Another important aspect is that selected clients stay selected until they are unselected. This allows you to continue performing tasks on the selection without having to reselect the same clients after every operation.

Easy column manipulation

Launch a few terminals so that we have something to work with:

colors = %w[ red green blue black orange brown gray navy gold ]
colors.each {|c| system "xterm -bg #{c} -title #{c} -e sh -c read &" }

You can insert a group of clients to the top, bottom, or after the currently focused client of any column using Array-like methods.

Give each client its own column (one client per column):

curr_view.each_column {|c| c.length = 1 }

Put (at most) three clients in every column:

curr_view.each_column {|c| c.length = 3 }

Move the red, green, and blue clients into the floating area:

rgb = %w[red green blue]
terms = curr_view.clients.select {|c| rgb.include? c.label.read }
curr_view.areas[0].push terms

Slurp all floating clients into the last column:

list = curr_view.areas
a, b = list.first, list.last
b.concat a

Set the last column's layout to stacking mode:

b.layout = 'stack'

Move the red, green, and blue clients to the top of the second column:

curr_view.areas[2].unshift terms

Move the red, green, and blue clients to the bottom of the third column:

curr_view.areas[3].push terms

Close the terminals we launched earlier:

terms = curr_view.clients.select {|c| colors.include? c.label.read }
terms.each {|c| c.kill }

Easy client manipulation

Launch a few terminals so that we have something to work with:

colors = %w[ red green blue black orange brown gray navy gold ]
colors.each {|c| system "xterm -bg #{c} -title #{c} -e sh -c read &" }

Obtain a reference to the red client:

red = curr_view.clients.find {|c| c.label.read == "red" }

Show the red client's current tags:

red.tags

Add the "foo" and "bar" tags to the red client:

red.tag "foo", "bar"

Remove the "bar" tag from the red client:

red.untag "bar"

Do complex operations on the red client's tags:

red.with_tags { concat %w[a b c]; push 'z'; delete 'c' }

Focus the next client after the red client:

red.next.focus
curr_client == red.next #=> true

Notice that by focusing a client, we make it the current client.

Focus the red client on a different view:

orig = curr_view
v = red.views.last
red.focus v

Return to the original view:

orig.focus

Send the red client to the last column:

red.send curr_view.areas.last

Close the terminals we launched earlier:

terms = curr_view.clients.select {|c| colors.include? c.label.read }
terms.each {|c| c.kill }

Traversing the file system

Show the root node of wmii's IXP file system:

fs

Show the names of all files at the root level:

fs.entries

Show the parent of the root node:

fs.parent

Show the children of the root node:

fs.children

Navigate into to the /lbar/ directory:

n1 = fs.lbar
n2 = fs['lbar']
n1 == n2 #=> true
left_bar = n1

Notice that you can traverse the file system hierarchy by simply calling methods on node objects. Alternatively, you can traverse by specifying an arbitrary sub-path (relative path) using the [] operator on a node.

Create a new temporary button:

b = left_bar.rumai_example # path of new button
b.exist? #=> false
b.create
b.exist? #=> true

You should now see an empty button on the left-hand side of the wmii bar.

Color the button black-on-white and label it as "hello world":

content = "#000000 #ffffff #000000 hello world"
b.write content
b.read == content #=> true

Remove the temporary button:

b.remove
b.exist? #=> false

HACKING

This section is meant for people who want to develop Rumai's source code.

Prerequisites

Install Ruby libraries necessary for development:

gem install rumai --development

Infrastructure

Inochi serves as the project infrastructure for Rumai. It handles tasks such as building this help manual and API documentation, and packaging, announcing, and publishing new releases. See its help manual and list of tasks to get started:

inochi --help     # display help manual
inochi --tasks    # list available tasks

$LOAD_PATH setup

Ensure that the lib/ directory is listed in Ruby's $LOAD_PATH before you use any libraries therein or run any executables in the bin/ directory.

This can be achieved by passing an option to Ruby:

ruby -Ilib bin/rumai
irb -Ilib -r rumai

Or by setting the $RUBYLIB environment variable:

export RUBYLIB=lib   # bash, ksh, zsh
setenv RUBYLIB lib   # csh
set -x RUBYLIB lib   # fish

ruby bin/rumai
irb -r rumai

Or by installing the ruby-wrapper tool.

RubyGems setup

If you use Ruby 1.8 or older, then ensure that RubyGems is activated before you use any libraries in the lib/ directory or run any executables in the bin/ directory.

This can be achieved by passing an option to Ruby:

ruby -rubygems bin/rumai
irb -rubygems -r rumai

Or by setting the $RUBYOPT environment variable:

export RUBYOPT=-rubygems   # bash, ksh, zsh
setenv RUBYOPT -rubygems   # csh
set -x RUBYOPT -rubygems   # fish

Running tests

Simply execute the included test runner, which sets up Ruby's $LOAD_PATH for testing, loads the included test/test_helper.rb file, and then evaluates all test/**/*_test.rb files:

test/runner

Its exit status will indicate whether all tests have passed. It may also print additional pass/fail information depending on the testing library used in the test/test_helper.rb file.

Contributing

Fork this project on GitHub (see Resources above) and send a pull request.

VERSIONS

This section contains release notes of current and past releases.

Version 3.2.3 (2010-04-28)

This release adds a UNIX manual page and requires wmii 3.9 or newer.

Bug fixes:

Housekeeping:

Version 3.2.2 (2010-04-01)

This release fixes some warnings that appeared during installation and performs some minor housekeeping.

Bug fixes:

Warnings of the following form appeared during gem installation:

Unrecognized directive '...' in lib/rumai/inochi.yaml

Thanks to ghedamat for reporting this.

Housekeeping:

Version 3.2.1 (2010-03-22)

This release improves multi-threading support in Rumai's pure-Ruby implementation of the IXP file-system interface.

Thank you:

Bug fixes:

Housekeeping:

Version 3.2.0 (2009-11-17)

This release adds a new automated view arrangement, simplifies the IXP transport layer, and cleans up the code and API documentation.

New features:

Bug fixes:

Housekeeping:

Version 3.1.1 (2009-11-16)

This release fixes bugs in automated view arrangements and updates the user manual.

Thank you:

Bug fixes:

Version 3.1.0 (2009-10-02)

This release adds new methods, fixes some bugs, and revises the manual.

New features:

Bug fixes:

Housekeeping:

Version 3.0.0 (2009-05-11)

This release revises method names, adds new methods, and fixes a bug.

Incompatible changes:

New features:

Bug fixes:

Housekeeping:

Version 2.1.0 (2009-05-09)

This release improves client arrangement, fixes several bugs, and cleans up the code.

Thank you:

New features:

Bug fixes:

Housekeeping:

Version 2.0.2 (2009-02-26)

This release fixes a connection bug.

Thank you:

Bug fixes:

Version 2.0.1 (2009-01-25)

This release simplifies project administrivia using Inochi, improves the unit tests, and revises the user manual.

Bug fixes:

Housekeeping:

Version 2.0.0 (2008-02-04)

This release adds support for wmii 3.6, improves the performance of the IXP library, and fixes some bugs.

Thank you:

Incompatible changes:

New features:

Bug fixes:

Version 1.0.0 (2008-01-26)

This is the first release of Rumai, the evolution of wmii-irb, which lets you manipulate the wmii window manager through Ruby. Enjoy!

AUTHORS

Suraj N. Kurapati

CREDITS

Christoph Blank, Simon Hafner, Michael Andrus, Nathan Neff, Gigamo, ghedamat

LICENSE

(the ISC license)

Copyright 2006 Suraj N. Kurapati sunaku@gmail.com

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

SEE ALSO

irb(1), wmiir(1), wmii(1)

  1. April 2010
  2. rumai(1)