I have simple vala app, one of its functionalities ends with shutting down the computer using Posix.system("shutdown now");
In the ordinary ninja
compiled version, the app works fine. However, in the flatpak version, it does not work.
I tried to repackaging it again with adding couple of finish args in the yml file.,
finish-args:
- '--share=ipc'
- '--socket=fallback-x11'
- '--socket=wayland'
- '--filesystem=home'
- '--socket=session-bus'
- '--socket=system-bus'
but it does not work too.
This is likely due to Flatpaks running in a sandbox with limited permissions, this prevents access to other processes and limits access to the operating system.
You have given your Flatpak access to the system D-Bus, so you can try using the
PowerOff
method available throughorg.freedesktop.systemd1.Manager
.