add reverse-scroll option for xworkspaces module (#2365)

* add reverse-scroll option for xworkspaces module

* move use of reverse-scroll option to when producing scroll action

* documented xworkspaces reverse-scroll option in changelog
This commit is contained in:
tchici 2021-01-28 09:11:33 +00:00 committed by GitHub
parent 4ded401aab
commit c676d7e6f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -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.

View File

@ -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.

View File

@ -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);