Skip to content

Conversation

@samhutchins
Copy link
Contributor

@samhutchins samhutchins commented May 6, 2024

Description of Change:

My lack of C and glib/gtk experience may very well be showing in full force here...

macOS and Windows can send the encoded file to an external application after the encode completes, this change adds that functionality for the Linux GUI as well. I'm not sure if this is the best way to invoke an external command

Tested on:

  • Windows 10+ (via MinGW)
  • macOS 10.13+
  • Fedora Linux

@samhutchins samhutchins force-pushed the lin_gui_send_file_to branch from 2a24619 to 74bfa95 Compare May 7, 2024 15:45
@robxnano
Copy link
Contributor

Looks good, but have you considered making this more useful in the Flatpak version? Users will probably expect the command to run outside the sandbox. You could do this by prepending flatpak-spawn --host -- to the argv of the command when running in the Flatpak environment, which you can detect with if (g_access("/.flatpak-info", F_OK) == 0). Note that this would also need permission to talk to the org.freedesktop.Flatpak D-Bus name.

@samhutchins
Copy link
Contributor Author

I had not, I've never really used the flatpak version. Thanks for the pointers on where to start, I'll look into it

@sr55 sr55 added this to the 1.9.0 milestone Jun 8, 2024
@samhutchins
Copy link
Contributor Author

I've made the changes I think are needed, but I don't seem to be able to launch vlc when running a flatpack version of HandBrake. Is there something I'm missing with permissions?

@sr55
Copy link
Contributor

sr55 commented Jul 26, 2024

@robxnano or @jstebbins Any advice if you have a minute

@jstebbins
Copy link
Contributor

flatpaks don't have direct access to the hosts applications. I.e. if you run

flatpak run --command=bash fr.handbrake.ghb
ls /usr/bin

you will see a different list of applications than is available in /usr/bin outside of the flatpak.

The flatpak ecosystem provides portals for things like this, but I don't know if there is a portal for execution of arbitrary apps. There is however a portal for launching the default app for a uri, g_app_info_launch_default_for_uri()
See https://docs.flatpak.org/en/latest/portals.html and https://blogs.gnome.org/mclasen/2016/07/08/portals-using-gtk-in-a-flatpak/

Maybe g_app_info_launch() also has this ability to go through the portal, but I doubt it. I could not find any information indicating this would work.

@samhutchins
Copy link
Contributor Author

samhutchins commented Nov 23, 2024

Apologies for dropping the ball with this one, life and all that. I have worked out how to get this to work with flatpak though. I had --system-talk-name instead of --talk-name for the org.freedesktop.Flatpak permission. With that corrected, flatpak spawn --host -- does what it should

I've rebased and fixed the flatpak permissions

I'm not expecting this PR to be merged for 1.9, as it does contain a new string in the Linux UI

@galad87 galad87 modified the milestones: 1.9.0, 1.10.0 Nov 28, 2024
@sr55
Copy link
Contributor

sr55 commented Jan 19, 2025

Since we are well past 1.9, is this in a state to consider merging?

@samhutchins
Copy link
Contributor Author

I think so, I've addressed all the feedback I've received so far

@sr55
Copy link
Contributor

sr55 commented Jan 23, 2025

OK, Thank you!

@sr55 sr55 merged commit 0fd2156 into HandBrake:master Jan 23, 2025
6 checks passed
@robxnano robxnano mentioned this pull request Aug 7, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

5 participants