mirror of
https://github.com/polybar/polybar.git
synced 2024-11-18 13:55:11 -05:00
fix(i3): Use ws name for click handling #520
This commit is contained in:
parent
4e2e2a7a5e
commit
863c510903
2 changed files with 7 additions and 7 deletions
|
@ -34,12 +34,12 @@ namespace modules {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct workspace {
|
struct workspace {
|
||||||
explicit workspace(int index, enum state state_, label_t&& label)
|
explicit workspace(string name, enum state state_, label_t&& label)
|
||||||
: index(index), state(state_), label(forward<label_t>(label)) {}
|
: name(name), state(state_), label(forward<label_t>(label)) {}
|
||||||
|
|
||||||
operator bool();
|
operator bool();
|
||||||
|
|
||||||
int index;
|
string name;
|
||||||
enum state state;
|
enum state state;
|
||||||
label_t label;
|
label_t label;
|
||||||
};
|
};
|
||||||
|
|
|
@ -152,7 +152,7 @@ namespace modules {
|
||||||
label->replace_token("%name%", ws_name);
|
label->replace_token("%name%", ws_name);
|
||||||
label->replace_token("%icon%", icon->get());
|
label->replace_token("%icon%", icon->get());
|
||||||
label->replace_token("%index%", to_string(ws->num));
|
label->replace_token("%index%", to_string(ws->num));
|
||||||
m_workspaces.emplace_back(factory_util::unique<workspace>(ws->num, ws_state, move(label)));
|
m_workspaces.emplace_back(factory_util::unique<workspace>(ws->name, ws_state, move(label)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -173,7 +173,7 @@ namespace modules {
|
||||||
|
|
||||||
for (auto&& ws : m_workspaces) {
|
for (auto&& ws : m_workspaces) {
|
||||||
if (m_click) {
|
if (m_click) {
|
||||||
builder->cmd(mousebtn::LEFT, string{EVENT_CLICK} + to_string(ws->index));
|
builder->cmd(mousebtn::LEFT, string{EVENT_CLICK} + ws->name);
|
||||||
builder->node(ws->label);
|
builder->node(ws->label);
|
||||||
builder->cmd_close();
|
builder->cmd_close();
|
||||||
} else {
|
} else {
|
||||||
|
@ -202,9 +202,9 @@ namespace modules {
|
||||||
|
|
||||||
if (cmd.compare(0, strlen(EVENT_CLICK), EVENT_CLICK) == 0) {
|
if (cmd.compare(0, strlen(EVENT_CLICK), EVENT_CLICK) == 0) {
|
||||||
cmd.erase(0, strlen(EVENT_CLICK));
|
cmd.erase(0, strlen(EVENT_CLICK));
|
||||||
if (i3_util::focused_workspace(conn)->num != atoi(cmd.c_str())) {
|
if (i3_util::focused_workspace(conn)->name != cmd) {
|
||||||
m_log.info("%s: Sending workspace focus command to ipc handler", name());
|
m_log.info("%s: Sending workspace focus command to ipc handler", name());
|
||||||
conn.send_command("workspace number " + cmd);
|
conn.send_command("workspace " + cmd);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue