Module: Rumai

Extended by:
Rumai
Includes:
ClientContainer
Included in:
Rumai
Defined in:
lib/rumai/ixp/message.rb,
lib/rumai/fs.rb,
lib/rumai/wm.rb,
lib/rumai/inochi.rb,
lib/rumai/ixp/transport.rb

Overview

Primitives for the 9P2000 protocol.

See cm.bell-labs.com/sys/man/5/INDEX.html See swtch.com/plan9port/man/man9/

Defined Under Namespace

Modules: Chain, ClientContainer, ExportInstanceMethods, IXP, WidgetImpl Classes: Area, Barlet, Client, Node, View, WidgetNode

Constant Summary collapse

IXP_SOCK_ADDR =
ENV['WMII_ADDRESS'].sub(/.*!/, '') rescue
"/tmp/ns.#{ENV['USER']}.#{display[/:\d+/]}/wmii"
IXP_FS_ROOT =
Node.new('/')
FOCUSED_WIDGET_ID =
'sel'.freeze
FLOATING_AREA_ID =
'~'.freeze
CLIENT_GROUPING_TAG =
'@'.freeze
CLIENT_STICKY_TAG =
'/./'.freeze
PROJECT =

Official name of this project.

'Rumai'
TAGLINE =

Short single-line description of this project.

'Ruby interface to the wmii window manager'
WEBSITE =

Address of this project’s official home page.

'http://snk.tuxfamily.org/lib/rumai/'
VERSION =

Number of this release of this project.

'4.1.0'
RELDATE =

Date of this release of this project.

'2011-03-28'
INSTDIR =

Location of this release of this project.

File.expand_path('../../..', __FILE__)
RUNTIME =

RubyGems required by this project during runtime.

Examples:


RUNTIME = {
  # this project needs exactly version 1.2.3 of the "an_example" gem
  'an_example' => [ '1.2.3' ],

  # this project needs at least version 1.2 (but not
  # version 1.2.4 or newer) of the "another_example" gem
  'another_example' => [ '>= 1.2' , '< 1.2.4' ],

  # this project needs any version of the "yet_another_example" gem
  'yet_another_example' => [],
}
{}
DEVTIME =

RubyGems required by this project during development.

Examples:


DEVTIME = {
  # this project needs exactly version 1.2.3 of the "an_example" gem
  'an_example' => [ '1.2.3' ],

  # this project needs at least version 1.2 (but not
  # version 1.2.4 or newer) of the "another_example" gem
  'another_example' => [ '>= 1.2' , '< 1.2.4' ],

  # this project needs any version of the "yet_another_example" gem
  "yet_another_example" => [],
}
{
  'inochi' => [ '>= 5.0.2', '< 6' ],
  'detest' => [ '>= 3.1.0', '< 4' ], # for unit testing
}

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ClientContainer

#clients

Class Method Details

.inspectObject

Description of this release of this project.



31
32
33
# File 'lib/rumai/inochi.rb', line 31

def self.inspect
  "#{PROJECT} #{VERSION} (#{RELDATE})"
end

Instance Method Details

#client_idsObject

Returns the IDs of the current set of clients.



1204
1205
1206
1207
1208
# File 'lib/rumai/wm.rb', line 1204

def client_ids
  ary = IXP_FS_ROOT.client.entries
  ary.delete FOCUSED_WIDGET_ID
  ary
end

#curr_areaObject



1218
# File 'lib/rumai/wm.rb', line 1218

def curr_area   ; Area.curr         ; end

#curr_clientObject


shortcuts for interactive WM manipulation (via IRB)




1214
# File 'lib/rumai/wm.rb', line 1214

def curr_client ; Client.curr       ; end

#curr_tagObject



1226
# File 'lib/rumai/wm.rb', line 1226

def curr_tag    ; curr_view.id      ; end

#curr_viewObject



1222
# File 'lib/rumai/wm.rb', line 1222

def curr_view   ; View.curr         ; end

#focus_area(id) ⇒ Object



1237
1238
1239
# File 'lib/rumai/wm.rb', line 1237

def focus_area id
  Area.focus id
end

#focus_client(id) ⇒ Object



1233
1234
1235
# File 'lib/rumai/wm.rb', line 1233

def focus_client id
  Client.focus id
end

#focus_view(id) ⇒ Object



1241
1242
1243
# File 'lib/rumai/wm.rb', line 1241

def focus_view id
  View.focus id
end

#fsObject

Returns the root of IXP file system hierarchy.



1165
1166
1167
# File 'lib/rumai/wm.rb', line 1165

def fs
  IXP_FS_ROOT
end

#groupingObject

Returns a list of all grouped clients in the currently focused view. If there are no grouped clients, then the currently focused client is returned in the list.



1191
1192
1193
1194
1195
# File 'lib/rumai/wm.rb', line 1191

def grouping
  list = curr_view.clients.select {|c| c.group? }
  list << curr_client if list.empty? and curr_client.exist?
  list
end

#next_areaObject



1219
# File 'lib/rumai/wm.rb', line 1219

def next_area   ; curr_area.next    ; end

#next_clientObject



1215
# File 'lib/rumai/wm.rb', line 1215

def next_client ; curr_client.next  ; end

#next_tagObject



1227
# File 'lib/rumai/wm.rb', line 1227

def next_tag    ; next_view.id      ; end

#next_viewObject



1223
# File 'lib/rumai/wm.rb', line 1223

def next_view   ; curr_view.next    ; end

#prev_areaObject



1220
# File 'lib/rumai/wm.rb', line 1220

def prev_area   ; curr_area.prev    ; end

#prev_clientObject



1216
# File 'lib/rumai/wm.rb', line 1216

def prev_client ; curr_client.prev  ; end

#prev_tagObject



1228
# File 'lib/rumai/wm.rb', line 1228

def prev_tag    ; prev_view.id      ; end

#prev_viewObject



1224
# File 'lib/rumai/wm.rb', line 1224

def prev_view   ; curr_view.prev    ; end

#tagsObject

Returns the current set of tags.



1172
1173
1174
1175
1176
# File 'lib/rumai/wm.rb', line 1172

def tags
  ary = IXP_FS_ROOT.tag.entries.sort
  ary.delete FOCUSED_WIDGET_ID
  ary
end

#viewsObject

Returns the current set of views.



1181
1182
1183
# File 'lib/rumai/wm.rb', line 1181

def views
  tags.map! {|t| View.new t }
end