NAME

rumai - Ruby interface to the wmii window manager

SYNOPSIS

rumai [OPTIONS] [IRB_OPTIONS]

Command

Starts an interactive Ruby shell (IRB) session by passing the given IRB_OPTIONS to irb(1) and placing you at a command prompt like this:

irb(Rumai):001:0>

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

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.

DESCRIPTION

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

Project website

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

Announcements feed

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

API documentation

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

Source code (browse online, download, or checkout)

http://github.com/sunaku/rumai

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

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

INSTALL

Prerequisites

Installing

gem install rumai

Upgrading

gem update rumai

Removing

gem uninstall rumai

USAGE

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 = "colors #000000 #ffffff #000000\nlabel hello world"
b.write content
b.read == content #=> true

Remove the temporary button:

b.remove
b.exist? #=> false

HACKING

Prerequisites

Install Ruby libraries necessary for development using [Bundler]:

bundle install

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 running Ruby through 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:

ruby 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 and send a pull request.

HISTORY

Version 4.1.3 (2011-08-21)

This release fixes a bug in the equilateral triangle calulation used by the inward and outward automated client arrangements.

Version 4.1.2 (2011-04-21)

This release fixes a bug in the inward automated client arrangement where clients in the middle column were divided into separate columns when they really should have been in the same column.

Version 4.1.1 (2011-03-28)

This release fixes bugs in the inward & outward automated client arrangements.

Version 4.1.0 (2011-03-28)

This release adds new automated client arrangements and cleans up the code.

New features
  • Added new automated client arrangements:

    • Rumai::View#tile_left() - Horizontal mirror of the LarsWM arrangement.

    • Rumai::View#tile_leftward() - Imagine an equilateral triangle with its base on the left side of the screen and its peak on the right side of the screen.

    • Rumai::View#tile_rightward() - Imagine an equilateral triangle with its base on the right side of the screen and its peak on the left side of the screen.

    • Rumai::View#tile_inward() - Imagine two equilateral triangles with their bases on the left and right sides of the screen and their peaks meeting in the middle of the screen.

    • Rumai::View#tile_outward() - Imagine two equilateral triangles with their bases meeting in the middle of the screen and their peaks reaching outward to the left and right sides of the screen.

  • Renamed existing automated client arrangement method names:

    • Rumai::View#arrange_as_larswm() is now aliased to tile_right()

    • Rumai::View#arrange_in_diamond() is now aliased to tile_inward()

    • Rumai::View#arrange_in_stacks() is now aliased to stack()

    • Rumai::View#arrange_in_grid() is now aliased to grid()

Version 4.0.0 (2011-02-25)

This release fixes a bug regarding the $WMII_ADDRESS environment variable.

Incompatible changes
  • Rumai::Area#push(), #insert(), and #unshift() methods no longer accept an Array object as an argument. If you still wish to pass an Array, then use the splat operator to pass the contents of your Array to these methods.

    Thanks to Mattia Gheda for reporting this issue.

  • Add amount parameter to Rumai::Client#nudge() and #grow().

New features
  • Add Rumai::Client#shrink() method for opposite of #grow().

Bug fixes
  • Fix ability to read and write Unicode strings to files in wmii IXP.

    Thanks to OneLastTry for reporting this issue.

  • Fix parsing of area IDs from view manifest when witray is present.

Version 3.3.1 (2010-08-11)

This release fixes a bug regarding the $WMII_ADDRESS environment variable.

Bug fixes
  • Fix incorrect syntax when amending error message about the $WMII_ADDRESS environment variable not being set.

Housekeeping
  • Dump 9P2000 packets if $VERBOSE, not if $DEBUG, in unit tests.

  • Upgrade to Inochi 5.0.2; the help manual is now written in AsciiDoc.

Version 3.3.0 (2010-07-16)

This release adds support for growing and nudging clients, adds an abstraction for status bar applets, and beautifies the source code.

New features
  • Add Rumai::Barlet class for easier status bar applets. It exposes the new, independent colors and label attributes introduced into the bar file format by wmii-hg2743. It is also backwards-compatible with older wmii versions where the aforementioned attributes were conjoined.

  • Add Rumai::Client#grow and Rumai::Client#nudge methods requested by Nathan Neff. See "The /tag/ Hierarchy" in the wmii manpage for usage information.

Bug fixes
Housekeeping
  • Found real names for some anonymous contributors.

  • Clean up the source code formatting and organization.

Version 3.2.4 (2010-06-06)

This release fixes an IXP transport layer bug under Ruby 1.8.7.

Bug fixes
  • IO#ungetc does not accept a one-character string in Ruby 1.8.7.

    Thanks to Sebastian Chmielewski for reporting this issue.

Version 3.2.3 (2010-04-28)

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

Bug fixes
  • Rumai::Area#unshift needs wmii 3.9 or newer. The help manual has been corrected accordingly.

    Thanks to Mattia Gheda for reporting this issue.

Housekeeping
  • Upgrade to Inochi 3.0.0. Run rumai --help to see the UNIX manual page!

  • Move IRB session creation code from rumai(1) into rumai/irb sub-library.

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 Mattia Gheda for reporting this.

