Feature/night mode exceptions - #2809
Conversation
7a6dffa to
43a0917
Compare
566ade1 to
e5c7dcc
Compare
|
I noticed that when the Fullscreen Applications is turned on, and if any one app in the workspace is fullscreen, it turns of night mode for all the apps in the workspace. Is it intentional? |
e5c7dcc to
6470274
Compare
|
That's a regression caused by the unnecessary additional commit I carelessly pushed earlier. Thank you ! |
|
The "excluding apps from night mode" makes sense, but the one with "full screen disabling night mode" doesn't make sense to me. Anyway, up to the maintainers to approve |
|
To me, the point of allowing users to disable night mode for fullscreen apps is to ensure color accuracy for applications typically run in fullscreen mode, like media players and video games. |
|
Two shortcomings I've noticed1 and I'm not sure how to solve:
EDIT:
If time permits, I'd be glad to try my hand at a Go implementation, but I'm unsure how an animation player that handles bezier curves would fit in the night-mode-transition-basic.patch Footnotes
|
Drawing heavily on hthienloc/DankMaterialShell@de3e8cf (excluded media players), give the possibility to specify a list of applications excluded from NightMode, alongside the ability to exclude fullscreen applications. (Logic is implemented on newly focused windows, and integrates with compositors overview mode so that NightMode is resumed on overview.) + Update GammaControlTab main section to use a SettingsCard component.
…ceptions - Use the appId matching function abstracted to Paths.qml. - Use common appId normalization functions to append/remove from settings list. - Align with GammaControlTab app list input fields to fix bug where white spaces only input would prevent field clearing on accept. - Align with GammaControlTab and use a Loader for AppBrowserPopup so that it can be recreated in case the popup is not closed with the dedicated button (i.e., via the compositor).
…ecreated if closed (Align with GammaControlTab changes)
5f85669 to
def58ec
Compare
| } | ||
| function resumeNightMode() { | ||
| enableNightMode(); | ||
| nightModePaused = false; |
There was a problem hiding this comment.
I think the paused state should be in-memory only, not persisted to the session json. Similar with the auto disabling/enabling, doesnt need to be persisted to disk
There was a problem hiding this comment.
I removed the nightModePaused persistence, but I'm not sure I fully understand you: do you also want to remove the session persistence for nightModeEnabled, or for nightModeAutoEnabled (or both) ?
| } | ||
|
|
||
| Connections { | ||
| target: CompositorService |
There was a problem hiding this comment.
Should probably connect to ToplevelManager.activeToplevel instead of the CompositorService list
There was a problem hiding this comment.
Unless I'm missing something, it requires three connections to match the previous behavior (but still reduces function calls).
| property bool nightModePaused: false | ||
| property var nightModeExcludedAppsMatchesCache: [] | ||
|
|
||
| property var hyprlandOverviewLoader: null |
There was a problem hiding this comment.
This should be restructured so the Services don't hold a reference to a UI loader/module, can simplify this wiring a lot I think
There was a problem hiding this comment.
I ended up with 5a1dddf (tested in a VM). Would this work for you ?
e516e9c to
3749b45
Compare
3749b45 to
4a7868a
Compare
4a7868a to
95bfa41
Compare
|
/claude review |
| } | ||
|
|
||
| function pauseNightMode() { | ||
| disableNightMode(); |
There was a problem hiding this comment.
The paused state still gets persisted to disk. disableNightMode() does SessionData.setNightModeEnabled(false) (line 1051), and SessionData.setNightModeEnabled calls saveSettings() (SessionData.qml:791).
So: night mode on → focus a fullscreen/excluded app → session.json now has nightModeEnabled: false. Restart (or crash) the shell while paused and Component.onCompleted (line 1423) restores nightModeEnabled = false with nightModePaused = false — night mode is silently off for good and nothing ever resumes it. It also writes to disk on every focus switch in and out of an excluded app.
Pause/resume should only flip the in-memory nightModeEnabled + the wayland.gamma.setEnabled request and leave SessionData.nightModeEnabled at the user's choice — e.g. split the DMS call out of enableNightMode()/disableNightMode() into a helper that pause/resume use, or re-write the user's value back after.
| } | ||
|
|
||
| function recreatePopup() { | ||
| log.debug("Recreating popup"); |
There was a problem hiding this comment.
log is undefined here. The readonly property var log: Log.scoped("NightModeExceptions") you added is declared on the SettingsCard at line 688, which is not in scope for popupLoader (a sibling of the flickable at the component root) — and it's unused where it is declared. recreatePopup() will throw a ReferenceError when it runs.
Move the declaration to the root Item (matching AutoStartTab.qml:14) and drop it from the SettingsCard.
| } | ||
|
|
||
| function recreatePopup() { | ||
| log.debug("Recreating popup"); |
There was a problem hiding this comment.
log is undefined in this file — there is no log property anywhere in MediaPlayerTab.qml, so recreatePopup() throws a ReferenceError when it runs. Add readonly property var log: Log.scoped("MediaPlayerTab") to the root Item (same as AutoStartTab.qml:14), or drop the log line.
| import Quickshell.Io | ||
| import qs.Common | ||
| import qs.Services | ||
| import qs.Modules.WorkspaceOverlays |
There was a problem hiding this comment.
Leftover from the earlier hyprlandOverviewLoader approach — nothing in DisplayService.qml references qs.Modules.WorkspaceOverlays anymore now that overview state comes from CompositorService.inOverview. It also re-introduces the Services → Modules (UI) dependency that was the point of the restructure.
| import qs.Modules.WorkspaceOverlays |
Claude reviewFeature logic is sound, but pausing writes through to
Checked: night mode pause/resume state machine and its interaction with SessionData persistence, the new ToplevelManager/CompositorService connections, |
Description
Add night mode exceptions (fullscreen and custom app list).
Drawing heavily on hthienloc/DankMaterialShell@de3e8cf, give the possibility to specify a list of applications excluded from Night Mode, alongside the ability to exclude fullscreen applications.
Logic is implemented on newly focused windows, and integrates with compositors overview mode so that Night Mode is resumed on overview.1
Notes
MprisController:qml:20toPaths.qml:154with other (loosely-)related functions.Type of change
Related issues
Screenshots / video2
contrib_night-mode-exceptions.webm
Checklist
I18n.tr()with translator context, reusing existing terms where possiblemake fmt, added/updated tests,make testpasses, andgo mod tidyis cleanmake lint-qmlwith no new warningsFootnotes
This means that enabling fullscreen exclusion while fullscreen will do nothing because the implementation reacts to Toplevel change (application focus). ↩
Screen gamma change is obviously not visible in the video, but "it works on my machine". ↩