Skip to content

Commit

Permalink
applied clang-tidy suggestions for hyprland workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
zjeffer committed Dec 4, 2023
1 parent 1ce35a2 commit a984ce5
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/modules/hyprland/workspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ auto Workspaces::update() -> void {
}

bool anyWindowCreated = false;
std::vector<WindowCreationPayload> not_created;
std::vector<WindowCreationPayload> notCreated;

for (auto &windowPayload : m_windowsToCreate) {
bool created = false;
Expand All @@ -213,9 +213,9 @@ auto Workspaces::update() -> void {
}
}
if (!created) {
static auto const windowCreationTimeout = 2;
if (windowPayload.incrementTimeSpentUncreated() < windowCreationTimeout) {
not_created.push_back(windowPayload);
static auto const WINDOW_CREATION_TIMEOUT = 2;
if (windowPayload.incrementTimeSpentUncreated() < WINDOW_CREATION_TIMEOUT) {
notCreated.push_back(windowPayload);
}
}
}
Expand All @@ -225,7 +225,7 @@ auto Workspaces::update() -> void {
}

m_windowsToCreate.clear();
m_windowsToCreate = not_created;
m_windowsToCreate = notCreated;

AModule::update();
}
Expand Down Expand Up @@ -955,12 +955,12 @@ void WindowCreationPayload::clearAddr() {
// 0x{ADDR}
// While Hyprland's IPC follows this format:
// {ADDR}
static const std::string addrPrefix = "0x";
static const int addrPrefixLen = addrPrefix.length();
static const std::string ADDR_PREFIX = "0x";
static const int ADDR_PREFIX_LEN = ADDR_PREFIX.length();

if (m_windowAddress.starts_with(addrPrefix)) {
if (m_windowAddress.starts_with(ADDR_PREFIX)) {
m_windowAddress =
m_windowAddress.substr(addrPrefixLen, m_windowAddress.length() - addrPrefixLen);
m_windowAddress.substr(ADDR_PREFIX_LEN, m_windowAddress.length() - ADDR_PREFIX_LEN);
}
}

Expand All @@ -970,12 +970,12 @@ void WindowCreationPayload::clearWorkspaceName() {
// special qualifier. The reasoning is that not all of Hyprland's IPC events
// use this qualifier, so it's better to be consistent about our uses.

static const std::string specialQualifierPrefix = "special:";
static const int specialQualifierPrefixLen = specialQualifierPrefix.length();
static const std::string SPECIAL_QUALIFIER_PREFIX = "special:";
static const int SPECIAL_QUALIFIER_PREFIX_LEN = SPECIAL_QUALIFIER_PREFIX.length();

if (m_workspaceName.starts_with(specialQualifierPrefix)) {
m_workspaceName = m_workspaceName.substr(specialQualifierPrefixLen,
m_workspaceName.length() - specialQualifierPrefixLen);
if (m_workspaceName.starts_with(SPECIAL_QUALIFIER_PREFIX)) {
m_workspaceName = m_workspaceName.substr(
SPECIAL_QUALIFIER_PREFIX_LEN, m_workspaceName.length() - SPECIAL_QUALIFIER_PREFIX_LEN);
}
}

Expand Down

0 comments on commit a984ce5

Please sign in to comment.