From 08b4a8333193097a3b119e38baa745bca5eaf771 Mon Sep 17 00:00:00 2001 From: Ashutosh Malviya Date: Fri, 15 Oct 2021 19:07:25 +0530 Subject: [PATCH] Add reverse scrolling config option for pulseaudio When natural scrolling is enabled, the behaviour of scrolling on pulseaudio module is reversed, this commit reverses the direction of scroll variable if "reverse-scrolling" is set to 1 in config file. --- src/modules/pulseaudio.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/modules/pulseaudio.cpp b/src/modules/pulseaudio.cpp index cf427800..e5b855be 100644 --- a/src/modules/pulseaudio.cpp +++ b/src/modules/pulseaudio.cpp @@ -79,6 +79,13 @@ bool waybar::modules::Pulseaudio::handleScroll(GdkEventScroll *e) { if (dir == SCROLL_DIR::NONE) { return true; } + if (config_["reverse-scrolling"].asInt() == 1){ + if (dir == SCROLL_DIR::UP) { + dir = SCROLL_DIR::DOWN; + } else if (dir == SCROLL_DIR::DOWN) { + dir = SCROLL_DIR::UP; + } + } double volume_tick = static_cast(PA_VOLUME_NORM) / 100; pa_volume_t change = volume_tick; pa_cvolume pa_volume = pa_volume_;