From d995a39da885f10a18ecdb67126fd965be8a7775 Mon Sep 17 00:00:00 2001 From: Stefano Volpe Date: Tue, 18 Jan 2022 19:51:49 +0100 Subject: [PATCH] feat(alsa): add middle and right mouse button events (#2573) * Add events to alsa module * Update CHANGELOG * Update CHANGELOG.md Closes #2566 Co-authored-by: Patrick Ziegler --- CHANGELOG.md | 2 ++ src/modules/alsa.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ada85b87..0f3527c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -73,6 +73,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `DEBUG_SHADED` cmake variable and its associated functionality. ### Added +- Right and middle click events for alsa module. + ([`#2566`](https://github.com/polybar/polybar/issues/2566)) - `internal/network`: New token `%mac%` shows MAC address of selected interface ([`#2568`](https://github.com/polybar/polybar/issues/2568)) - Polybar can now read config files from stdin: `polybar -c /dev/stdin`. diff --git a/src/modules/alsa.cpp b/src/modules/alsa.cpp index 143787c6..88aad7a3 100644 --- a/src/modules/alsa.cpp +++ b/src/modules/alsa.cpp @@ -196,6 +196,17 @@ namespace modules { string output{module::get_output()}; if (m_handle_events) { + auto click_middle = m_conf.get(name(), "click-middle", ""s); + auto click_right = m_conf.get(name(), "click-right", ""s); + + if (!click_middle.empty()) { + m_builder->action(mousebtn::MIDDLE, click_middle); + } + + if (!click_right.empty()) { + m_builder->action(mousebtn::RIGHT, click_right); + } + m_builder->action(mousebtn::LEFT, *this, EVENT_TOGGLE, ""); m_builder->action(mousebtn::SCROLL_UP, *this, EVENT_INC, ""); m_builder->action(mousebtn::SCROLL_DOWN, *this, EVENT_DEC, "");