mirror of
https://github.com/scorpion-26/gBar.git
synced 2024-11-22 03:02:49 +00:00
Always activate first x monitors
The workspace of a second monitor would not be activated, so lastActiveWorkspace of that would be nullptr. This would also happen for the first monitor (First and second swapped) after Hyprland boot. Now the WS of the first monitor is fully activated by default and every other monitor has at least lastActiveWorkspace set (Assumes, that WS with MonID + 1 is on that monitor).
This commit is contained in:
parent
f2bc8e00c8
commit
78107f16fa
1 changed files with 30 additions and 0 deletions
|
@ -67,10 +67,15 @@ namespace Workspaces
|
||||||
{
|
{
|
||||||
if (*state == ZEXT_WORKSPACE_HANDLE_V1_STATE_ACTIVE)
|
if (*state == ZEXT_WORKSPACE_HANDLE_V1_STATE_ACTIVE)
|
||||||
{
|
{
|
||||||
|
LOG("Wayland: Activate Workspace " << workspace.id);
|
||||||
group.lastActiveWorkspace = ws;
|
group.lastActiveWorkspace = ws;
|
||||||
workspace.active = true;
|
workspace.active = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!workspace.active)
|
||||||
|
{
|
||||||
|
LOG("Wayland: Deactivate Workspace " << workspace.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
static void OnWorkspaceRemove(void*, zext_workspace_handle_v1* ws)
|
static void OnWorkspaceRemove(void*, zext_workspace_handle_v1* ws)
|
||||||
{
|
{
|
||||||
|
@ -202,6 +207,31 @@ namespace Workspaces
|
||||||
RuntimeConfig::Get().hasWorkspaces = false;
|
RuntimeConfig::Get().hasWorkspaces = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hack: manually activate workspace for each monitor
|
||||||
|
for (auto& monitor : monitors)
|
||||||
|
{
|
||||||
|
// Find group
|
||||||
|
auto& group = workspaceGroups[monitor.second.workspaceGroup];
|
||||||
|
|
||||||
|
// Find ws with monitor index + 1
|
||||||
|
auto workspaceIt = std::find_if(workspaces.begin(), workspaces.end(),
|
||||||
|
[&](const std::pair<zext_workspace_handle_v1*, WaylandWorkspace>& ws)
|
||||||
|
{
|
||||||
|
return ws.second.id == monitor.first + 1;
|
||||||
|
});
|
||||||
|
if (workspaceIt != workspaces.end())
|
||||||
|
{
|
||||||
|
LOG("Forcefully activate workspace " << workspaceIt->second.id)
|
||||||
|
if (workspaceIt->second.id == 1)
|
||||||
|
{
|
||||||
|
// Activate first workspace
|
||||||
|
workspaceIt->second.active = true;
|
||||||
|
}
|
||||||
|
// Make it visible
|
||||||
|
group.lastActiveWorkspace = workspaceIt->first;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hack for unified interface
|
// Hack for unified interface
|
||||||
|
|
Loading…
Reference in a new issue