-
-
Notifications
You must be signed in to change notification settings - Fork 196
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
Implement a background monitor #319
Implement a background monitor #319
Conversation
See flatpak/xdg-desktop-portal-gtk#198 for the backend |
74a98ef
to
b01a742
Compare
I've added the background portal to this PR, so applications can now request run-in-background permissions ahead of time. |
b01a742
to
4d5352c
Compare
I had a quick look through this:
Is there something that terminates the Flatpak when "running in the background" is disabled and the application is not otherwise running? |
In some earlier permutation of this we had some leeway for being in the background to avoid the "race condition" where an app was just starting in parallel with the app background check. Like, allow the app to be in the background for one cycle, and only ask the second time we check. I think we need something like that to be robust. |
d0b3d64
to
b8da2aa
Compare
I copied the usual docs over now.
Will do.
The background monitor checks every few minutes and kills apps that are running in the background and are not allowed. We could probably add a way to trigger that, so the control-center can call it when you change permissions there. |
6aa4081
to
7420692
Compare
Still the case. I added a comment to make that clear. |
7420692
to
93257bd
Compare
src/background.c
Outdated
|
||
g_debug ("Killing app %s", app_id); | ||
|
||
instance = find_instance (app_id); |
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.
What if there are multiple instances? This seems to be a way to escape this. We should kill them all.
What about commandline apps. I wonder if there is a way to tie an app tty to a terminal and mark that as not backgrounded. |
Make the NotifyBackground api more flexible
Don't use GTask
Stop quoting
Use xdp_app_info_rewrite_commandline
322abe6
to
c10b8e5
Compare
The configure check for flatpak was a leftover from when we stopped linking our tests against libflatpak. We should not bring this back for the main binary. Instead, ship a standalone copy of FlatpakInstance, and use that.
c10b8e5
to
c80af15
Compare
Currently not. But autostart is not a permission either. Just a file we put in place or remove. If you get autostarted and run in the background without permission for that, you will get killed by the monitor after a little while.
We decided to keep flatpak out of it. autostart files are no longer installed by the app, they are created by the portal, and we control what goes in them (ie no conditions, etc). This will make it easier to switch to systemd units later, if we choose to do so.
The portal has a monitor that kills flatpaks that are running in the background without the permission. |
Haven't thought about that. For now, just giving them the permission to run in the background seems easy enough |
Redo application tracking
Add an allow-once option
I'm happy with this now. |
I think this looks generally good to go, but the thread issues have to be fixed. |
Actually make the timeout a minute
better option validation
bring back locking
Otherwise looks good to me! |
handle NULL commandline
Implement a facility that monitors running flatpaks,
and notifies the user if they run in the background.
Add a permission table to store users responses
persistently.
The platform-dependent parts of this (getting the
state of running applications, and notifying the user)
are handled by a portal backend.
There is currently no application API.