1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-11 13:50:56 -05:00

fix(bspwm): Focus monitor before sending scroll cmd #503

This commit is contained in:
Michael Carlberg 2017-04-02 18:21:09 +02:00
parent 02833b7871
commit d6b0c5f003

View file

@ -473,25 +473,31 @@ namespace modules {
return true;
}
string modifier;
string scrolldir;
if (m_pinworkspaces) {
modifier = ".local";
}
if (cmd.compare(0, strlen(EVENT_SCROLL_UP), EVENT_SCROLL_UP) == 0) {
scrolldir = m_revscroll ? "prev" : "next";
} else if (cmd.compare(0, strlen(EVENT_SCROLL_DOWN), EVENT_SCROLL_DOWN) == 0) {
scrolldir = m_revscroll ? "next" : "prev";
}
if (!scrolldir.empty()) {
send_command("desktop -f " + scrolldir + modifier, "Sending desktop " + scrolldir + " command to ipc handler");
} else {
return false;
}
string modifier;
if (m_pinworkspaces) {
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");
break;
}
}
send_command("desktop -f " + scrolldir + modifier, "Sending desktop " + scrolldir + " command to ipc handler");
return true;
}
}