CLI/non-interactive mode does not own D-Bus name which breaks screenshots with gnome-shell 41
gnome-shell 41 started restricting callers of its D-Bus interfaces based on the D-Bus name of the caller (gnome-shell!1970 (merged)). org.gnome.Screenshot
is allowed and works in interactive mode, but when launching in CLI/non-interactive mode, screenshot_application_handle_local_options()
adds the G_APPLICATION_NON_UNIQUE
flag, which prevents the registration of that name. This results in the D-Bus calls on the org.gnome.Shell.Screenshot
interface getting denied.
Removing the flag works, but will probably lead to issues with attempting to run concurrent gnome-screenshot instances. One possible idea was to use org.gnome.Screenshot.[random-number]
(gnome-shell!1970 (comment 1288475)).