Skip to content

Fix: gamemode.sh windowrule syntax issue when changing window opacity#1519

Merged
kRHYME7 merged 9 commits intoHyDE-Project:devfrom
post2424:fix-gamemode.sh-windowrule-syntax
Mar 25, 2026
Merged

Fix: gamemode.sh windowrule syntax issue when changing window opacity#1519
kRHYME7 merged 9 commits intoHyDE-Project:devfrom
post2424:fix-gamemode.sh-windowrule-syntax

Conversation

@post2424
Copy link

@post2424 post2424 commented Jan 8, 2026

Pull Request

Description

Fixed a syntax issue in gamemode.sh that caused the script to not change the opacity of windows.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My commit message follows the commit guidelines.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added a changelog entry.
  • I have added necessary comments/documentation to my code.
  • I have added tests to cover my changes.
  • I have tested my code locally and it works as expected.
  • All new and existing tests passed.

Summary by CodeRabbit

  • Improvements
    • Updated gamemode toggle mechanism to use persistent state management for more reliable switching between gaming and normal modes.

Beforehand gave the error "invalid field opaque: missing a value" and didn't change the opacity.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 13c1ad23-efcc-432d-a84e-33c4d8c5cfbb

📥 Commits

Reviewing files that changed from the base of the PR and between 4ccf339 and 7582d04.

📒 Files selected for processing (1)
  • Configs/.local/lib/hyde/gamemode.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • Configs/.local/lib/hyde/gamemode.sh

📝 Walkthrough

Walkthrough

The gamemode.sh script transitions from Hyprland state-based mode detection to a filesystem toggle mechanism. Instead of querying the animations:enabled option and applying multiple configuration changes via hyprctl batch commands, it now checks for a lock file to determine gamemode state and switches between regular and gaming configurations using a source command.

Changes

Cohort / File(s) Summary
Gamemode Toggle Refactor
Configs/.local/lib/hyde/gamemode.sh
Replaced Hyprland state-based mode detection with filesystem-based lock file toggle; simplified config switching from multiple hyprctl batch commands to a single source command for the gaming workflow configuration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A toggle so fine, no queries required,
With lock files as markers, the config's rewired,
From batch commands sprawled to a source-based way,
The gamemode now shifts with a filesystem's sway! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title claims to fix a 'windowrule syntax issue' for changing window opacity, but the actual changes implement a filesystem-based toggle using lock files and workflow switching, unrelated to windowrule syntax or opacity. Revise the title to accurately reflect the main change: e.g., 'Replace gamemode state detection with filesystem-based lock file toggle' or 'Implement lock file-based gamemode workflow switching'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
CHANGELOG.md (1)

70-70: Fix typo in warning message.

"borke" should be "break" or "brick" (more appropriate for display driver context).

📝 Proposed fix
-- nv110-nv140 cards, please install `nvidia-580xx-dkms` before updating your whole system or before rebooting. `nvidia-open-dkms` could potentially borke your display. Goodluck!
+- nv110-nv140 cards, please install `nvidia-580xx-dkms` before updating your whole system or before rebooting. `nvidia-open-dkms` could potentially brick your display. Good luck!
🤖 Fix all issues with AI agents
In @CHANGELOG.md:
- Line 52: Change the migration subsection headings from h5 to h4 by replacing
the leading "#####" with "####" for the "Hyprland v0.53.0" and "NVIDIA Legacy
Support" headings (the exact heading text strings) so the markdown heading
hierarchy increments properly; update both occurrences referenced in the diff
(including the second instance around the "NVIDIA Legacy Support" heading).
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 08a4896 and df276de.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • Configs/.config/hypr/windowrules.conf
  • Configs/.local/lib/hyde/gamemode.sh
  • Configs/.local/lib/hyde/system.monitor.sh
  • Configs/.local/lib/hyde/system.update.sh
  • Configs/.local/share/hyde/templates/hypr/windowrules.conf
  • Configs/.local/share/hypr/windowrules.conf
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
CHANGELOG.md

52-52: Heading levels should only increment by one level at a time
Expected: h4; Actual: h5

(MD001, heading-increment)

🔇 Additional comments (6)
Configs/.local/share/hypr/windowrules.conf (1)

40-50: LGTM! Well-structured PiP window rule consolidation.

The consolidated hyde_picture_in_picture block effectively replaces multiple discrete rules with a single, maintainable configuration. The monitor-relative positioning ensures consistent placement across different display sizes, and the regex pattern comprehensively matches Picture-in-Picture title variations.

Configs/.local/lib/hyde/gamemode.sh (1)

21-21: Excellent fix for the windowrule syntax issue!

This change directly resolves issue #1506 by adding the missing value for the opaque field and updating to Hyprland v0.53's explicit match:class syntax. The rule now correctly sets all windows to opaque during game mode.

Configs/.local/share/hyde/templates/hypr/windowrules.conf (2)

20-30: LGTM! Consistent PiP configuration.

The hyde_picture_in_picture block matches the consolidated approach in other config files, ensuring consistency across the template and production configurations.


92-92: Good fix for JetBrains windowrule.

The no_initial_focus parameter correctly uses a single boolean value instead of the duplicate. This aligns with proper Hyprland v0.53 syntax.

Configs/.config/hypr/windowrules.conf (2)

20-30: LGTM! Consistent consolidation.

The hyde_picture_in_picture block maintains consistency with the other configuration files, providing a unified approach to Picture-in-Picture window management.


92-92: Good fix for JetBrains windowrule.

