-
-
Notifications
You must be signed in to change notification settings - Fork 499
Add flatpak portal manager, autostart on flatpaks #1670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
62d3265 to
03efa71
Compare
|
Is this WIP or should be finished? With regard to the PR in flathub, if any changes are expected |
|
That's a good point, the flathub PR is definitely wrong, that permission is not allowed. I'll rethink how to do this, I had a lot of errors trying to get the current status, and reading "autostart" was a good workaround. |
|
Ok :) |
03efa71 to
3694482
Compare
|
There were issues with the portal not initializing sometimes, so I moved it to main, hope that's ok. Otherwise its pretty much the last PR + save autostart value to settings. Saving to settings is kinda buggy if the user manually deletes the file, but they're asking for trouble in that case! |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #1670 +/- ##
==========================================
- Coverage 14.92% 14.45% -0.47%
==========================================
Files 35 36 +1
Lines 1963 2075 +112
==========================================
+ Hits 293 300 +7
- Misses 1670 1775 +105 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a320161 to
ca94739
Compare
ca94739 to
c4da6c5
Compare
|
Please note I have an issue running the flatpak with no flags on stretchly 1.19.0. I think there were some changes to the dependencies. To get it to work I have to add the --ozone-platform=x11 I'm not an expert and its late at night. Claude suggests |
|
Yeah, that is a change in Electron :( Are you on Ubuntu? looks like issue in #1693 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds autostart functionality for Flatpak packages by implementing a new FlatpakPortalManager that interacts with the XDG Desktop Portal D-Bus API. The changes enable Stretchly to properly handle autostart when running as a Flatpak, addressing issues #1652 and #1517.
Key changes:
- Created a new
FlatpakPortalManagerclass to handle autostart via XDG Background Portal - Modified
AutostartManagerto be async and detect Flatpak environments - Added cleanup for D-Bus connections on app quit
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| app/utils/flatpakPortalManager.js | New manager implementing XDG Background Portal integration for Flatpak autostart control |
| app/utils/autostartManager.js | Updated to detect Flatpak, delegate to FlatpakPortalManager, and support async operations |
| app/utils/defaultSettings.js | Added flatpakAutostart setting to cache autostart state |
| app/main.js | Added D-Bus connection cleanup on quit and early portal initialization for Flatpak |
| CHANGELOG.md | Documented the new Flatpak autostart functionality |
|
Made some changes, but one question: this is supposed to be triggered from Preferences. But I do not see where we actually load the value into Preferences. Or am I missing something? |
Assisted-by: Claude Code, Sonnet 4.5 Signed-off-by: Andrew Bernal <[email protected]>
Signed-off-by: Andrew Bernal <[email protected]>
Signed-off-by: Andrew Bernal <[email protected]>
43e0a75 to
efbc347
Compare
The value is loaded via the flatpakAutostart setting (since we must cache it locally; the portal doesn't support querying status). It gets injected into the Preferences window in app/main.js via settingsToSend(): async function settingsToSend () {
return Object.assign({}, settings.store, { openAtLogin: await autostartManager.autoLaunchStatus() })
}This maps our cached flatpakAutostart value (returned by autoLaunchStatus) to the openAtLogin property that the Preferences UI expects. |
- Add _waitForBusResponse to make it easier to read `setAutostart` - Copilot change for `portalRequestTimeoutMs` - Copilot change for `endsWith` handle token Signed-off-by: Andrew Bernal <[email protected]>
|
looks like you deleted my changes :( |
Issue: closes #1652 #1517
Requirements
nodeversion specified inpackage.jsonwas used (ie using nvm).npm install --no-save).npm run lintreports no offenses.npm run testis error-free.Description of the Change
optionsfield insetAutostart~/.config/autostart/net.hovancik.Stretchly.desktop. Requires a PR to the flatpak repo. add autostart:ro permission flathub/net.hovancik.Stretchly#23Verification Process
I was on Fedora 42.
I build the flatpak and ran it as described in net.hovancik.Stretchly
I checked the checkbox to "run at startup", and saw that a file was made in autostart, as expected.
When I unchecked the checkbox, the file no longer existed. Perfect.
When I checked the checkbox and rebooted my computer, stretchly opened on startup.
I fixed the error I spoke of previously
Log: