Class: Fusuma::Plugin::Appmatcher::X11

Inherits:
Object
  • Object
show all
Includes:
UserSwitcher
Defined in:
lib/fusuma/plugin/appmatcher/x11.rb

Overview

Search Active Window’s Name

Defined Under Namespace

Classes: Matcher

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from UserSwitcher

#as_user, #drop_priv, login_user

Constructor Details

#initializeX11

Returns a new instance of X11.



17
18
19
# File 'lib/fusuma/plugin/appmatcher/x11.rb', line 17

def initialize
  @reader, @writer = IO.pipe
end

Instance Attribute Details

#readerObject (readonly)

Returns the value of attribute reader.



15
16
17
# File 'lib/fusuma/plugin/appmatcher/x11.rb', line 15

def reader
  @reader
end

#writerObject (readonly)

Returns the value of attribute writer.



15
16
17
# File 'lib/fusuma/plugin/appmatcher/x11.rb', line 15

def writer
  @writer
end

Instance Method Details

#watch_startInteger

fork process and watch signal

Returns:

  • (Integer)

    Process id



23
24
25
26
27
28
29
30
31
# File 'lib/fusuma/plugin/appmatcher/x11.rb', line 23

def watch_start
  @watch_start ||= begin
    pid = as_user(proctitle: self.class.name.underscore) do |_user|
      @reader.close
      register_on_application_changed(Matcher.new)
    end
    pid
  end
end