Housekeeping
  • Upgrade to Inochi 2.0.0-rc2 for managing this project.

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
  • Kenneth De Winter reported the issue of status bar applets not refreshing according to their prescribed schedule (this is particularly noticable in the clock applet) and verified my fix for the problem.

Bug fixes
  • Perform a blocking I/O read to recieve a 9P2000 message in Rumai::IXP::Agent#recv only if recieve buffer is empty. This gives other threads a chance to check the recieve buffer for their response. instead of being blocked by us as we greedily hold on to the 9P2000 message stream until our expected response arrives.

Housekeeping
  • Upgrade to Inochi 2.0.0-rc1 and Dfect 2.0.0.

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
  • Add Rumai::View#arrange_in_stacks automated view arrangement.

  • Convert :stack and :max arguments into wmii 3.9 syntax in Rumai::Area#layout=.

Bug fixes
  • Rewrote IXP transport layer (Rumai::IXP::Agent) to not use a background thread, according to the XCB cookie approach.

Housekeeping
  • Clean up some code and API docs.

  • Reduce amount of string concatenation in Struct#to_9p.

Version 3.1.1 (2009-11-16)

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

Bug fixes
  • The relative order of clients was not being preserved during view arrangements.

    Thanks to Nathan Neff for reporting this bug.

  • Focus on the current view was lost after automated view arrangement was applied if the current view was not the first view on which the initially focused (before the automated arrangement was applied) client appeared.

Version 3.1.0 (2009-10-02)

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

New features
  • Add Client#float methods to manipulate floating status.

  • Add Client#manage methods to manipulate managed status.

  • The Client#tags= method now accepts ~ and ! tag prefixes.

Bug fixes
  • There is no View#move_focus method, only View#select.

  • Assertion failure in test suite because all files in /rbar (inside wmii’s IXP filesystem) contain an automatic color header when read.

Housekeeping
  • Use simpler Copyright reminder at the top of every file.

  • Open source is for fun, so speak of "related works", not "competitors".

Version 3.0.0 (2009-05-11)

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

Incompatible changes
  • Rename #toggle_ methods to use ! suffix in their names.

  • Rename #float methods to #floating.

  • Rename View#floater method to View#floating_area.

New features
  • Add Client#stick methods to manipulate sticky status.

  • Add Client#fullscreen methods to manipulate fullscreen status.

  • Add Client#slay method which is a forceful version of #kill.

  • Add View#select method to move focus relatively inside a view.

  • Add Area::floating method for symmetry with Area::curr.

  • Add View#managed_area aliases for View#column methods.

Bug fixes
  • Fix error when unzooming clients from temporary view.

  • Fix code that launches temporary terminals in the Tutorial.

    Use the /bin/sh version of the read(1) command for portability.

Housekeeping
  • Use Client#send instead of #swap in automated arrangements because it causes less traffic on /event/.

  • Add old release notes from blog to user manual.

Version 2.1.0 (2009-05-09)

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

Thank you
  • Simon Hafner reported several bugs.

  • Michael Andrus verified bug fixes.

New features
  • Focus is now restored on the initially focused client after applying automated client arrangements.

  • The push(), insert(), and unshift() instance methods of the Rumai::Area class now preserve the order of inserted clients.

  • The Rumai::View#arrange_in_grid() method now accepts 1 as a parameter. This invocation causes every column to contain at most 1 client.

Bug fixes
  • Fix error caused by focusing the top/bottom client in the destination area before sending new clients into that area.

  • Fix error when importing clients into an empty area.

Housekeeping
  • Use snake_case instead of camelCase for variable names.

  • Add copyright notice at the top of every file.

  • Plenty of code formatting and beautification.

Version 2.0.2 (2009-02-26)

This release fixes a connection bug.

Bug fixes
  • wmii omits the fractional portion of $DISPLAY in its socket file path. Rumai was trying to connect with the entire $DISPLAY value (including the fractional portion) and thus could not find wmii’s socket file.

    Thanks to Simon Hafner for reporting this bug.

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
  • The rumai/ixp/message library’s unit test failed if /rbar/status did not already exist in wmii.

Housekeeping
  • Store IXP socket address in Rumai::IXP_SOCK_ADDR.

  • Added missing test cases for (TR)create and (TR)remove messages in the unit test for the rumai/ixp/message library.

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
  • Christoph Blank tested Rumai 1.0.0 under wmii 3.6 and reported bugs.

Incompatible changes
  • wmii version 3.6 or newer is now required.

  • The Rumai::IXP::Agent::FidStream#read_partial method has been replaced by Rumai::IXP::Agent::FidStream#read(true) for efficiency.

  • The Rumai::IXP::Agent::FidStream#write method no longer writes to the beginning of the stream. Instead, it writes to the current position in the stream.

  • The Rumai::View#floating_area method has been renamed to Rumai::View#floater for brevity.

New features
  • Added several more methods (such as rewind, pos=, eof?, and so on) from Ruby’s IO class to the Rumai::IXP::Agent::FidStream class.

  • Added the Rumai::Client#kill method to simplify client termination.

Bug fixes
  • Fixed a race condition in Rumai::Agent#talk which would cause Rumai to hang when multiple threads used it.

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, Kenneth De Winter, Mattia Gheda, Michael Andrus, Nathan Neff, Sebastian Chmielewski, Simon Hafner

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