From d671587ec3b6b41fc4846301f1d0fce35a0d4cf2 Mon Sep 17 00:00:00 2001 From: tristancorbellari Date: Sun, 5 Jan 2025 13:57:40 +0800 Subject: [PATCH] Add "Invert Scroll" toggle to settings --- src/components/SettingsWindow.jsx | 1 + src/electron.js | 4 +++- src/localization/en.json | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/SettingsWindow.jsx b/src/components/SettingsWindow.jsx index e4f662fe..70b79ada 100644 --- a/src/components/SettingsWindow.jsx +++ b/src/components/SettingsWindow.jsx @@ -1298,6 +1298,7 @@ export default class SettingsWindow extends PureComponent { this.forceUpdate() }} /> } /> + diff --git a/src/electron.js b/src/electron.js index f0036714..bf875a2e 100644 --- a/src/electron.js +++ b/src/electron.js @@ -278,7 +278,8 @@ function enableMouseEvents() { try { if (!bounds) return false; if (event.x >= bounds.x && event.x <= bounds.x + bounds.width && event.y >= bounds.y && event.y <= bounds.y + bounds.height) { - const amount = Math.round(event.delta) * settings.scrollShortcutAmount; + const delta = settings.invertScroll ? -Math.round(event.delta) : Math.round(event.delta); + const amount = delta * settings.scrollShortcutAmount; refreshMonitors() updateAllBrightness(amount) @@ -445,6 +446,7 @@ const defaultSettings = { scrollShortcut: true, scrollShortcutAmount: 2, scrollFlyoutAmount: 2, + invertScroll: false, useAcrylic: false, useNativeAnimation: false, sleepAction: "ps", diff --git a/src/localization/en.json b/src/localization/en.json index 885b6991..61b942cf 100644 --- a/src/localization/en.json +++ b/src/localization/en.json @@ -170,6 +170,8 @@ "SETTINGS_HOTKEYS_LEVEL_TITLE": "Brightness level adjustment", "SETTINGS_HOTKEYS_LEVEL_DESC": "How much the brightness should be adjusted when using hotkeys.", "SETTINGS_HOTKEYS_SCROLL_AMOUNT": "Amount to scroll", + "SETTINGS_HOTKEYS_INVERT_SCROLL_TITLE": "Invert scroll", + "SETTINGS_HOTKEYS_INVERT_SCROLL_DESC": "When scrolling over the system tray icon, the scroll direction will be reversed.", "SETTINGS_HOTKEYS_TOD_TITLE": "Turn Off Displays action", "SETTINGS_HOTKEYS_TOD_DESC": "Customize the signal sent when using the Turn Off Displays hotkey or icon. The software signal will display a black screen until input (ex. mouse or keyboard) is detected by Windows. The hardware signal will turn off power to the monitors.", "SETTINGS_HOTKEYS_TOD_NONE": "None (hide icon)",