raw input: input:accel_profile instead of input:force_no_accel, as advised by hl wiki

This commit is contained in:
end-4 2024-03-11 15:56:09 +07:00
parent bbe11ab43f
commit 56898f5035
3 changed files with 43 additions and 3 deletions

View file

@ -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);

View file

@ -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,

View file

@ -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(),