niri: add support for urgency indicators to workspaces
This commit is contained in:
@ -20,6 +20,7 @@ Workspaces::Workspaces(const std::string &id, const Bar &bar, const Json::Value
|
||||
gIPC->registerForIPC("WorkspacesChanged", this);
|
||||
gIPC->registerForIPC("WorkspaceActivated", this);
|
||||
gIPC->registerForIPC("WorkspaceActiveWindowChanged", this);
|
||||
gIPC->registerForIPC("WorkspaceUrgencyChanged", this);
|
||||
|
||||
dp.emit();
|
||||
}
|
||||
@ -67,6 +68,11 @@ void Workspaces::doUpdate() {
|
||||
else
|
||||
style_context->remove_class("active");
|
||||
|
||||
if (ws["is_urgent"].asBool())
|
||||
style_context->add_class("urgent");
|
||||
else
|
||||
style_context->remove_class("urgent");
|
||||
|
||||
if (ws["output"]) {
|
||||
if (ws["output"].asString() == bar_.output->name)
|
||||
style_context->add_class("current_output");
|
||||
@ -166,6 +172,8 @@ std::string Workspaces::getIcon(const std::string &value, const Json::Value &ws)
|
||||
const auto &icons = config_["format-icons"];
|
||||
if (!icons) return value;
|
||||
|
||||
if (ws["is_urgent"].asBool() && icons["urgent"]) return icons["urgent"].asString();
|
||||
|
||||
if (ws["is_focused"].asBool() && icons["focused"]) return icons["focused"].asString();
|
||||
|
||||
if (ws["is_active"].asBool() && icons["active"]) return icons["active"].asString();
|
||||
|
||||
Reference in New Issue
Block a user