Merge pull request #2968 from jramrath/hyprland_workspaces_monitor_class
Hyprland workspaces `hosting-monitor` css classpull/3023/head
commit
ca17bdb214
|
@ -85,6 +85,7 @@ class Workspace {
|
||||||
void setVisible(bool value = true) { m_isVisible = value; };
|
void setVisible(bool value = true) { m_isVisible = value; };
|
||||||
void setWindows(uint value) { m_windows = value; };
|
void setWindows(uint value) { m_windows = value; };
|
||||||
void setName(std::string const& value) { m_name = value; };
|
void setName(std::string const& value) { m_name = value; };
|
||||||
|
void setOutput(std::string const& value) { m_output = value; };
|
||||||
bool containsWindow(WindowAddress const& addr) const { return m_windowMap.contains(addr); }
|
bool containsWindow(WindowAddress const& addr) const { return m_windowMap.contains(addr); }
|
||||||
void insertWindow(WindowCreationPayload create_window_paylod);
|
void insertWindow(WindowCreationPayload create_window_paylod);
|
||||||
std::string removeWindow(WindowAddress const& addr);
|
std::string removeWindow(WindowAddress const& addr);
|
||||||
|
|
|
@ -158,3 +158,4 @@ Additional to workspace name matching, the following *format-icons* can be set.
|
||||||
- *#workspaces button.persistent*
|
- *#workspaces button.persistent*
|
||||||
- *#workspaces button.special*
|
- *#workspaces button.special*
|
||||||
- *#workspaces button.urgent*
|
- *#workspaces button.urgent*
|
||||||
|
- *#workspaces button.hosting-monitor* (gets applied if workspace-monitor == waybar-monitor)
|
||||||
|
|
|
@ -208,6 +208,7 @@ void Workspaces::doUpdate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
spdlog::trace("Updating workspace states");
|
spdlog::trace("Updating workspace states");
|
||||||
|
auto updated_workspaces = gIPC->getSocket1JsonReply("workspaces");
|
||||||
for (auto &workspace : m_workspaces) {
|
for (auto &workspace : m_workspaces) {
|
||||||
// active
|
// active
|
||||||
workspace->setActive(workspace->name() == m_activeWorkspaceName ||
|
workspace->setActive(workspace->name() == m_activeWorkspaceName ||
|
||||||
|
@ -226,6 +227,16 @@ void Workspaces::doUpdate() {
|
||||||
if (m_withIcon) {
|
if (m_withIcon) {
|
||||||
workspaceIcon = workspace->selectIcon(m_iconsMap);
|
workspaceIcon = workspace->selectIcon(m_iconsMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update m_output
|
||||||
|
auto updated_workspace =
|
||||||
|
std::find_if(updated_workspaces.begin(), updated_workspaces.end(), [&workspace](auto &w) {
|
||||||
|
auto wNameRaw = w["name"].asString();
|
||||||
|
auto wName = wNameRaw.starts_with("special:") ? wNameRaw.substr(8) : wNameRaw;
|
||||||
|
return wName == workspace->name();
|
||||||
|
});
|
||||||
|
workspace->setOutput((*updated_workspace)["monitor"].asString());
|
||||||
|
|
||||||
workspace->update(m_format, workspaceIcon);
|
workspace->update(m_format, workspaceIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -876,6 +887,7 @@ void Workspace::update(const std::string &format, const std::string &icon) {
|
||||||
addOrRemoveClass(styleContext, isPersistent(), "persistent");
|
addOrRemoveClass(styleContext, isPersistent(), "persistent");
|
||||||
addOrRemoveClass(styleContext, isUrgent(), "urgent");
|
addOrRemoveClass(styleContext, isUrgent(), "urgent");
|
||||||
addOrRemoveClass(styleContext, isVisible(), "visible");
|
addOrRemoveClass(styleContext, isVisible(), "visible");
|
||||||
|
addOrRemoveClass(styleContext, m_workspaceManager.getBarOutput() == output(), "hosting-monitor");
|
||||||
|
|
||||||
std::string windows;
|
std::string windows;
|
||||||
auto windowSeparator = m_workspaceManager.getWindowSeparator();
|
auto windowSeparator = m_workspaceManager.getWindowSeparator();
|
||||||
|
|
Loading…
Reference in New Issue