Class: RosettAi::Thor::Tasks::DBus
- Inherits:
-
Thor
- Object
- Thor
- RosettAi::Thor::Tasks::DBus
- Defined in:
- lib/rosett_ai/thor/tasks/dbus.rb
Overview
Thor task for D-Bus service management.
Exit codes: 0 — success 1 — D-Bus connection failure 5 — missing ruby-dbus dependency
Constant Summary collapse
- EXIT_SUCCESS =
0- EXIT_DBUS_FAILURE =
1- EXIT_MISSING_DEPENDENCY =
5- ENV_VARS =
[ 'SWAYSOCK', 'I3SOCK', 'HYPRLAND_INSTANCE_SIGNATURE', 'DISPLAY', 'WAYLAND_DISPLAY', 'XDG_RUNTIME_DIR', 'XDG_SESSION_TYPE' ].freeze
- ADAPTER_MAP =
{ sway: 'I3Adapter (i3ipc)', i3: 'I3Adapter (i3ipc)', hyprland: 'HyprlandAdapter (socket2)', gnome: 'GnomeAdapter (Shell D-Bus)', kwin: 'KwinAdapter (KWin D-Bus)', x11: 'X11Adapter (xprop)' }.freeze
Instance Method Summary collapse
Instance Method Details
#detect ⇒ Object
148 149 150 151 152 153 154 155 156 157 |
# File 'lib/rosett_ai/thor/tasks/dbus.rb', line 148 def detect require_desktop_gems! compositor = RosettAi::DBus::CompositorDetector.detect if tty_output? print_detect_tty(compositor) else print_detect_json(compositor) end end |
#start ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/rosett_ai/thor/tasks/dbus.rb', line 93 def start require_desktop_gems! check_dbus_availability if service_running? warn Rainbow(t('already_running')).yellow return end if [:daemonize] start_daemon else start_foreground end end |
#status ⇒ Object
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/rosett_ai/thor/tasks/dbus.rb', line 57 def status require_desktop_gems! check_dbus_availability if service_running? print_running_status else print_not_running end end |
#stop ⇒ Object
124 125 126 127 128 129 130 131 132 133 |
# File 'lib/rosett_ai/thor/tasks/dbus.rb', line 124 def stop require_desktop_gems! unless service_running? warn Rainbow(t('not_running')).yellow return end stop_via_dbus warn Rainbow(t('stopped')).green end |