Merge pull request #2789 from DreamMaoMao/master

fix:#2769
pull/2813/head
Alexis Rouillard 2024-01-04 15:33:26 +01:00 committed by GitHub
commit 4b20f522f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -6,7 +6,9 @@
#include <algorithm>
#include <charconv>
#include <memory>
#include <shared_mutex>
#include <string>
#include <thread>
#include <utility>
#include <variant>
@ -14,6 +16,8 @@
namespace waybar::modules::hyprland {
std::shared_mutex workspaceCreateSmtx;
int Workspaces::windowRewritePriorityFunction(std::string const &window_rule) {
// Rules that match against title are prioritized
// Rules that don't specify if they're matching against either title or class are deprioritized
@ -161,6 +165,7 @@ auto Workspaces::update() -> void {
}
// add workspaces that wait to be created
std::shared_lock<std::shared_mutex> workspaceCreateShareLock(workspaceCreateSmtx);
unsigned int currentCreateWorkspaceNum = 0;
for (Json::Value const &workspaceToCreate : m_workspacesToCreate) {
createWorkspace(workspaceToCreate);
@ -300,6 +305,7 @@ void Workspaces::onWorkspaceCreated(std::string const &payload) {
if (name == payload &&
(allOutputs() || m_bar.output->name == workspaceJson["monitor"].asString()) &&
(showSpecial() || !name.starts_with("special")) && !isDoubleSpecial(payload)) {
std::unique_lock<std::shared_mutex> workspaceCreateUniqueLock(workspaceCreateSmtx);
m_workspacesToCreate.push_back(workspaceJson);
break;
}