Repository navigation
Conversation
Filee's "Start Filee when I sign in" switch only wrote or deleted its launch agent and never read the system's state, so turning Filee off under System Settings > General > Login Items & Extensions > Allow in the Background left the switch showing on (KnifeLemon#1940). The platform can now report whether the system will start Filee (IPlatformServices.StartsWithSystem; macOS reads launchctl print-disabled for com.filee.app). At startup and when the General page opens, a known state that differs from the setting wins and the agent file is left in place, so turning Filee back on in System Settings keeps working. Turning the switch on while macOS still blocks the agent now says where to allow it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The |
KnifeLemon
left a comment
There was a problem hiding this comment.
Thanks @YusufMntm. The design reads right:
- the system wins only when it can tell;
- a missing agent keeps the default;
- the agent isn't deleted after a sync, so turning Filee back on in System Settings still works;
- turning the switch on while macOS blocks it says where to fix it.
The parser tests with the exact label are a nice touch.
One thing we can't check from CI is whether Allow in the Background really shows up in launchctl print-disabled gui/<uid> on current macOS (13, 14, 15). It's managed by Background Task Management, so this is worth seeing on a real Mac before merge. @AzrielTheHellrazor, could you try it when you have a moment?
- Turn on Start Filee when I sign in in Filee.
- Turn Filee off under System Settings > General > Login Items & Extensions > Allow in the Background.
- Reopen Settings > General in Filee. The switch should now be off.
- Turn the switch on in Filee. It should show the new "turned off under … Allow in the Background" message.
- Turn it back on in System Settings, then sign out and in. Filee should start.
If you can, please also run launchctl print-disabled gui/$(id -u) | grep filee after step 2 and paste the line.
A small nit: GeneralPageViewModel now runs launchctl (with a 10 s timeout) in its constructor, on the UI thread. It's normally quick, so it's fine as is. But if it ever hangs, the page would freeze. Moving it off the UI thread would avoid that.
We'll add the CHANGELOG lines after the merge, as before.
Fixes #1940
What and why
On macOS, "Start Filee when I sign in" writes or deletes
~/Library/LaunchAgents/com.filee.app.plist, and macOS liststhat agent under System Settings > General > Login Items & Extensions > Allow in the Background. Filee never read
the system's side, so after turning Filee off there the switch in Settings > General still showed on (as the issue
says, and as you confirmed: "Filee's switch doesn't read the system's state").
Design
IPlatformServices.StartsWithSystem()(defaultnull= can't tell; Windows and Linux are unchanged). On macOS:no agent file →
null(a first start keeps the default of starting with the system), otherwiselaunchctl print-disabled gui/<uid>decides; a failure or timeout isnull.MacOSIntegrationFiles.IsDisabledparses its output ("com.filee.app" => disabled/enabledon macOS 13+,true/falseon older ones, exact label only). The label is one constant now, used by the plist too.SystemIntegrationService.SyncFromSystemruns at startup (before the firstApply) and when the General page opens.A known state that differs from the setting wins (the reporter asked for the system setting to be the source). It
marks the startup entry as applied, so the next
Applyneither rewrites nor deletes the agent: deleting it wouldstop "Allow in the Background" from working when the user turns Filee back on there.
and
StartupEntryNotKeptExceptionis thrown with a new key,general.startup_blocked_background, which sayswhere to allow it. The exception got an optional
MessageKey(defaultgeneral.startup_entry_missing, so theWindows [Bug]: 无法登陆时启动 #450 message is unchanged), and
ApplyOneshows that key. The new line is in all 23 i18n files.getuidis aDllImportfrom libSystem, like the other P/Invokes inFilee.Platform.MacOS.Tests
MacOSIntegrationTests:IsDisabledwith macOS 13+ and olderprint-disabledoutput, the label missing, alonger label (
com.filee.app.helper) that must not count, and empty output.SystemIntegrationTests: system off + setting on → the setting turns off and the nextApplydoesn't touch thestartup entry; system unknown or equal → nothing changes; a separate data directory → nothing; a
StartupEntryNotKeptExceptionwith a custom key shows that key's text.Ran locally (Windows):
Filee.Platform.Tests(MacOSIntegration: 13 pass),Filee.App.Tests(SystemIntegration,Localization, GeneralPage: 250 pass),
dotnet format --verify-no-changeson the changed files.Not tried: a real Mac. I couldn't check by hand that switching Filee off under Allow in the Background shows up as
disabledinlaunchctl print-disabledon every macOS version. If it doesn't,StartsWithSystemreports"enabled" and the switch behaves as it does today.
CHANGELOG.mdis left alone; the lines are in a comment below.🤖 Generated with Claude Code