mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
gex: add keyboard LED mode setting
This commit is contained in:
@@ -12,6 +12,7 @@ import { SliderChargeLevel } from "./modules/sliders/charge";
|
|||||||
import { QuickAnimePower } from "./modules/quick_toggles/anime_power";
|
import { QuickAnimePower } from "./modules/quick_toggles/anime_power";
|
||||||
import { FeatureMenuToggle } from "./modules/quick_menus/laptop_features";
|
import { FeatureMenuToggle } from "./modules/quick_menus/laptop_features";
|
||||||
import { AuraDbus } from "./modules/dbus/aura";
|
import { AuraDbus } from "./modules/dbus/aura";
|
||||||
|
import { AuraMenuToggle } from "./modules/quick_menus/aura";
|
||||||
|
|
||||||
class Extension {
|
class Extension {
|
||||||
private _indicateMiniLed: typeof IndicateMiniLed;
|
private _indicateMiniLed: typeof IndicateMiniLed;
|
||||||
@@ -19,6 +20,7 @@ class Extension {
|
|||||||
private _quickPanelOd: typeof QuickPanelOd;
|
private _quickPanelOd: typeof QuickPanelOd;
|
||||||
private _quickAnimePower: typeof QuickAnimePower;
|
private _quickAnimePower: typeof QuickAnimePower;
|
||||||
private _featureMenuToggle: typeof FeatureMenuToggle;
|
private _featureMenuToggle: typeof FeatureMenuToggle;
|
||||||
|
private _auraModeMenuToggle: typeof AuraMenuToggle;
|
||||||
private _sliderCharge: typeof SliderChargeLevel;
|
private _sliderCharge: typeof SliderChargeLevel;
|
||||||
|
|
||||||
public dbus_supported: Supported = new Supported;
|
public dbus_supported: Supported = new Supported;
|
||||||
@@ -46,6 +48,9 @@ class Extension {
|
|||||||
if (this._featureMenuToggle == null) {
|
if (this._featureMenuToggle == null) {
|
||||||
this._featureMenuToggle = new FeatureMenuToggle(this.dbus_supported, this.dbus_platform, this.dbus_anime);
|
this._featureMenuToggle = new FeatureMenuToggle(this.dbus_supported, this.dbus_platform, this.dbus_anime);
|
||||||
}
|
}
|
||||||
|
if (this._auraModeMenuToggle == null) {
|
||||||
|
this._auraModeMenuToggle = new AuraMenuToggle(this.dbus_aura);
|
||||||
|
}
|
||||||
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);
|
||||||
|
|||||||
@@ -85,7 +85,13 @@ export class AuraDbus extends DbusBase {
|
|||||||
public setLedMode(mode: AuraEffect) {
|
public setLedMode(mode: AuraEffect) {
|
||||||
if (this.isRunning()) {
|
if (this.isRunning()) {
|
||||||
try {
|
try {
|
||||||
this.dbus_proxy.SetLedModeSync(mode);
|
this.dbus_proxy.SetLedModeSync([
|
||||||
|
mode.mode,
|
||||||
|
mode.zone,
|
||||||
|
[mode.colour1.r, mode.colour1.g, mode.colour1.b],
|
||||||
|
[mode.colour2.r, mode.colour2.g, mode.colour2.b],
|
||||||
|
mode.speed,
|
||||||
|
mode.direction]);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
log("Failed to fetch supported functionalities", e);
|
log("Failed to fetch supported functionalities", e);
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ declare const imports: any;
|
|||||||
|
|
||||||
import { addQuickSettingsItems } from "../helpers";
|
import { addQuickSettingsItems } from "../helpers";
|
||||||
import { AuraDbus } from "../dbus/aura";
|
import { AuraDbus } from "../dbus/aura";
|
||||||
|
import { AuraModeNum } from "../../bindings/aura";
|
||||||
|
|
||||||
const { GObject } = imports.gi;
|
const { GObject } = imports.gi;
|
||||||
const ExtensionUtils = imports.misc.extensionUtils;
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
const Me = ExtensionUtils.getCurrentExtension();
|
// const Me = ExtensionUtils.getCurrentExtension();
|
||||||
|
// const Main = imports.ui.main;
|
||||||
const Main = imports.ui.main;
|
|
||||||
const PopupMenu = imports.ui.popupMenu;
|
const PopupMenu = imports.ui.popupMenu;
|
||||||
const QuickSettings = imports.ui.quickSettings;
|
const QuickSettings = imports.ui.quickSettings;
|
||||||
|
|
||||||
@@ -34,26 +34,39 @@ export const AuraMenuToggle = GObject.registerClass(
|
|||||||
|
|
||||||
this._itemsSection = new PopupMenu.PopupMenuSection();
|
this._itemsSection = new PopupMenu.PopupMenuSection();
|
||||||
|
|
||||||
|
this._dbus_aura.aura_modes.forEach((mode, key) => {
|
||||||
|
this._itemsSection.addAction(key, ()=>{
|
||||||
|
this._dbus_aura.setLedMode(mode);
|
||||||
|
this.sync();
|
||||||
|
}, "");
|
||||||
|
});
|
||||||
|
|
||||||
this.menu.addMenuItem(this._itemsSection);
|
this.menu.addMenuItem(this._itemsSection);
|
||||||
|
|
||||||
// Add an entry-point for more settings
|
// Add an entry-point for more settings
|
||||||
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
// this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
||||||
const settingsItem = this.menu.addAction("More Settings",
|
// const settingsItem = this.menu.addAction("More Settings",
|
||||||
() => ExtensionUtils.openPrefs());
|
// () => ExtensionUtils.openPrefs());
|
||||||
|
// // Ensure the settings are unavailable when the screen is locked
|
||||||
|
// settingsItem.visible = Main.sessionMode.allowSettings;
|
||||||
|
// this.menu._settingsActions[Me.uuid] = settingsItem;
|
||||||
|
|
||||||
// Ensure the settings are unavailable when the screen is locked
|
this.connectObject(
|
||||||
settingsItem.visible = Main.sessionMode.allowSettings;
|
"clicked", () => {
|
||||||
this.menu._settingsActions[Me.uuid] = settingsItem;
|
// TODO: open a configuration tool
|
||||||
|
this.sync();
|
||||||
|
},
|
||||||
|
this);
|
||||||
|
|
||||||
|
this._dbus_aura.notifyAuraModeSubscribers.push(this);
|
||||||
|
this.sync();
|
||||||
|
|
||||||
addQuickSettingsItems([this]);
|
addQuickSettingsItems([this]);
|
||||||
}
|
}
|
||||||
|
|
||||||
sync() {
|
sync() {
|
||||||
const checked = false;
|
const checked = this._dbus_aura.current_aura_mode != AuraModeNum.Static;
|
||||||
switch (this.primary) {
|
this.title = this._dbus_aura.current_aura_mode;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.checked !== checked)
|
if (this.checked !== checked)
|
||||||
this.set({ checked });
|
this.set({ checked });
|
||||||
|
|||||||
@@ -14,9 +14,8 @@ import { MenuToggleMiniLed } from "../menu_toggles/mini_led";
|
|||||||
const { GObject } = imports.gi;
|
const { GObject } = imports.gi;
|
||||||
|
|
||||||
const ExtensionUtils = imports.misc.extensionUtils;
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
const Me = ExtensionUtils.getCurrentExtension();
|
// const Me = ExtensionUtils.getCurrentExtension();
|
||||||
|
// const Main = imports.ui.main;
|
||||||
const Main = imports.ui.main;
|
|
||||||
const PopupMenu = imports.ui.popupMenu;
|
const PopupMenu = imports.ui.popupMenu;
|
||||||
const QuickSettings = imports.ui.quickSettings;
|
const QuickSettings = imports.ui.quickSettings;
|
||||||
|
|
||||||
@@ -143,14 +142,13 @@ export const FeatureMenuToggle = GObject.registerClass(
|
|||||||
|
|
||||||
this.menu.addMenuItem(this._itemsSection);
|
this.menu.addMenuItem(this._itemsSection);
|
||||||
|
|
||||||
// Add an entry-point for more settings
|
// // Add an entry-point for more settings
|
||||||
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
// this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
||||||
const settingsItem = this.menu.addAction("More Settings",
|
// const settingsItem = this.menu.addAction("More Settings",
|
||||||
() => ExtensionUtils.openPrefs());
|
// () => ExtensionUtils.openPrefs());
|
||||||
|
// // Ensure the settings are unavailable when the screen is locked
|
||||||
// Ensure the settings are unavailable when the screen is locked
|
// settingsItem.visible = Main.sessionMode.allowSettings;
|
||||||
settingsItem.visible = Main.sessionMode.allowSettings;
|
// this.menu._settingsActions[Me.uuid] = settingsItem;
|
||||||
this.menu._settingsActions[Me.uuid] = settingsItem;
|
|
||||||
|
|
||||||
addQuickSettingsItems([this]);
|
addQuickSettingsItems([this]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user