Class: RosettAi::DBus::FocusAdapters::X11Adapter
- Defined in:
- lib/rosett_ai/dbus/focus_adapters/x11_adapter.rb
Overview
Focus adapter for X11 window managers.
Uses xprop to monitor _NET_ACTIVE_WINDOW property changes. Falls back to polling if xprop spy mode is not available.
Constant Summary collapse
- POLL_INTERVAL =
seconds
0.5
Instance Method Summary collapse
-
#initialize ⇒ X11Adapter
constructor
A new instance of X11Adapter.
-
#start ⇒ void
Start the adapter or service.
-
#stop ⇒ void
Stop the adapter or service.
Methods inherited from Base
Constructor Details
#initialize ⇒ X11Adapter
Returns a new instance of X11Adapter.
16 17 18 19 20 21 |
# File 'lib/rosett_ai/dbus/focus_adapters/x11_adapter.rb', line 16 def initialize super @thread = nil @xprop_process = nil @last_window_id = nil end |
Instance Method Details
#start ⇒ void
This method returns an undefined value.
Start the adapter or service.
25 26 27 28 29 30 31 |
# File 'lib/rosett_ai/dbus/focus_adapters/x11_adapter.rb', line 25 def start return if @running return unless xprop_available? @running = true @thread = Thread.new { run_poll_loop } end |
#stop ⇒ void
This method returns an undefined value.
Stop the adapter or service.
35 36 37 38 39 |
# File 'lib/rosett_ai/dbus/focus_adapters/x11_adapter.rb', line 35 def stop super @thread&.kill @xprop_process&.close end |