mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
gex: trial of updating quicktoggle with dbus signal
This commit is contained in:
@@ -20,7 +20,7 @@ class Extension {
|
|||||||
|
|
||||||
public _dbus_power!: Power;
|
public _dbus_power!: Power;
|
||||||
public _dbus_anime!: AnimeDbus;
|
public _dbus_anime!: AnimeDbus;
|
||||||
public dbus_platform!: Platform;
|
public dbus_platform: Platform = new Platform;
|
||||||
public dbus_supported!: Supported;
|
public dbus_supported!: Supported;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -33,7 +33,7 @@ class Extension {
|
|||||||
this.dbus_supported = new Supported();
|
this.dbus_supported = new Supported();
|
||||||
this.dbus_supported.start();
|
this.dbus_supported.start();
|
||||||
|
|
||||||
this.dbus_platform = new Platform();
|
// this.dbus_platform = new Platform();
|
||||||
this.dbus_platform.start();
|
this.dbus_platform.start();
|
||||||
|
|
||||||
this._dbus_power = new Power();
|
this._dbus_power = new Power();
|
||||||
@@ -55,6 +55,7 @@ class Extension {
|
|||||||
if (this.dbus_supported.supported.rog_bios_ctrl.panel_overdrive) {
|
if (this.dbus_supported.supported.rog_bios_ctrl.panel_overdrive) {
|
||||||
if (this._quickPanelOd == null) {
|
if (this._quickPanelOd == null) {
|
||||||
this._quickPanelOd = new QuickPanelOd(this.dbus_platform);
|
this._quickPanelOd = new QuickPanelOd(this.dbus_platform);
|
||||||
|
this.dbus_platform.notifyPanelOdSubscribers.push(this._quickPanelOd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.dbus_supported.supported.anime_ctrl) {
|
if (this.dbus_supported.supported.anime_ctrl) {
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ export class Platform extends DbusBase {
|
|||||||
mini_led_mode: false
|
mini_led_mode: false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: interface or something to enforce requirement of "sync()" method
|
||||||
|
public notifyPanelOdSubscribers: any[] = [];
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super("org-asuslinux-platform-4", "/org/asuslinux/Platform");
|
super("org-asuslinux-platform-4", "/org/asuslinux/Platform");
|
||||||
}
|
}
|
||||||
@@ -142,6 +145,9 @@ export class Platform extends DbusBase {
|
|||||||
if (proxy) {
|
if (proxy) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
log(`NotifyPanelOd has changed to ${data}.`);
|
log(`NotifyPanelOd has changed to ${data}.`);
|
||||||
|
this.notifyPanelOdSubscribers.forEach(sub => {
|
||||||
|
sub.sync();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -35,17 +35,17 @@ export const QuickPanelOd = GObject.registerClass(
|
|||||||
this, "checked",
|
this, "checked",
|
||||||
Gio.SettingsBindFlags.DEFAULT);
|
Gio.SettingsBindFlags.DEFAULT);
|
||||||
|
|
||||||
this._sync();
|
this.sync();
|
||||||
|
|
||||||
addQuickSettingsItems([this]);
|
addQuickSettingsItems([this]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_toggleMode() {
|
_toggleMode() {
|
||||||
this._dbus_platform.setPanelOd(this.checked);
|
this._dbus_platform.setPanelOd(this.checked);
|
||||||
this._sync();
|
this.sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
_sync() {
|
sync() {
|
||||||
const checked = this._dbus_platform.getPanelOd();
|
const checked = this._dbus_platform.getPanelOd();
|
||||||
if (this.checked !== checked)
|
if (this.checked !== checked)
|
||||||
this.set({ checked });
|
this.set({ checked });
|
||||||
|
|||||||
Reference in New Issue
Block a user