Class: Fusuma::Plugin::Appmatcher::Gnome

Inherits:
Object
  • Object
show all
Defined in:
lib/fusuma/plugin/appmatcher/gnome.rb

Overview

Search Active Window’s Name

Defined Under Namespace

Classes: Matcher

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGnome



14
15
16
# File 'lib/fusuma/plugin/appmatcher/gnome.rb', line 14

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

Instance Attribute Details

#matcherObject (readonly)

Returns the value of attribute matcher.



12
13
14
# File 'lib/fusuma/plugin/appmatcher/gnome.rb', line 12

def matcher
  @matcher
end

#readerObject (readonly)

Returns the value of attribute reader.



12
13
14
# File 'lib/fusuma/plugin/appmatcher/gnome.rb', line 12

def reader
  @reader
end

#writerObject (readonly)

Returns the value of attribute writer.



12
13
14
# File 'lib/fusuma/plugin/appmatcher/gnome.rb', line 12

def writer
  @writer
end

Instance Method Details

#watch_startInteger

fork process and watch signal



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fusuma/plugin/appmatcher/gnome.rb', line 20

def watch_start
  @watch_start ||= begin
    pid = UserSwitcher.new.as_user(proctitle: self.class.name.underscore) do |user|
      @reader.close
      ENV["DBUS_SESSION_BUS_ADDRESS"] = "unix:path=/run/user/#{user.uid}/bus"
      register_on_application_changed(Matcher.new)
    end
    Process.detach(pid)
    pid
  end
end