From 735a08ba7cca0b0b285810aaa38444dfb5a8e07e Mon Sep 17 00:00:00 2001 From: Flexlolo <43651714+Flexlolo@users.noreply.github.com> Date: Thu, 13 May 2021 17:59:13 +0700 Subject: [PATCH] feat(bspwm): Option to scroll through occupied desktops only (#2428) * Implement option occupied-scroll to bspwm module * update changelog * change default value of the setting --- CHANGELOG.md | 3 +++ include/modules/bspwm.hpp | 1 + src/modules/bspwm.cpp | 7 ++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 545bfef6..52625a99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -93,6 +93,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added `wm-restack = generic` option that lowers polybar to the bottom of the stack. Fixes the issue where the bar is being drawn on top of fullscreen windows in xmonad. ([`#2205`](https://github.com/polybar/polybar/issues/2205)) +- Added `occupied-scroll = true` option to bspwm module. + Allows scrolling only through occupied desktops only. + ([`#2427`](https://github.com/polybar/polybar/issues/2427)) ### Changed - Slight changes to the value ranges the different ramp levels are responsible diff --git a/include/modules/bspwm.hpp b/include/modules/bspwm.hpp index 056d36d9..002505cd 100644 --- a/include/modules/bspwm.hpp +++ b/include/modules/bspwm.hpp @@ -88,6 +88,7 @@ namespace modules { bool m_click{true}; bool m_scroll{true}; + bool m_occscroll{false}; bool m_revscroll{true}; bool m_pinworkspaces{true}; bool m_inlinemode{false}; diff --git a/src/modules/bspwm.cpp b/src/modules/bspwm.cpp index f9ad8353..aacb66dd 100644 --- a/src/modules/bspwm.cpp +++ b/src/modules/bspwm.cpp @@ -58,6 +58,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_occscroll = m_conf.get(name(), "occupied-scroll", m_occscroll); m_revscroll = m_conf.get(name(), "reverse-scroll", m_revscroll); m_inlinemode = m_conf.get(name(), "inline-mode", m_inlinemode); m_fuzzy_match = m_conf.get(name(), "fuzzy-match", m_fuzzy_match); @@ -473,8 +474,12 @@ namespace modules { string scrolldir = next ? "next" : "prev"; string modifier; + if (m_occscroll) { + modifier += ".occupied"; + } + if (m_pinworkspaces) { - modifier = ".local"; + modifier += ".local"; for (const auto& mon : m_monitors) { if (m_bar.monitor->match(mon->name, false) && !mon->focused) { send_command("monitor -f " + mon->name, "Sending monitor focus command to ipc handler");