Skip to content

Commit

Permalink
Merge pull request #3143 from tomben13/fix_workspaces
Browse files Browse the repository at this point in the history
Fixes for hyprland/workspaces
  • Loading branch information
Alexays authored Apr 17, 2024
2 parents 3efebc2 + 084b561 commit dd092a5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/modules/hyprland/workspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ void Workspaces::doUpdate() {
for (auto &[workspaceData, clientsData] : m_workspacesToCreate) {
createWorkspace(workspaceData, clientsData);
}
if (!m_workspacesToCreate.empty()) {
updateWindowCount();
sortWorkspaces();
}
m_workspacesToCreate.clear();

// get all active workspaces
Expand Down Expand Up @@ -318,7 +322,7 @@ void Workspaces::onEvent(const std::string &ev) {
onWorkspaceCreated(payload);
} else if (eventName == "focusedmon") {
onMonitorFocused(payload);
} else if (eventName == "moveworkspace" && !allOutputs()) {
} else if (eventName == "moveworkspace") {
onWorkspaceMoved(payload);
} else if (eventName == "openwindow") {
onWindowOpened(payload);
Expand Down Expand Up @@ -387,6 +391,12 @@ void Workspaces::onWorkspaceCreated(std::string const &workspaceName,

void Workspaces::onWorkspaceMoved(std::string const &payload) {
spdlog::debug("Workspace moved: {}", payload);

// Update active workspace
m_activeWorkspaceName = (gIPC->getSocket1JsonReply("activeworkspace"))["name"].asString();

if (allOutputs()) return;

std::string workspaceName = payload.substr(0, payload.find(','));
std::string monitorName = payload.substr(payload.find(',') + 1);

Expand Down Expand Up @@ -826,8 +836,6 @@ void Workspaces::init() {
m_activeWorkspaceName = (gIPC->getSocket1JsonReply("activeworkspace"))["name"].asString();

initializeWorkspaces();
updateWindowCount();
sortWorkspaces();
dp.emit();
}

Expand Down

0 comments on commit dd092a5

Please sign in to comment.