Files
custum-hyprpanel/modules/menus/power/helpers/actions.ts
Jas Singh b23f1a32cb Fixed styling issues for various elements that weren't being applied via settings. (#118)
* Popups are now styles properly and can be themed. closes #115

* Added the ability to style media menu card color and transparency. Made confirmation dialogue optional.

* Increase radius

* Move actions inside the function to reflect updated values.
2024-08-12 21:38:27 -07:00

52 lines
1.2 KiB
TypeScript

import { Action } from "lib/types/power";
import options from "options";
const { sleep, reboot, logout, shutdown } = options.menus.dashboard.powermenu;
class PowerMenu extends Service {
static {
Service.register(
this,
{},
{
title: ["string"],
cmd: ["string"],
},
);
}
#title = "";
#cmd = "";
get title() {
return this.#title;
}
action(action: Action) {
[this.#cmd, this.#title] = {
sleep: [sleep.value, "Sleep"],
reboot: [reboot.value, "Reboot"],
logout: [logout.value, "Log Out"],
shutdown: [shutdown.value, "Shutdown"],
}[action];
this.notify("cmd");
this.notify("title");
this.emit("changed");
App.closeWindow("powermenu");
App.openWindow("verification");
}
shutdown = () => {
this.action("shutdown");
};
exec = () => {
App.closeWindow("verification");
Utils.execAsync(this.#cmd);
};
}
const powermenu = new PowerMenu();
Object.assign(globalThis, { powermenu });
export default powermenu;