Repository navigation
Ensure there is at most one power save blocker per open window - #7247
Merged
FreeTubeBot merged 1 commit intoApr 25, 2025
Merged
Conversation
absidue
requested review from
a user,
MarmadileManteater,
PikachuEXE,
efb4f5ff-1298-471a-8973-3d47447115dc and
kommunarr
April 21, 2025 14:29
FreeTubeBot
enabled auto-merge (squash)
April 21, 2025 14:29
Member
|
Test cases from #3286 Test case 1: Test case 2: Test case 3: |
Member
|
Tested above case with 1 min screensaver and tested playing video still blocks screensaver (until after it ended |
PikachuEXE
approved these changes
Apr 24, 2025
kommunarr
approved these changes
Apr 24, 2025
efb4f5ff-1298-471a-8973-3d47447115dc
approved these changes
Apr 25, 2025
PikachuEXE
added a commit
to PikachuEXE/FreeTube
that referenced
this pull request
Apr 26, 2025
* development: Ensure there is at most one power save blocker per open window (FreeTubeApp#7247) Change author name (FreeTubeApp#7216) Migrate ExternalPlayerSettings and SponsorBlockSettings to the composition API (FreeTubeApp#7267) Migrate the FtButton component to the composition API (FreeTubeApp#7266) Cleanup event listener pass-through inline handlers (FreeTubeApp#7268) Feature/add Windows/MacOS Taskbar dock/jumplist task 'New Window' (FreeTubeApp#7049) Translated using Weblate (Hebrew) Translated using Weblate (Norwegian Bokmål) Translated using Weblate (Greek)
PikachuEXE
added a commit
to PikachuEXE/FreeTube
that referenced
this pull request
Apr 26, 2025
…rent * feature/hide-member-only-videos: ! Fix incorrect code, use #reduce instead Ensure there is at most one power save blocker per open window (FreeTubeApp#7247) Change author name (FreeTubeApp#7216) Migrate ExternalPlayerSettings and SponsorBlockSettings to the composition API (FreeTubeApp#7267) Migrate the FtButton component to the composition API (FreeTubeApp#7266) Cleanup event listener pass-through inline handlers (FreeTubeApp#7268) Feature/add Windows/MacOS Taskbar dock/jumplist task 'New Window' (FreeTubeApp#7049) Translated using Weblate (Hebrew) Translated using Weblate (Norwegian Bokmål) Translated using Weblate (Greek)
PikachuEXE
added a commit
to PikachuEXE/FreeTube
that referenced
this pull request
Apr 29, 2025
* development: (203 commits) Change no-array-push-push to prefer-single-call in eslint.config.mjs (FreeTubeApp#7300) Translated using Weblate (Portuguese (Brazil)) Bump electron-builder from 26.0.13 to 26.0.14 (FreeTubeApp#7290) Translated using Weblate (Norwegian Bokmål) Bump electron from 35.2.0 to 35.2.1 (FreeTubeApp#7296) Bump webpack from 5.99.6 to 5.99.7 (FreeTubeApp#7294) Bump sass from 1.86.3 to 1.87.0 (FreeTubeApp#7297) Bump autolinker from 4.1.0 to 4.1.1 (FreeTubeApp#7295) Bump lefthook from 1.11.10 to 1.11.12 (FreeTubeApp#7293) Bump marked from 15.0.8 to 15.0.11 (FreeTubeApp#7292) Bump shaka-player from 4.14.8 to 4.14.9 (FreeTubeApp#7291) Bump the eslint group with 5 updates (FreeTubeApp#7288) Bump stylelint from 16.18.0 to 16.19.1 in the stylelint group (FreeTubeApp#7289) Migrate the FtTooltip component to the composition API (FreeTubeApp#7282) Translated using Weblate (Hebrew) Ensure there is at most one power save blocker per open window (FreeTubeApp#7247) Change author name (FreeTubeApp#7216) Migrate ExternalPlayerSettings and SponsorBlockSettings to the composition API (FreeTubeApp#7267) Migrate the FtButton component to the composition API (FreeTubeApp#7266) Cleanup event listener pass-through inline handlers (FreeTubeApp#7268) ... # Conflicts: # package.json
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.
Ensure there is at most one power save blocker per open window
Pull Request Type
Description
Electron's power save blocking works by returning an identifier from the
.start()function that you then pass to the.stop()function afterwards to stop that specific blocker. Currently we store those identifiers in our video player component, unfortunately due to users restarting windows despite our advice to not do that, there are race conditions where certain blockers won't get cleared until FreeTube has stopped running. This is especially problematic on macOS where the idea is that the application keeps running in the background after you close the last window, so it could be days, weeks or even right up until the user installs the next update before FreeTube is closed.This pull request moves the management of those power save identifers into the main process, which means we can ensure that if a window has already started a power save blocker and tries to start another one, we reuse the existing blocker for that window. Additionally when a window is closed we now explicitly stop the blocker associated with that window, if there is one to make sure there are no rogue power save blockers sticking around that will never be cleared.
Testing
Test that the power save blocker still works when you are watching a video, works best on laptops or a desktop with a configured auto-lock or auto-sleep setting (e.g. pick a long video, leave it running and come back to your computer a while later and see if it still active).
Desktop