Module: RosettAi::DBus::CompositorDetector
- Defined in:
- lib/rosett_ai/dbus/compositor_detector.rb
Overview
Detects the current compositor/window manager.
Detection order (first match wins):
- HYPRLAND_INSTANCE_SIGNATURE env var → :hyprland
- SWAYSOCK env var → :sway
- I3SOCK env var → :i3
- org.gnome.Shell D-Bus name active → :gnome
- org.kde.KWin D-Bus name active → :kwin
- DISPLAY set, WAYLAND_DISPLAY unset → :x11
- else → :unknown
Constant Summary collapse
- COMPOSITOR_CHECKS =
[ { env: 'HYPRLAND_INSTANCE_SIGNATURE', type: :hyprland }, { env: 'SWAYSOCK', type: :sway }, { env: 'I3SOCK', type: :i3 } ].freeze
- DBUS_NAMES =
{ 'org.gnome.Shell' => :gnome, 'org.kde.KWin' => :kwin }.freeze
Class Method Summary collapse
-
.detect ⇒ Symbol
Detect the current compositor.
Class Method Details
.detect ⇒ Symbol
Detect the current compositor
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rosett_ai/dbus/compositor_detector.rb', line 36 def detect # Check environment variables first COMPOSITOR_CHECKS.each do |check| return check[:type] if ENV.key?(check[:env]) end # Check D-Bus names compositor = detect_via_dbus return compositor if compositor # Check for X11 return :x11 if x11_only? :unknown end |