diff --git a/.config/ags/modules/overview/miscfunctions.js b/.config/ags/modules/overview/miscfunctions.js index aa184f8e..0e5d2229 100644 --- a/.config/ags/modules/overview/miscfunctions.js +++ b/.config/ags/modules/overview/miscfunctions.js @@ -13,7 +13,16 @@ export function hasUnterminatedBackslash(inputString) { export function launchCustomCommand(command) { const args = command.split(' '); if (args[0] == '>raw') { // Mouse raw input - execAsync([`bash`, `-c`, `hyprctl keyword input:force_no_accel $(( 1 - $(hyprctl getoption input:force_no_accel -j | gojq ".int") ))`, `&`]).catch(print); + Utils.execAsync('hyprctl -j getoption input:accel_profile') + .then((output) => { + const value = JSON.parse(output)["str"].trim(); + if (value != "[[EMPTY]]" && value != "") { + execAsync(['bash', '-c', `hyprctl keyword input:accel_profile '[[EMPTY]]'`]).catch(print); + } + else { + execAsync(['bash', '-c', `hyprctl keyword input:accel_profile flat`]).catch(print); + } + }) } else if (args[0] == '>img') { // Change wallpaper execAsync([`bash`, `-c`, `${App.configDir}/scripts/color_generation/switchwall.sh`, `&`]).catch(print); diff --git a/.config/ags/modules/sideright/quicktoggles.js b/.config/ags/modules/sideright/quicktoggles.js index aefc654a..69b01c8e 100644 --- a/.config/ags/modules/sideright/quicktoggles.js +++ b/.config/ags/modules/sideright/quicktoggles.js @@ -130,6 +130,36 @@ export const ModuleInvertColors = async (props = {}) => { }; } +export const ModuleRawInput = 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: 'Raw input', + onClicked: (button) => { + Hyprland.messageAsync('j/getoption input:accel_profile') + .then((output) => { + const value = JSON.parse(output)["str"].trim(); + if (value != "[[EMPTY]]" && value != "") { + execAsync(['bash', '-c', `hyprctl keyword input:accel_profile '[[EMPTY]]'`]).catch(print); + button.toggleClassName('sidebar-button-active', false); + } + else { + Hyprland.messageAsync(`j/keyword input:accel_profile flat`) + .catch(print); + button.toggleClassName('sidebar-button-active', true); + } + }) + }, + child: MaterialIcon('mouse', 'norm'), + setup: setupCursorHover, + ...props, + }) + } catch { + return null; + }; +} + export const ModuleIdleInhibitor = (props = {}) => Widget.Button({ // TODO: Make this work attribute: { enabled: false, diff --git a/.config/ags/modules/sideright/sideright.js b/.config/ags/modules/sideright/sideright.js index 79c7a400..b08ad91f 100644 --- a/.config/ags/modules/sideright/sideright.js +++ b/.config/ags/modules/sideright/sideright.js @@ -12,7 +12,8 @@ import { ModuleEditIcon, ModuleReloadIcon, ModuleSettingsIcon, - ModulePowerIcon + ModulePowerIcon, + ModuleRawInput } from "./quicktoggles.js"; import ModuleNotificationList from "./notificationlist.js"; import { ModuleCalendar } from "./calendar.js"; @@ -51,7 +52,7 @@ const togglesBox = Widget.Box({ children: [ ToggleIconWifi(), ToggleIconBluetooth(), - await HyprToggleIcon('mouse', 'Raw input', 'input:force_no_accel', {}), + await ModuleRawInput(), await HyprToggleIcon('front_hand', 'No touchpad while typing', 'input:touchpad:disable_while_typing', {}), ModuleNightLight(), await ModuleInvertColors(),