summaryrefslogtreecommitdiff
path: root/raveos-theme/gnome/theme-data/extensions/installed/ShutdownTimer@deminder/dbus-service/shutdown-timer-dbus.js
diff options
context:
space:
mode:
authornippy <you@example.com>2026-04-18 13:49:56 +0200
committernippy <you@example.com>2026-04-18 13:49:56 +0200
commit5d94c0a7d44a2255b81815a52a7056a94a39842d (patch)
tree759bdea9645c6a62f9e1e4c001f7d81cccd120d2 /raveos-theme/gnome/theme-data/extensions/installed/ShutdownTimer@deminder/dbus-service/shutdown-timer-dbus.js
parente79cdf210b267f21a186255ce1a4d50029439d54 (diff)
downloadRaveOS-PKGBUILD-5d94c0a7d44a2255b81815a52a7056a94a39842d.tar.gz
RaveOS-PKGBUILD-5d94c0a7d44a2255b81815a52a7056a94a39842d.zip
update Raveos themes
Diffstat (limited to 'raveos-theme/gnome/theme-data/extensions/installed/ShutdownTimer@deminder/dbus-service/shutdown-timer-dbus.js')
-rw-r--r--raveos-theme/gnome/theme-data/extensions/installed/ShutdownTimer@deminder/dbus-service/shutdown-timer-dbus.js72
1 files changed, 72 insertions, 0 deletions
diff --git a/raveos-theme/gnome/theme-data/extensions/installed/ShutdownTimer@deminder/dbus-service/shutdown-timer-dbus.js b/raveos-theme/gnome/theme-data/extensions/installed/ShutdownTimer@deminder/dbus-service/shutdown-timer-dbus.js
new file mode 100644
index 0000000..8db37a4
--- /dev/null
+++ b/raveos-theme/gnome/theme-data/extensions/installed/ShutdownTimer@deminder/dbus-service/shutdown-timer-dbus.js
@@ -0,0 +1,72 @@
+// SPDX-FileCopyrightText: 2023 Deminder <tremminder@gmail.com>
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+import Gio from 'gi://Gio';
+import GLib from 'gi://GLib';
+
+import { loadInterfaceXML, logDebug } from '../modules/util.js';
+import { Timer } from './timer.js';
+
+export const ShutdownTimerName = 'org.gnome.Shell.Extensions.ShutdownTimer';
+export const ShutdownTimerObjectPath =
+ '/org/gnome/Shell/Extensions/ShutdownTimer';
+export const ShutdownTimerIface = await loadInterfaceXML(ShutdownTimerName);
+
+export class ShutdownTimerDBus {
+ constructor({ settings }) {
+ this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(
+ ShutdownTimerIface,
+ this
+ );
+ this._dbusImpl.export(Gio.DBus.session, ShutdownTimerObjectPath);
+
+ this._timer = new Timer({ settings });
+ this._timer.connect('message', (_, msg) => {
+ logDebug('[shutdown-timer-dbus] msg', msg);
+ this._dbusImpl.emit_signal('OnMessage', new GLib.Variant('(s)', [msg]));
+ });
+ this._timer.connect('change', () => {
+ logDebug('[shutdown-timer-dbus] state', this._timer.state);
+ this._dbusImpl.emit_signal(
+ 'OnStateChange',
+ new GLib.Variant('(s)', [this._timer.state])
+ );
+ });
+ this._timer.connect('change-external', () => {
+ this._dbusImpl.emit_signal('OnExternalChange', null);
+ });
+ }
+
+ async ScheduleShutdownAsync(parameters, invocation) {
+ const [shutdown, action] = parameters;
+ logDebug(
+ '[sdt-dbus] [ScheduleShutdownAsync] shutdown',
+ shutdown,
+ 'action',
+ action
+ );
+ await this._timer.toggleShutdown(shutdown, action);
+ invocation.return_value(null);
+ }
+
+ async ScheduleWakeAsync(parameters, invocation) {
+ const [wake] = parameters;
+ logDebug('[sdt-dbus] [ScheduleWakeAsync] wake', wake);
+ await this._timer.toggleWake(wake);
+ invocation.return_value(null);
+ }
+
+ GetStateAsync(_, invocation) {
+ logDebug('[sdt-dbus] [GetStateAsync]');
+ invocation.return_value(new GLib.Variant('(s)', [this._timer.state]));
+ return Promise.resolve();
+ }
+
+ destroy() {
+ logDebug('[sdt-dbus] destroy');
+ this._dbusImpl.unexport();
+ this._dbusImpl = null;
+ this._timer.destroy();
+ this._timer = null;
+ }
+}