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 ⇒ Object
- #stop ⇒ Object
Methods inherited from Base
#notify_focus_change, #on_focus_change, #running?
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 ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/rosett_ai/dbus/focus_adapters/x11_adapter.rb', line 23 def start return if @running return unless xprop_available? @running = true @thread = Thread.new { run_poll_loop } end |
#stop ⇒ Object
31 32 33 34 35 |
# File 'lib/rosett_ai/dbus/focus_adapters/x11_adapter.rb', line 31 def stop super @thread&.kill @xprop_process&.close end |