Skip to content

Commit 6888949

Browse files
committed
Removed option active-per-monitor
1 parent df7f1ff commit 6888949

File tree

3 files changed

+4
-50
lines changed

3 files changed

+4
-50
lines changed

include/modules/hyprland/workspaces.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ class Workspaces : public AModule, public EventHandler {
127127
auto showSpecial() const -> bool { return m_showSpecial; }
128128
auto activeOnly() const -> bool { return m_activeOnly; }
129129
auto moveToMonitor() const -> bool { return m_moveToMonitor; }
130-
auto activePerMonitor() const -> bool { return m_activePerMonitor; }
131130

132131
auto getBarOutput() const -> std::string { return m_bar.output->name; }
133132

@@ -185,7 +184,6 @@ class Workspaces : public AModule, public EventHandler {
185184
bool m_showSpecial = false;
186185
bool m_activeOnly = false;
187186
bool m_moveToMonitor = false;
188-
bool m_activePerMonitor = false;
189187
Json::Value m_persistentWorkspaceConfig;
190188

191189
// Map for windows stored in workspaces not present in the current bar.

man/waybar-hyprland-workspaces.5.scd

-8
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,6 @@ Addressed by *hyprland/workspaces*
5959
Otherwise, the workspace will open on the monitor where it was previously assigned.
6060
Analog to using `focusworkspaceoncurrentmonitor` dispatcher instead of `workspace` in Hyprland.
6161

62-
*active-per-monitor*: ++
63-
typeof: bool ++
64-
default: false ++
65-
If set to true, each bar on each monitor will show its separate active
66-
workspace being the currently focused workspace on this monitor.
67-
Otherwise, all bars on all monitors will show the same active workspace
68-
being the currently focused workspace on the currently focused monitor.
69-
7062
*ignore-workspaces*: ++
7163
typeof: array ++
7264
default: [] ++

src/modules/hyprland/workspaces.cpp

+4-40
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,6 @@ auto Workspaces::parseConfig(const Json::Value &config) -> void {
8888
m_moveToMonitor = configMoveToMonitor.asBool();
8989
}
9090

91-
auto configActivePerMonitor = config_["active-per-monitor"];
92-
if (configActivePerMonitor.isBool()) {
93-
m_activePerMonitor = configActivePerMonitor.asBool();
94-
}
95-
9691
auto configSortBy = config_["sort-by"];
9792
if (configSortBy.isString()) {
9893
auto sortByStr = configSortBy.asString();
@@ -331,14 +326,7 @@ void Workspaces::onEvent(const std::string &ev) {
331326
}
332327

333328
void Workspaces::onWorkspaceActivated(std::string const &payload) {
334-
if (!m_activePerMonitor) {
335-
m_activeWorkspaceName = payload;
336-
return;
337-
}
338-
auto activeWorkspace = gIPC->getSocket1JsonReply("activeworkspace");
339-
if (m_bar.output->name == activeWorkspace["monitor"].asString()) {
340-
m_activeWorkspaceName = payload;
341-
}
329+
m_activeWorkspaceName = payload;
342330
}
343331

344332
void Workspaces::onSpecialWorkspaceActivated(std::string const &payload) {
@@ -391,16 +379,6 @@ void Workspaces::onWorkspaceMoved(std::string const &payload) {
391379
if (m_bar.output->name == monitorName) {
392380
Json::Value clientsData = gIPC->getSocket1JsonReply("clients");
393381
onWorkspaceCreated(workspaceName, clientsData);
394-
if (m_activePerMonitor) {
395-
for (Json::Value &monitor : gIPC->getSocket1JsonReply("monitors")) {
396-
if (m_bar.output->name == monitor["name"].asString()) {
397-
auto ws = monitor["activeWorkspace"];
398-
if (ws.isObject() && (ws["name"].isString())) {
399-
m_activeWorkspaceName = ws["name"].asString();
400-
}
401-
}
402-
}
403-
}
404382
} else {
405383
spdlog::debug("Removing workspace because it was moved to another monitor: {}");
406384
onWorkspaceDestroyed(workspaceName);
@@ -426,13 +404,10 @@ void Workspaces::onWorkspaceRenamed(std::string const &payload) {
426404

427405
void Workspaces::onMonitorFocused(std::string const &payload) {
428406
spdlog::trace("Monitor focused: {}", payload);
429-
auto monitorName = payload.substr(0, payload.find(','));
430-
if (!m_activePerMonitor || m_bar.output->name == monitorName) {
431-
m_activeWorkspaceName = payload.substr(payload.find(',') + 1);
432-
}
407+
m_activeWorkspaceName = payload.substr(payload.find(',') + 1);
433408

434409
for (Json::Value &monitor : gIPC->getSocket1JsonReply("monitors")) {
435-
if (monitor["name"].asString() == monitorName) {
410+
if (monitor["name"].asString() == payload.substr(0, payload.find(','))) {
436411
auto name = monitor["specialWorkspace"]["name"].asString();
437412
m_activeSpecialWorkspaceName = !name.starts_with("special:") ? name : name.substr(8);
438413
}
@@ -834,18 +809,7 @@ void Workspaces::extendOrphans(int workspaceId, Json::Value const &clientsJson)
834809
}
835810

836811
void Workspaces::init() {
837-
if (!m_activePerMonitor) {
838-
m_activeWorkspaceName = (gIPC->getSocket1JsonReply("activeworkspace"))["name"].asString();
839-
} else {
840-
for (Json::Value &monitor : gIPC->getSocket1JsonReply("monitors")) {
841-
if (m_bar.output->name == monitor["name"].asString()) {
842-
auto ws = monitor["activeWorkspace"];
843-
if (ws.isObject() && (ws["name"].isString())) {
844-
m_activeWorkspaceName = ws["name"].asString();
845-
}
846-
}
847-
}
848-
}
812+
m_activeWorkspaceName = (gIPC->getSocket1JsonReply("activeworkspace"))["name"].asString();
849813

850814
initializeWorkspaces();
851815
updateWindowCount();

0 commit comments

Comments
 (0)