dwm: Add layout-reverse-scroll option
This option simply reverses the direction in which the scroll cycles through the layouts.
This commit is contained in:
parent
a22b2ffcc3
commit
f3047ab1e5
@ -174,6 +174,7 @@ enable-tags-click = false
|
||||
enable-layout-click = false
|
||||
enable-layout-scroll = false
|
||||
layout-scroll-wrap = false
|
||||
layout-scroll-reverse = false
|
||||
|
||||
; If enable-layout-click = true, clicking the layout symbol will switch to this layout
|
||||
secondary-layout-symbol = [M]
|
||||
|
@ -258,6 +258,11 @@ namespace modules {
|
||||
*/
|
||||
bool m_layout_wrap{true};
|
||||
|
||||
/**
|
||||
* If true, scrolling the layout will cycle layouts in the reverse direction
|
||||
*/
|
||||
bool m_layout_reverse{false};
|
||||
|
||||
/**
|
||||
* If the layout symbol is clicked on, it will set the layout represented by
|
||||
* this symbol. The default is monocle mode [M].
|
||||
|
@ -58,6 +58,7 @@ namespace modules {
|
||||
m_layout_click = m_conf.get(name(), "enable-layout-click", m_layout_click);
|
||||
m_layout_scroll = m_conf.get(name(), "enable-layout-scroll", m_layout_scroll);
|
||||
m_layout_wrap = m_conf.get(name(), "layout-scroll-wrap", m_layout_wrap);
|
||||
m_layout_reverse = m_conf.get(name(), "layout-scroll-reverse", m_layout_reverse);
|
||||
m_secondary_layout_symbol = m_conf.get(name(), "secondary-layout-symbol", m_secondary_layout_symbol);
|
||||
|
||||
try {
|
||||
@ -164,8 +165,13 @@ namespace modules {
|
||||
if (m_layout_scroll) {
|
||||
auto addr_next = next_layout(*m_current_layout, m_layout_wrap)->address;
|
||||
auto addr_prev = prev_layout(*m_current_layout, m_layout_wrap)->address;
|
||||
builder->cmd(mousebtn::SCROLL_DOWN, build_cmd(EVENT_LAYOUT_SDOWN, to_string(addr_prev)));
|
||||
builder->cmd(mousebtn::SCROLL_UP, build_cmd(EVENT_LAYOUT_SUP, to_string(addr_next)));
|
||||
if (m_layout_reverse) {
|
||||
builder->cmd(mousebtn::SCROLL_DOWN, build_cmd(EVENT_LAYOUT_SDOWN, to_string(addr_prev)));
|
||||
builder->cmd(mousebtn::SCROLL_UP, build_cmd(EVENT_LAYOUT_SUP, to_string(addr_next)));
|
||||
} else {
|
||||
builder->cmd(mousebtn::SCROLL_DOWN, build_cmd(EVENT_LAYOUT_SDOWN, to_string(addr_next)));
|
||||
builder->cmd(mousebtn::SCROLL_UP, build_cmd(EVENT_LAYOUT_SUP, to_string(addr_prev)));
|
||||
}
|
||||
}
|
||||
builder->node(m_layout_label);
|
||||
if (m_layout_click) {
|
||||
|
Loading…
Reference in New Issue
Block a user