Skip to content

Commit

Permalink
hyprpm: update logic fixes + style changes
Browse files Browse the repository at this point in the history
Signed-off-by: rooot <hey@rooot.gay>
  • Loading branch information
RoootTheFox committed Dec 8, 2024
1 parent f2d46ab commit 4dbc3c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions hyprpm/src/core/PluginManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,21 @@ static std::string getTempRoot() {
}

SHyprlandVersion CPluginManager::getHyprlandVersion(bool running = true) {
static bool once_running = false;
static bool once_installed = false;
static bool onceRunning = false;
static bool onceInstalled = false;
static SHyprlandVersion ver_running;
static SHyprlandVersion ver_installed;

if (once_running && running)
if (onceRunning && running)
return ver_running;

if (once_installed && !running)
if (onceInstalled && !running)
return ver_installed;

if (running)
once_running = true;
onceRunning = true;
else
once_installed = true;
onceInstalled = true;

const auto HLVERCALL = running ? execAndGet("hyprctl version") : execAndGet("Hyprland --version");
if (m_bVerbose)
Expand Down
4 changes: 2 additions & 2 deletions hyprpm/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ int main(int argc, char** argv, char** envp) {
if (ret2 == LOADSTATE_HYPRLAND_UPDATED)
g_pPluginManager->notify(ICON_INFO, 0, 10000, "[hyprpm] Updated plugins, but Hyprland was updated. Please restart Hyprland.");

if (ret2 != LOADSTATE_OK && ret2 != LOADSTATE_HYPRLAND_UPDATED)
if (ret2 != LOADSTATE_OK || ret2 == LOADSTATE_HYPRLAND_UPDATED)
return 1;
} else if (notify)
g_pPluginManager->notify(ICON_ERROR, 0, 10000, "[hyprpm] Couldn't update headers");
Expand All @@ -137,7 +137,7 @@ int main(int argc, char** argv, char** envp) {
if (ret == LOADSTATE_HYPRLAND_UPDATED)
g_pPluginManager->notify(ICON_INFO, 0, 10000, "[hyprpm] Enabled plugin, but Hyprland was updated. Please restart Hyprland.");

if (ret != LOADSTATE_OK && ret != LOADSTATE_HYPRLAND_UPDATED)
if (ret != LOADSTATE_OK || ret == LOADSTATE_HYPRLAND_UPDATED)
return 1;
} else if (command[0] == "disable") {
if (command.size() < 2) {
Expand Down

0 comments on commit 4dbc3c5

Please sign in to comment.