diff --git a/CHANGELOG.md b/CHANGELOG.md index 4850759a..d5ee0ae8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 repository. ### Added +- `internal/xworkspaces`: `reverse-scroll` can be used to reverse the scroll + direction when cycling through desktops. - The backslash escape character (\\). [`#2354`](https://github.com/polybar/polybar/issues/2354) - Warn states for the cpu, memory, fs, and battery modules. diff --git a/include/modules/xworkspaces.hpp b/include/modules/xworkspaces.hpp index 4664e3d0..f98d6465 100644 --- a/include/modules/xworkspaces.hpp +++ b/include/modules/xworkspaces.hpp @@ -112,6 +112,7 @@ namespace modules { bool m_pinworkspaces{false}; bool m_click{true}; bool m_scroll{true}; + bool m_revscroll{false}; size_t m_index{0}; // The following mutex is here to protect the data of this modules. diff --git a/src/modules/xworkspaces.cpp b/src/modules/xworkspaces.cpp index b2752b41..2e78b371 100644 --- a/src/modules/xworkspaces.cpp +++ b/src/modules/xworkspaces.cpp @@ -43,6 +43,7 @@ namespace modules { m_pinworkspaces = m_conf.get(name(), "pin-workspaces", m_pinworkspaces); m_click = m_conf.get(name(), "enable-click", m_click); m_scroll = m_conf.get(name(), "enable-scroll", m_scroll); + m_revscroll = m_conf.get(name(), "reverse-scroll", m_revscroll); // Initialize ewmh atoms if ((m_ewmh = ewmh_util::initialize()) == nullptr) { @@ -329,8 +330,8 @@ namespace modules { } if (m_scroll) { - m_builder->action(mousebtn::SCROLL_DOWN, *this, EVENT_PREV, ""); - m_builder->action(mousebtn::SCROLL_UP, *this, EVENT_NEXT, ""); + m_builder->action(mousebtn::SCROLL_DOWN, *this, m_revscroll ? EVENT_NEXT : EVENT_PREV, ""); + m_builder->action(mousebtn::SCROLL_UP, *this, m_revscroll ? EVENT_PREV : EVENT_NEXT, ""); } m_builder->append(output);