! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Open With action ignores Exec parameters
Status:
RESOLVED: FIXED
Product:
Xfce4-screenshooter
Component:
General

Comments

Description wirch.eduard 2017-09-26 12:10:19 CEST
This my .desktop file for HotShots:

[Desktop Entry]
Version=2.2.0
Name=HotShots
Comment=Screenshot manager
Type=Application
GenericName=Screenshot manager
TryExec=/usr/bin/hotshots
Exec=/usr/bin/hotshots --no-singleinstance
Categories=Utility;Application;
Icon=/usr/share/pixmaps/hotshots.png
MimeType=application/x-hot;image/png;image/gif;image/jpeg;image/jpg;

Notice the '--no-singleinstance' parameter to Exec. When I launch HotShots using mimeopen,

$ mimeopen -a Screenshot_2017-09-26_11-39-04.png

this is the output of execsnoop (https://github.com/iovisor/bcc/blob/master/tools/execsnoop_example.txt):

mimeopen         12255  10881    0 /usr/bin/vendor_perl/mimeopen -a Screenshot_2017-09-26_11-39-04.png
hotshots         12255  10881    0 /usr/bin/hotshots --no-singleinstance Screenshot_2017-09-26_11-39-04.png

When I use screenshooter to open a screenshot, this is the output of execsnoop:

xfce4-screensho  12306  2258     0 /usr/bin/xfce4-screenshooter -r
hotshots         12312  1        0 /usr/bin/hotshots /tmp/Screenshot_2017-09-26_12-08-36.png

This shows, that the extra parameter to HotShots is correctly recognized by the system, but ignored by screenshooter.
Comment 1 Andre Miranda editbugs 2017-09-27 04:53:58 CEST
Currently screenshooter uses g_app_info_get_all_for_type to get a list of apps that handle the mime "image/png". Then for each item on that list, it extracts the command with g_app_info_get_executable, which internally gio calls of info->binary and defines as "the first word in an exec line". So xfce4-screenshooter makes a call such as: <command> <path to screenshot>. Easy peasy, but to call the command as in Exec (g_app_info_get_commandline) it would be necessary to replace the field codes (%f, %F, %U, %u), if none is present just append the path to the screenshot.

Not really that complicated, but requires testing, especially for popular apps (Risttreto, Viewnior, GIMP, eog...) to make sure we don't break working stuff.
Well, don't hold your breath, this improvement will remain on my (very) long TODO list for a while. On the other hand, a patch would be reviewed and merged ASAP ;)
Comment 2 wirch.eduard 2017-10-10 10:35:13 CEST
I changed the code to use g_app_info_launch() for command launching. It does all necessary parsing and replacement. See use_g_app_info_launch.patch.
Comment 3 wirch.eduard 2017-10-10 10:36:08 CEST
Created attachment 7350 
Use g_app_info_launch() for command launching
Comment 4 Git Bot editbugs 2017-10-12 19:22:48 CEST
Eduard Wirch referenced this bugreport in commit e86731e3373538f64c0ac71bb2562e7fb3ec2c69

Use g_app_info_launch() for command launching (Bug #13886)

https://git.xfce.org/apps/xfce4-screenshooter/commit?id=e86731e3373538f64c0ac71bb2562e7fb3ec2c69
Comment 5 Andre Miranda editbugs 2017-10-12 19:24:25 CEST
I have successfully tested with Ristretto, eog, feh, GIMP and Viewnior.
Reviewed and merged as promised, thanks!
Comment 6 Andre Miranda editbugs 2017-10-12 19:24:45 CEST
Ops, forgot to close...

Bug #13886

Reported by:
wirch.eduard
Reported on: 2017-09-26
Last modified on: 2017-10-12

People

Assignee:
Jérôme Guelfucci
CC List:
2 users

Version

Attachments

Additional information