Skip to content

core: replace grace option with --grace cli argument#802

Merged
PointerDilemma merged 6 commits intohyprwm:mainfrom
davc0n:main
Jun 26, 2025
Merged

core: replace grace option with --grace cli argument#802
PointerDilemma merged 6 commits intohyprwm:mainfrom
davc0n:main

Conversation

@davc0n
Copy link
Contributor

@davc0n davc0n commented Jun 14, 2025

ref #782

davc0n added 2 commits June 14, 2025 10:58
not necessary anymore, grace is not a configuration option
@vaxerski vaxerski requested a review from PointerDilemma June 16, 2025 07:35
@davc0n davc0n requested a review from PointerDilemma June 22, 2025 07:27
@davc0n davc0n requested a review from PointerDilemma June 22, 2025 07:53
@PointerDilemma
Copy link
Collaborator

Ok, sorry this is also not entirely it, because it breaks --immediate (e.g. grace still configured in config+--immediate does not disable grace anymore.)

Use this patch:

diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 20d4941..00365d7 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -214,7 +214,6 @@ void CConfigManager::init() {
 
     m_config.addConfigValue("general:text_trim", Hyprlang::INT{1});
     m_config.addConfigValue("general:hide_cursor", Hyprlang::INT{0});
-    m_config.addConfigValue("general:grace", Hyprlang::INT{0});
     m_config.addConfigValue("general:ignore_empty_input", Hyprlang::INT{0});
     m_config.addConfigValue("general:immediate_render", Hyprlang::INT{0});
     m_config.addConfigValue("general:fractional_scaling", Hyprlang::INT{2});
diff --git a/src/core/hyprlock.cpp b/src/core/hyprlock.cpp
index 337f43d..dc23a4c 100644
--- a/src/core/hyprlock.cpp
+++ b/src/core/hyprlock.cpp
@@ -43,15 +43,8 @@ CHyprlock::CHyprlock(const std::string& wlDisplay, const bool immediateRender, c
 
     g_pEGL = makeUnique<CEGL>(m_sWaylandState.display);
 
-    static const auto GRACE = g_pConfigManager->getValue<Hyprlang::INT>("general:grace");
-    if (*GRACE > 0) {
-        Debug::log(WARN, "\"general:grace\" config option is deprecated. It will be removed in an upcoming release. Use the \"--grace\" option instead.");
-    }
-
     if (graceSeconds > 0)
         m_tGraceEnds = std::chrono::system_clock::now() + std::chrono::seconds(graceSeconds);
-    else if (*GRACE > 0)
-        m_tGraceEnds = std::chrono::system_clock::now() + std::chrono::seconds(*GRACE);
     else
         m_tGraceEnds = std::chrono::system_clock::from_time_t(0);
 
diff --git a/src/main.cpp b/src/main.cpp
index 484aea1..d71a59a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -94,7 +94,7 @@ int main(int argc, char** argv, char** envp) {
 
         } else if (arg == "--immediate") {
             graceSeconds = 0;
-            Debug::log(WARN, "\"--immediate\" is deprecated. It will be removed in an upcoming release. Use the \"--grace\" option instead.");
+            Debug::log(WARN, R"("--immediate" is deprecated. Use the "--grace" option instead.)");
         }
 
         else if (arg == "--immediate-render")

With this the transition behavior should be like this:

  • having grace in the config will print an error that the option doesn't exist anymore. The option doesn't do anything, but hyprlock will start just fine.
  • using --immediate leads to the depreciation message being printed. Hyprlock will start just fine (the only thing that was missing in your initial version).
  • using --grace is the only thing that allows you to configure grace.

Copy link
Collaborator

@PointerDilemma PointerDilemma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Top

@PointerDilemma PointerDilemma merged commit 7999f44 into hyprwm:main Jun 26, 2025
1 check passed
@PointerDilemma
Copy link
Collaborator

Ups, forgot the wiki MR.
@vaxerski hyprwm/hyprland-wiki#1129 would need merging.

khaneliman added a commit to khaneliman/khanelinix that referenced this pull request Jul 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants