Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add window rules for mouse and touchpad scroll factors #8655

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

myQwil
Copy link
Contributor

@myQwil myQwil commented Dec 6, 2024

Describe your PR, what does it fix/add?

There are scenarios where I want the scroll factor to be different on a per-window/application basis. This change adds window rules for overriding the global scroll factors. There is one for the mouse scroll factor (scrollmouse) and one for the touchpad (scrolltouchpad)

Example:

hyprland.conf:

# Faster scrolling in Dolphin
windowrulev2 = scrollmouse 3, class:org.kde.dolphin

# Even faster scrolling in Sublime Text
windowrulev2 = scrollmouse 5, class:sublime_text

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

Not that I can think of.

Is it ready for merging, or does it need work?

Ready for merging.

fufexan
fufexan previously approved these changes Dec 6, 2024
Copy link
Member

@fufexan fufexan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested on my touchpad, lgtm.

@vaxerski

@myQwil
Copy link
Contributor Author

myQwil commented Dec 7, 2024

Something's still off. The touchpad scroll factor is using input:touchpad:scroll_factor but then doesn't get overridden by scrolltouchpad window rules. It does, however, get overridden by scrollmouse window rules.

EDIT: It's been fixed. scrolltouchpad was sending the window's scrollMouse property instead of scrollTouchpad.

@vaxerski
Copy link
Member

vaxerski commented Dec 7, 2024

can you rebase on main pls?

@myQwil myQwil force-pushed the window_scroll_factor branch 2 times, most recently from 9905116 to ecc116f Compare December 7, 2024 18:54
@myQwil myQwil changed the title WIP: Add a window rule for scroll factor WIP: Add window rules for scroll factors Dec 7, 2024
@myQwil myQwil changed the title WIP: Add window rules for scroll factors WIP: Add window rules for mouse and touchpad scroll factors Dec 7, 2024
src/config/ConfigManager.hpp Outdated Show resolved Hide resolved
src/managers/KeybindManager.cpp Outdated Show resolved Hide resolved
src/managers/input/InputManager.cpp Outdated Show resolved Hide resolved
src/managers/input/InputManager.cpp Outdated Show resolved Hide resolved
@myQwil myQwil force-pushed the window_scroll_factor branch from ecc116f to 60003a2 Compare December 8, 2024 23:10
@myQwil
Copy link
Contributor Author

myQwil commented Dec 8, 2024

Okay, made the following changes:

  • ConfigManager.hpp: made the PHLWINDOW parameters refs
  • InputManager.cpp: removed redundant parentheses
  • KeybindManager.cpp: switched to using std::stof
    • was going to add a try catch, but it's already in one for catching prop value parsing errors.

@myQwil myQwil changed the title WIP: Add window rules for mouse and touchpad scroll factors Add window rules for mouse and touchpad scroll factors Dec 9, 2024
@myQwil myQwil force-pushed the window_scroll_factor branch from 60003a2 to c6b0de8 Compare December 9, 2024 06:52
@myQwil
Copy link
Contributor Author

myQwil commented Dec 9, 2024

Moved the factor override past all the potential early return cases.

Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks!

@vaxerski
Copy link
Member

vaxerski commented Dec 9, 2024

just a wiki mr needed

@fufexan fufexan merged commit a5170e2 into hyprwm:main Dec 11, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants