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
This commit is contained in:
Flexlolo 2021-05-13 17:59:13 +07:00 committed by GitHub
parent 10bbec4451
commit 735a08ba7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -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. - 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. Fixes the issue where the bar is being drawn on top of fullscreen windows in xmonad.
([`#2205`](https://github.com/polybar/polybar/issues/2205)) ([`#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 ### Changed
- Slight changes to the value ranges the different ramp levels are responsible - Slight changes to the value ranges the different ramp levels are responsible

View File

@ -88,6 +88,7 @@ namespace modules {
bool m_click{true}; bool m_click{true};
bool m_scroll{true}; bool m_scroll{true};
bool m_occscroll{false};
bool m_revscroll{true}; bool m_revscroll{true};
bool m_pinworkspaces{true}; bool m_pinworkspaces{true};
bool m_inlinemode{false}; bool m_inlinemode{false};

View File

@ -58,6 +58,7 @@ namespace modules {
m_pinworkspaces = m_conf.get(name(), "pin-workspaces", m_pinworkspaces); m_pinworkspaces = m_conf.get(name(), "pin-workspaces", m_pinworkspaces);
m_click = m_conf.get(name(), "enable-click", m_click); m_click = m_conf.get(name(), "enable-click", m_click);
m_scroll = m_conf.get(name(), "enable-scroll", m_scroll); 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_revscroll = m_conf.get(name(), "reverse-scroll", m_revscroll);
m_inlinemode = m_conf.get(name(), "inline-mode", m_inlinemode); m_inlinemode = m_conf.get(name(), "inline-mode", m_inlinemode);
m_fuzzy_match = m_conf.get(name(), "fuzzy-match", m_fuzzy_match); m_fuzzy_match = m_conf.get(name(), "fuzzy-match", m_fuzzy_match);
@ -473,8 +474,12 @@ namespace modules {
string scrolldir = next ? "next" : "prev"; string scrolldir = next ? "next" : "prev";
string modifier; string modifier;
if (m_occscroll) {
modifier += ".occupied";
}
if (m_pinworkspaces) { if (m_pinworkspaces) {
modifier = ".local"; modifier += ".local";
for (const auto& mon : m_monitors) { for (const auto& mon : m_monitors) {
if (m_bar.monitor->match(mon->name, false) && !mon->focused) { if (m_bar.monitor->match(mon->name, false) && !mon->focused) {
send_command("monitor -f " + mon->name, "Sending monitor focus command to ipc handler"); send_command("monitor -f " + mon->name, "Sending monitor focus command to ipc handler");