Skip to content

Commit

Permalink
Merge pull request #923 from tristancorbellari/invert-scroll-settings…
Browse files Browse the repository at this point in the history
…-toggle

Add "Invert Scroll" toggle to settings
  • Loading branch information
xanderfrangos authored Jan 5, 2025
2 parents 74e2256 + d671587 commit c0299b6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/SettingsWindow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,7 @@ export default class SettingsWindow extends PureComponent {
this.forceUpdate()
}} />
} />
<SettingsChild title={T.t("SETTINGS_HOTKEYS_INVERT_SCROLL_TITLE")} description={T.t("SETTINGS_HOTKEYS_INVERT_SCROLL_DESC")} input={this.renderToggle("invertScroll")} />
</SettingsOption>
</div>

Expand Down
4 changes: 3 additions & 1 deletion src/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -445,6 +446,7 @@ const defaultSettings = {
scrollShortcut: true,
scrollShortcutAmount: 2,
scrollFlyoutAmount: 2,
invertScroll: false,
useAcrylic: false,
useNativeAnimation: false,
sleepAction: "ps",
Expand Down
2 changes: 2 additions & 0 deletions src/localization/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down

0 comments on commit c0299b6

Please sign in to comment.