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