Module: WM

Defined in:
lib/epitools/wm.rb

Defined Under Namespace

Classes: Desktop, Window

Class Method Summary collapse

Class Method Details

.current_desktopObject


11
# File 'lib/epitools/wm.rb', line 11

def self.current_desktop;   @current    ||= desktops.find { |d| d.current? }; end

.desktopsObject


9
# File 'lib/epitools/wm.rb', line 9

def self.desktops;          @desktops   ||= Desktop.all; end

.processesObject


10
# File 'lib/epitools/wm.rb', line 10

def self.processes;         @processes  ||= Hash[ Sys.ps.map { |pr| [pr.pid, pr] } ] ; end

.stickyObject


12
# File 'lib/epitools/wm.rb', line 12

def self.sticky;            @sticky     ||= windows.select { |w| w.sticky? }; end

.window(pid) ⇒ Object


14
15
16
17
18
19
20
21
22
23
# File 'lib/epitools/wm.rb', line 14

def self.window(pid)
  results = windows.select { |w| w.pid }

  if results.empty?
    # check the children
    results = windows.select { |w| w.process.children.any? {|pr| pr.pid == pid } }
  end

  results
end

.windowsObject


8
# File 'lib/epitools/wm.rb', line 8

def self.windows;           @windows    ||= Window.all; end