mirror of
https://github.com/danbulant/dots-hyprland
synced 2026-05-24 12:22:09 +00:00
added module Hyprland gamemode
This commit is contained in:
parent
408f915f6b
commit
9627640e6b
2 changed files with 30 additions and 0 deletions
|
|
@ -203,6 +203,34 @@ export const ModuleRawInput = async (props = {}) => {
|
|||
};
|
||||
}
|
||||
|
||||
export const ModuleGameMode = async (props = {}) => {
|
||||
try {
|
||||
const Hyprland = (await import('resource:///com/github/Aylur/ags/service/hyprland.js')).default;
|
||||
return Widget.Button({
|
||||
className: 'txt-small sidebar-iconbutton',
|
||||
tooltipText: getString('Hyprland Game Mode'),
|
||||
onClicked: (button) => {
|
||||
Hyprland.messageAsync('j/getoption animations:enabled')
|
||||
.then((output) => {
|
||||
const value = JSON.parse(output)["int"];
|
||||
if (value == 1) {
|
||||
execAsync(['bash', '-c', `hyprctl --batch "keyword animations:enabled 0; keyword decoration:shadow:enabled 0; keyword decoration:blur:enabled 0; keyword general:gaps_in 0; keyword general:gaps_out 0; keyword general:border_size 1; keyword decoration:rounding 0; keyword general:allow_tearing 0" & hyprctl reload`]).catch(print);
|
||||
button.toggleClassName('sidebar-button-active', false);
|
||||
} else {
|
||||
execAsync(['bash', '-c', `hyprctl --batch "keyword animations:enabled 1; keyword general:allow_tearing 1" & hyprctl reload`]).catch(print);
|
||||
button.toggleClassName('sidebar-button-active', true);
|
||||
}
|
||||
})
|
||||
},
|
||||
child: MaterialIcon('gamepad', 'norm'),
|
||||
setup: setupCursorHover,
|
||||
...props,
|
||||
})
|
||||
} catch {
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
export const ModuleIdleInhibitor = (props = {}) => Widget.Button({ // TODO: Make this work
|
||||
attribute: {
|
||||
enabled: false,
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import {
|
|||
ModuleSettingsIcon,
|
||||
ModulePowerIcon,
|
||||
ModuleRawInput,
|
||||
ModuleGameMode,
|
||||
ModuleCloudflareWarp
|
||||
} from "./quicktoggles.js";
|
||||
import ModuleNotificationList from "./centermodules/notificationlist.js";
|
||||
|
|
@ -125,6 +126,7 @@ const togglesBox = Widget.Box({
|
|||
// await HyprToggleIcon('touchpad_mouse', 'No touchpad while typing', 'input:touchpad:disable_while_typing', {}),
|
||||
await ModuleNightLight(),
|
||||
await ModuleInvertColors(),
|
||||
await ModuleGameMode(),
|
||||
ModuleIdleInhibitor(),
|
||||
await ModuleCloudflareWarp(),
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in a new issue