Add duration menu for caffeine sessions (15m/30m/1h/indefinite)#7
Open
AuthenticSm1les wants to merge 1 commit into
Open
Add duration menu for caffeine sessions (15m/30m/1h/indefinite)#7AuthenticSm1les wants to merge 1 commit into
AuthenticSm1les wants to merge 1 commit into
Conversation
Replaces the plain on/off toggle with a popup menu offering 15 minutes, 30 minutes, 1 hour, and indefinite options. Timed sessions auto-release the inhibit lock via a 1s subscription tick that checks against a stored deadline; picking a new duration while active resets the timer instead of re-acquiring the lock. Closes codevardhan#6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6.
Replaces the plain on/off toggle with a popup menu (opened via
on_press_with_rectangle+ the applet'sapp_popupsurface action) offering:Picking a timed option acquires the inhibit lock as before and sets a deadline (
Instant). A subscription ticks every second while a deadline is pending and releases the lock automatically once it's reached. Picking a new option while a session is already running just updates the deadline instead of re-acquiring the lock; a "Turn off" entry is shown in the menu whenever a session is active.Selected option is check-marked in the menu for quick visual feedback.
Testing
cargo check— clean, no warnings.Follow-up (not in this PR)
The issue's "nice to have" — showing remaining time in the applet's tooltip/label — isn't implemented here; happy to add it as a follow-up if wanted.