mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
gex: fix and update
This commit is contained in:
@@ -5,9 +5,6 @@ var extensionInstance: any;
|
|||||||
|
|
||||||
// REF: https://gjs.guide/extensions/development/creating.html
|
// REF: https://gjs.guide/extensions/development/creating.html
|
||||||
|
|
||||||
const { QuickToggle } = imports.ui.quickSettings;
|
|
||||||
const QuickSettingsMenu = imports.ui.main.panel.statusArea.quickSettings;
|
|
||||||
|
|
||||||
import { AnimeDbus } from './modules/dbus/animatrix';
|
import { AnimeDbus } from './modules/dbus/animatrix';
|
||||||
import { Power } from './modules/dbus/power';
|
import { Power } from './modules/dbus/power';
|
||||||
import { Supported } from './modules/dbus/supported';
|
import { Supported } from './modules/dbus/supported';
|
||||||
@@ -17,18 +14,6 @@ import { QuickPanelOd } from './modules/quick_toggles/panel_od';
|
|||||||
import { IndicateMiniLed } from './modules/indicators/mini_led';
|
import { IndicateMiniLed } from './modules/indicators/mini_led';
|
||||||
import { QuickMiniLed } from './modules/quick_toggles/mini_led';
|
import { QuickMiniLed } from './modules/quick_toggles/mini_led';
|
||||||
|
|
||||||
|
|
||||||
function addQuickSettingsItems(items: [typeof QuickToggle]) {
|
|
||||||
// Add the items with the built-in function
|
|
||||||
QuickSettingsMenu._addItems(items);
|
|
||||||
|
|
||||||
// Ensure the tile(s) are above the background apps menu
|
|
||||||
for (const item of items) {
|
|
||||||
QuickSettingsMenu.menu._grid.set_child_below_sibling(item,
|
|
||||||
QuickSettingsMenu._backgroundApps.quickSettingsItems[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Extension {
|
class Extension {
|
||||||
private _indicateMiniLed: typeof IndicateMiniLed;
|
private _indicateMiniLed: typeof IndicateMiniLed;
|
||||||
private _quickMiniLed: typeof QuickMiniLed;
|
private _quickMiniLed: typeof QuickMiniLed;
|
||||||
@@ -61,7 +46,6 @@ class Extension {
|
|||||||
if (this.dbus_supported.supported.rog_bios_ctrl.mini_led_mode) {
|
if (this.dbus_supported.supported.rog_bios_ctrl.mini_led_mode) {
|
||||||
if (this._quickMiniLed == null) {
|
if (this._quickMiniLed == null) {
|
||||||
this._quickMiniLed = new QuickMiniLed(this.dbus_platform);
|
this._quickMiniLed = new QuickMiniLed(this.dbus_platform);
|
||||||
addQuickSettingsItems([this._quickMiniLed]);
|
|
||||||
}
|
}
|
||||||
if (this._indicateMiniLed == null) {
|
if (this._indicateMiniLed == null) {
|
||||||
this._indicateMiniLed = new IndicateMiniLed(this.dbus_platform);
|
this._indicateMiniLed = new IndicateMiniLed(this.dbus_platform);
|
||||||
@@ -70,7 +54,6 @@ 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);
|
||||||
addQuickSettingsItems([this._quickPanelOd]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
15
desktop-extensions/gnome/src/modules/helpers.ts
Normal file
15
desktop-extensions/gnome/src/modules/helpers.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
declare const imports: any;
|
||||||
|
|
||||||
|
const { QuickToggle } = imports.ui.quickSettings;
|
||||||
|
const QuickSettingsMenu = imports.ui.main.panel.statusArea.quickSettings;
|
||||||
|
|
||||||
|
export function addQuickSettingsItems(items: [typeof QuickToggle]) {
|
||||||
|
// Add the items with the built-in function
|
||||||
|
QuickSettingsMenu._addItems(items);
|
||||||
|
|
||||||
|
// Ensure the tile(s) are above the background apps menu
|
||||||
|
for (const item of items) {
|
||||||
|
QuickSettingsMenu.menu._grid.set_child_below_sibling(item,
|
||||||
|
QuickSettingsMenu._backgroundApps.quickSettingsItems[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,12 +7,9 @@ const ExtensionUtils = imports.misc.extensionUtils;
|
|||||||
const { SystemIndicator } = imports.ui.quickSettings;
|
const { SystemIndicator } = imports.ui.quickSettings;
|
||||||
const QuickSettingsMenu = imports.ui.main.panel.statusArea.quickSettings;
|
const QuickSettingsMenu = imports.ui.main.panel.statusArea.quickSettings;
|
||||||
|
|
||||||
import { Platform } from '../dbus/platform';
|
|
||||||
import { QuickMiniLed } from '../quick_toggles/mini_led';
|
|
||||||
|
|
||||||
export const IndicateMiniLed = GObject.registerClass(
|
export const IndicateMiniLed = GObject.registerClass(
|
||||||
class IndicateMiniLed extends SystemIndicator {
|
class IndicateMiniLed extends SystemIndicator {
|
||||||
constructor(dbus_platform: Platform) {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
// Create the icon for the indicator
|
// Create the icon for the indicator
|
||||||
@@ -25,14 +22,6 @@ export const IndicateMiniLed = GObject.registerClass(
|
|||||||
this._indicator, 'visible',
|
this._indicator, 'visible',
|
||||||
Gio.SettingsBindFlags.DEFAULT);
|
Gio.SettingsBindFlags.DEFAULT);
|
||||||
|
|
||||||
// // Create the toggle and associate it with the indicator, being sure to
|
|
||||||
// // destroy it along with the indicator
|
|
||||||
// this.quickSettingsItems.push(new QuickMiniLed(dbus_platform));
|
|
||||||
|
|
||||||
// this.connect('destroy', () => {
|
|
||||||
// this.quickSettingsItems.forEach((item: { destroy: () => any; }) => item.destroy());
|
|
||||||
// });
|
|
||||||
|
|
||||||
// Add the indicator to the panel and the toggle to the menu
|
// Add the indicator to the panel and the toggle to the menu
|
||||||
QuickSettingsMenu._indicators.add_child(this);
|
QuickSettingsMenu._indicators.add_child(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
declare const imports: any;
|
declare const imports: any;
|
||||||
|
|
||||||
import { Platform } from "../dbus/platform";
|
import { Platform } from "../dbus/platform";
|
||||||
|
import { addQuickSettingsItems } from "../helpers";
|
||||||
|
|
||||||
const { GObject, Gio } = imports.gi;
|
const { GObject, Gio } = imports.gi;
|
||||||
const ExtensionUtils = imports.misc.extensionUtils;
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
@@ -35,6 +36,8 @@ export const QuickMiniLed = GObject.registerClass(
|
|||||||
Gio.SettingsBindFlags.DEFAULT);
|
Gio.SettingsBindFlags.DEFAULT);
|
||||||
|
|
||||||
this._sync();
|
this._sync();
|
||||||
|
|
||||||
|
addQuickSettingsItems([this]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_toggleMode() {
|
_toggleMode() {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
declare const imports: any;
|
declare const imports: any;
|
||||||
|
|
||||||
import { Platform } from "../dbus/platform";
|
import { Platform } from "../dbus/platform";
|
||||||
|
import { addQuickSettingsItems } from "../helpers";
|
||||||
|
|
||||||
const { GObject, Gio } = imports.gi;
|
const { GObject, Gio } = imports.gi;
|
||||||
const ExtensionUtils = imports.misc.extensionUtils;
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
@@ -35,6 +36,8 @@ export const QuickPanelOd = GObject.registerClass(
|
|||||||
Gio.SettingsBindFlags.DEFAULT);
|
Gio.SettingsBindFlags.DEFAULT);
|
||||||
|
|
||||||
this._sync();
|
this._sync();
|
||||||
|
|
||||||
|
addQuickSettingsItems([this]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_toggleMode() {
|
_toggleMode() {
|
||||||
|
|||||||
Reference in New Issue
Block a user