The simplified no_initial_focus parameter correctly uses a single boolean, matching the fix in the template configuration.

@PureFallen
Copy link

I stumbled across the exact same change in gamemode.sh to match the new windowrule syntax.
While it does work for windows that are newly created after the script has been executed, it unfortunately doesn't seem to affect existing windows. They will still use transparency when unfocused, which I previously did not have when using HyDE. I don't know whenever that is intended behavior or not. If not, we might have to do additional changes to restore previous behavior.

@kRHYME7
Copy link
Contributor

kRHYME7 commented Jan 10, 2026

I suggest using hyde-shell workflows --select This changes the config file explicitly.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @CHANGELOG.md:
- Line 61: The changelog uses a h5 heading "##### Hyprland v0.53.0" (and a
similar h5 at line 70) immediately after an h3 "### Migration", violating MD001;
change those h5 headings to h4 ("#### Hyprland v0.53.0") so heading levels
increment by one (ensure both occurrences are updated).
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between df276de and b0a248c.

📒 Files selected for processing (1)
  • CHANGELOG.md
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
CHANGELOG.md

61-61: Heading levels should only increment by one level at a time
Expected: h4; Actual: h5

(MD001, heading-increment)

🔇 Additional comments (1)
CHANGELOG.md (1)

63-66: Changelog migration content looks good.

The updates to the Hyprland v0.53.0 and NVIDIA Legacy Support sections provide clear migration guidance aligned with the PR's bug fixes and syntax changes. The messaging is actionable and encourages users to proactively address configuration issues.

Also applies to: 72-88

### Migration

##### Hyprland
##### Hyprland v0.53.0
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix markdown heading hierarchy violation (MD001).

Heading levels should increment by one level at a time. The migration subsections jump from h3 (### Migration) directly to h5 (##### Hyprland v0.53.0), skipping h4. This violates the MD001 rule and should use h4 (####) instead.

📝 Proposed fix for heading levels
- ##### Hyprland v0.53.0
+ #### Hyprland v0.53.0
- ##### NVIDIA Legacy Support
+ #### NVIDIA Legacy Support

Also applies to: 70-70

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

61-61: Heading levels should only increment by one level at a time
Expected: h4; Actual: h5

(MD001, heading-increment)

🤖 Prompt for AI Agents
In @CHANGELOG.md at line 61, The changelog uses a h5 heading "##### Hyprland
v0.53.0" (and a similar h5 at line 70) immediately after an h3 "### Migration",
violating MD001; change those h5 headings to h4 ("#### Hyprland v0.53.0") so
heading levels increment by one (ensure both occurrences are updated).

Beforehand using this script would only apply opacity to new windows.
Now when using this script it applies opacity automatically.
@post2424
Copy link
Author

I suggest using hyde-shell workflows --select This changes the config file explicitly.

Great suggestion.
I updated gamemode.sh to use hyde-shell workflows instead.
Now, at least on my system, switching between workflows doesn't cause the issue described by @PureFallen.

@kRHYME7
Copy link
Contributor

kRHYME7 commented Jan 10, 2026

I updated gamemode.sh to use hyde-shell workflows instead.

gamemode.sh is just a reference from the hyprland wiki anyway. That's why I would still recommend our own workflows script. This way the state is saved.

gamemode.sh will still stay for reference though. I'll try to fix some conflicts on this PR first

@@ -1,25 +1,7 @@
#!/usr/bin/env bash
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use hyprctl for this. Sorry for the misunderstanding. Thanks!

@PureFallen
Copy link

PureFallen commented Jan 10, 2026

I updated gamemode.sh to use hyde-shell workflows instead.

gamemode.sh is just a reference from the hyprland wiki anyway. That's why I would still recommend our own workflows script. This way the state is saved.

gamemode.sh will still stay for reference though. I'll try to fix some conflicts on this PR first

Thanks for letting us know. I am still new to HyDE and try to understand some of it's inner workings.
I ended up there because gamemode.sh is being called by the Gamemode Hotkey (SUPER + ALT + G). So when the functionality broke for me, I ended up looking there for a solution. Little did I know about the intended solution via. workflows.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2026

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@PureFallen
Copy link

Gonna bump before the PR gets closed down.
As of now this is still the most viable solution to fixing the gamemode.sh that is used by the hotkey.

In the meantime new people ran into the same issue and I ended up redirecting them to this PR as a workaround.
When looking further into it I came across the limitations of this method though - we are always restoring into the default workflow instead of whatever workflow we been in before going into gaming.

Depending on what the scope is we could leave it at that or look into a way to remember and restore the preview workflow. However, this could require changes in how we are detecting the gaming workflow since animations are also disabled for snappy and powersaving. It could perhaps be useful to look for a property that is unique to the gaming workflow, or to create one if necessary.

@rubiin rubiin changed the title Fix gamemode.sh windowrule syntax issue when changing window opacity Fix: gamemode.sh windowrule syntax issue when changing window opacity Mar 4, 2026
@rubiin rubiin requested a review from kRHYME7 March 24, 2026 14:16
Add lock file handling to manage gamemode state.
@kRHYME7
Copy link
Contributor

kRHYME7 commented Mar 25, 2026

Will merge this now
I've used a lockfile for the state and use hyprctl keyword source gaming.conf.
Used transient therefore we don't need to know the current preferred workflow at the same time making gaming mode (just a gaming set of configs) be "toggle-able".

Only the best way I can think of for now.

@kRHYME7 kRHYME7 merged commit d9fc44a into HyDE-Project:dev Mar 25, 2026
5 checks passed
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.

4 participants