feat(bspwm): Configurable scroll/click actions
This commit is contained in:
parent
171e69bd30
commit
42bcfd9fa1
@ -70,6 +70,9 @@ namespace modules {
|
|||||||
map<state_ws, label_t> m_statelabels;
|
map<state_ws, label_t> m_statelabels;
|
||||||
label_t m_monitorlabel;
|
label_t m_monitorlabel;
|
||||||
iconset_t m_icons;
|
iconset_t m_icons;
|
||||||
|
|
||||||
|
bool m_click = true;
|
||||||
|
bool m_scroll = true;
|
||||||
bool m_pinworkspaces = true;
|
bool m_pinworkspaces = true;
|
||||||
unsigned long m_hash;
|
unsigned long m_hash;
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@ namespace modules {
|
|||||||
|
|
||||||
// Load configuration values
|
// Load configuration values
|
||||||
GET_CONFIG_VALUE(name(), m_pinworkspaces, "pin-workspaces");
|
GET_CONFIG_VALUE(name(), m_pinworkspaces, "pin-workspaces");
|
||||||
|
GET_CONFIG_VALUE(name(), m_click, "enable-click");
|
||||||
|
GET_CONFIG_VALUE(name(), m_scroll, "enable-scroll");
|
||||||
|
|
||||||
// Add formats and create components
|
// Add formats and create components
|
||||||
m_formatter->add(DEFAULT_FORMAT, TAG_LABEL_STATE, {TAG_LABEL_STATE}, {TAG_LABEL_MONITOR, TAG_LABEL_MODE});
|
m_formatter->add(DEFAULT_FORMAT, TAG_LABEL_STATE, {TAG_LABEL_STATE}, {TAG_LABEL_MONITOR, TAG_LABEL_MODE});
|
||||||
@ -283,9 +285,13 @@ namespace modules {
|
|||||||
int workspace_n = 0;
|
int workspace_n = 0;
|
||||||
|
|
||||||
for (auto&& ws : m_monitors[m_index]->workspaces) {
|
for (auto&& ws : m_monitors[m_index]->workspaces) {
|
||||||
|
if (m_scroll) {
|
||||||
builder->cmd(mousebtn::SCROLL_DOWN, EVENT_SCROLL_DOWN);
|
builder->cmd(mousebtn::SCROLL_DOWN, EVENT_SCROLL_DOWN);
|
||||||
builder->cmd(mousebtn::SCROLL_UP, EVENT_SCROLL_UP);
|
builder->cmd(mousebtn::SCROLL_UP, EVENT_SCROLL_UP);
|
||||||
|
}
|
||||||
|
|
||||||
if (ws.second.get()) {
|
if (ws.second.get()) {
|
||||||
|
if (m_click) {
|
||||||
string event{EVENT_CLICK};
|
string event{EVENT_CLICK};
|
||||||
event += to_string(m_index);
|
event += to_string(m_index);
|
||||||
event += "+";
|
event += "+";
|
||||||
@ -294,6 +300,14 @@ namespace modules {
|
|||||||
builder->cmd(mousebtn::LEFT, event);
|
builder->cmd(mousebtn::LEFT, event);
|
||||||
builder->node(ws.second);
|
builder->node(ws.second);
|
||||||
builder->cmd_close(true);
|
builder->cmd_close(true);
|
||||||
|
} else {
|
||||||
|
builder->node(ws.second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_scroll) {
|
||||||
|
builder->cmd_close(true);
|
||||||
|
builder->cmd_close(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user