Page 1 of 1
Thunar - "option not known"
Posted: Sat Oct 19, 2024 10:15 am
by AVLinux
Hi,
Background
I'm working on a new AVL Enlightenment Base ISO to formulate a solid underlying setup for future AVL versions and a lot of good progress has been made thanks to the generosity and kindness of the MX devs

Fortunately I'm getting down to the tiny nits and this one is a bit of a mystery... If you've tried or used AVL before you will know the File Manager (Thunar) is loaded with Custom Actions to do various Audio and Video tasks (Resize photos, Convert Audio, Concatenate Videos, Create SFZ Sound libs, Change properties of WAVs etc.). Until now this has been fairly easy with a large amount of Custom Actions in Thunar which has it's built-in Custom Actions functionality but here's the rub... I recently spent a couple of months trying and testing KDE and realized all the work I had done on Thunar Custom Actions was pretty much useless in Dolphin and any other File Manager from any other DE (including Enlightenment's native 'EFM' File Manager) so instead I decided to put the focus into making File Manager agnostic 'Open With' actions that are essentially specialized application '.desktop' files that are selectable by File mimetype and that only appear in right-click context menus, these tuned .desktop files are working as expected for the most part under Thunar and EFM (Dolphin is untested at this point) except for one stubborn edge-case I can't figure out..
One of these Open With Actions uses yad to show the output of 'mediainfo', yes there is a mediainfo-gui available but I think it could look better and be easier to read so I rolled my own... What's weird is this Open With works perfectly in EFM:
shot-2024-10-19_09-50-56.jpg
Here is the contents of the Launcher Desktop File:
Code: Select all
[Desktop Entry]
Type=Application
Name=AVL-MXe Action - Get Media Info
Comment=Get Codec Info and Other Media Details
Icon=/usr/local/share/icons/custom/mediainfo.png
OnlyShowIn=Enlightenment;KDE;XFCE;
NoDisplay=true
Exec=mediainfo %f | yad --text-info --wrap --title="Media Info" --image-on-top --image=/usr/local/share/icons/custom/mediainfo-app.png --text="<b>Displaying Codec Info and Details for the Selected File</b>" --text-align=center --fontname="Red Hat Text Medium" --window-icon=/usr/local/share/icons/custom/mediainfo.png --width=640 --height=400 --borders=24
Terminal=false
MimeType=application/ogg;application/x-ogg;application/mxf;application/sdp;application/smil;application/x-smil;application/streamingmedia;application/x-streamingmedia;application/vnd.rn-realmedia;application/vnd.rn-realmedia-vbr;audio/aac;audio/x-aac;audio/vnd.dolby.heaac.1;audio/vnd.dolby.heaac.2;audio/aiff;audio/x-aiff;audio/m4a;audio/x-m4a;application/x-extension-m4a;audio/mp1;audio/x-mp1;audio/mp2;audio/x-mp2;audio/mp3;audio/x-mp3;audio/mpeg;audio/mpeg2;audio/mpeg3;audio/mpegurl;audio/x-mpegurl;audio/mpg;audio/x-mpg;audio/rn-mpeg;audio/musepack;audio/x-musepack;audio/ogg;audio/scpls;audio/x-scpls;audio/vnd.rn-realaudio;audio/wav;audio/x-pn-wav;audio/x-pn-windows-pcm;audio/x-realaudio;audio/x-pn-realaudio;audio/x-ms-wma;audio/x-pls;audio/x-wav;video/mpeg;video/x-mpeg2;video/x-mpeg3;video/mp4v-es;video/x-m4v;video/mp4;application/x-extension-mp4;video/divx;video/vnd.divx;video/msvideo;video/x-msvideo;video/ogg;video/quicktime;video/vnd.rn-realvideo;video/x-ms-afs;video/x-ms-asf;audio/x-ms-asf;application/vnd.ms-asf;video/x-ms-wmv;video/x-ms-wmx;video/x-ms-wvxvideo;video/x-avi;video/avi;video/x-flic;video/fli;video/x-flc;video/flv;video/x-flv;video/x-theora;video/x-theora+ogg;video/x-matroska;video/mkv;audio/x-matroska;application/x-matroska;video/webm;audio/webm;audio/vorbis;audio/x-vorbis;audio/x-vorbis+ogg;video/x-ogm;video/x-ogm+ogg;application/x-ogm;application/x-ogm-audio;application/x-ogm-video;application/x-shorten;audio/x-shorten;audio/x-ape;audio/x-wavpack;audio/x-tta;audio/AMR;audio/ac3;audio/eac3;audio/amr-wb;video/mp2t;audio/flac;audio/mp4;application/x-mpegurl;video/vnd.mpegurl;application/vnd.apple.mpegurl;audio/x-pn-au;video/3gp;video/3gpp;video/3gpp2;audio/3gpp;audio/3gpp2;video/dv;audio/dv;audio/opus;audio/vnd.dts;audio/vnd.dts.hd;audio/x-adpcm;application/x-cue;audio/m3u;
Categories=AudioVideo;
StartupNotify=false
StartupWMClass=e_fm
Where things go astray is... it does not work in Thunar as an "Open with" .desktop action but the identical launch code as a regular Thunar Custom Action item does work, note that the dozens of other 'Open With" actions I've made DO work as expected in Thunar so the format is known to work, just not this particular one. If I run Thunar in a terminal and try to run the Mediainfo launcher the terminal outputs "option not known"...?
shot-2024-10-19_10-03-29.jpg
Also weirdly if I run the execution code from the launcher and select the file explicitly it runs as expected...
shot-2024-10-19_10-08-58.resized.jpg
Oh and I googled 'Thunar option not known' and no relevant info... Any XFCE4/Thunar gurus here know why Thunar has a bee in it's bonnet about the launcher only? To recap other similar launchers work fine in Thunar, and this launcher works as expected in another File Manager (EFM)..
Re: Thunar - "option not known"
Posted: Sat Oct 19, 2024 11:37 am
by dolphin_oracle
Dolphin didn't have a problem with it either, so its probably chocking on the | symbol I expect.
try this
Code: Select all
bash -c "mediainfo %f | yad --text-info --wrap --title='Media Info' --image-on-top --image=/usr/local/share/icons/on-off.svg --text='<b>Displaying Codec Info and Details for the Selected File</b>' --text-align=center --fontname='Noto Sans' --window-icon=/usr/local/share/icons/on-off.svg --width=640 --height=400 --borders=24"
I changed the icon paths and fonts to something I had present, so you'll need to mod those back to what you want.
Re: Thunar - "option not known"
Posted: Sat Oct 19, 2024 11:55 am
by fehlix
dolphin_oracle wrote: Sat Oct 19, 2024 11:37 am
Dolphin didn't have a problem with it either, so its probably chocking on the | symbol I expect.
try this
Code: Select all
bash -c "mediainfo %f | yad --text-info --wrap --title='Media Info' --image-on-top --image=/usr/local/share/icons/on-off.svg --text='<b>Displaying Codec Info and Details for the Selected File</b>' --text-align=center --fontname='Noto Sans' --window-icon=/usr/local/share/icons/on-off.svg --width=640 --height=400 --borders=24"
I changed the icon paths and fonts to something I had present, so you'll need to mod those back to what you want.
Nope, don't use desktop fields like %f within quotes strings of the exec-key line. %-fields needs to stay on its own.
Also no need for full bash
Code: Select all
Exec=sh -c 'f="$0"; mediainfo "$f" | yad --text-info --wrap --title="Media Info" --image-on-top --image=/usr/local/share/icons/custom/mediainfo-app.png --text="<b>Displaying Codec Info and Details for the Selected File</b>" --text-align=center --fontname="Red Hat Text Medium" --window-icon=/usr/local/share/icons/custom/mediainfo.png --width=640 --height=400 --borders=24' %f
* always place %-fields at the end - standalone
* assign a shell parameter to the argument in this case $0
* put the whole string in single quotes, so you can use double quotes inside
Placing %f-fields directly into the string will not handle quoting spaces within the field.
Further note:
The Exec key wrote:Field codes must not be used inside a quoted argument, the result of field code expansion inside a quoted argument is undefined. The %F and %U field codes may only be used as an argument on their own.
Re: Thunar - "option not known" [Solved]
Posted: Sat Oct 19, 2024 12:19 pm
by AVLinux
dolphin_oracle wrote: Sat Oct 19, 2024 11:37 am
Dolphin didn't have a problem with it either, so its probably chocking on the | symbol I expect.
try this
Code: Select all
bash -c "mediainfo %f | yad --text-info --wrap --title='Media Info' --image-on-top --image=/usr/local/share/icons/on-off.svg --text='<b>Displaying Codec Info and Details for the Selected File</b>' --text-align=center --fontname='Noto Sans' --window-icon=/usr/local/share/icons/on-off.svg --width=640 --height=400 --borders=24"
I changed the icon paths and fonts to something I had present, so you'll need to mod those back to what you want.
Bing bing bing we have a winner! Thanks! Also handy to know that at least that one will work in Dolphin! There are about 30 actions in all... and so far Dolphin has been theoretical at best..
To summarize: prepending bash -c, then quoting the whole command in double quotes and the YAD options in single quotes was the ticket!
Re: Thunar - "option not known"
Posted: Sat Oct 19, 2024 12:50 pm
by fehlix
AVLinux wrote: Sat Oct 19, 2024 12:19 pm
dolphin_oracle wrote: Sat Oct 19, 2024 11:37 am
Dolphin didn't have a problem with it either, so its probably chocking on the | symbol I expect.
try this
Code: Select all
bash -c "mediainfo %f | yad --text-info --wrap --title='Media Info' --image-on-top --image=/usr/local/share/icons/on-off.svg --text='<b>Displaying Codec Info and Details for the Selected File</b>' --text-align=center --fontname='Noto Sans' --window-icon=/usr/local/share/icons/on-off.svg --width=640 --height=400 --borders=24"
I changed the icon paths and fonts to something I had present, so you'll need to mod those back to what you want.
Bing bing bing we have a winner! Thanks! Also handy to know that at least that one will work in Dolphin! There are about 30 actions in all... and so far Dolphin has been theoretical at best..
To summarize: prepending bash -c, then quoting the whole command in double quotes and the YAD options in single quotes was the ticket!
Does it work with spaces within file names?
Re: Thunar - "option not known"
Posted: Sat Oct 19, 2024 12:54 pm
by dolphin_oracle
well, it might not be "right" but it does work in thunar. with spaces.
Code: Select all
bash -c "mediainfo %f | yad --text-info --wrap --title='Media Info' --image-on-top --image=/usr/local/share/icons/on-off.svg --text='<b>Displaying Codec Info and Details for the Selected File</b>' --text-align=center --fontname='Noto Sans' --window-icon=/usr/local/share/icons/on-off.svg --width=640 --height=400 --borders=24"

Re: Thunar - "option not known"
Posted: Sat Oct 19, 2024 1:04 pm
by fehlix
dolphin_oracle wrote: Sat Oct 19, 2024 12:54 pm
well, it might not be "right" but it does work in thunar. with spaces.
Code: Select all
bash -c "mediainfo %f | yad --text-info --wrap --title='Media Info' --image-on-top --image=/usr/local/share/icons/on-off.svg --text='<b>Displaying Codec Info and Details for the Selected File</b>' --text-align=center --fontname='Noto Sans' --window-icon=/usr/local/share/icons/on-off.svg --width=640 --height=400 --borders=24"
That's called "undefined": with luck it works, next upgrade, in case some fixes get applied, it may no longer work.
Re: Thunar - "option not known"
Posted: Sat Oct 19, 2024 2:55 pm
by AVLinux
Yes, I understand that, another brain-teaser is why the original command works as a Thunar Custom Action in Thunar but not as a launcher...?
Re: Thunar - "option not known"
Posted: Sat Oct 19, 2024 3:10 pm
by dolphin_oracle
Different parts of code different foibles. Custom action is internal to thunar. The other is not really executed by thunar but as a different application. So more likely xfce4-session or however that is handled by xfce when thunar triggers the external action. All it’s really doing is passing the file parameter.
You wouldn’t blame thunar if featherpad couldn’t open a file.
Re: Thunar - "option not known"
Posted: Sat Oct 19, 2024 3:17 pm
by AVLinux
That makes sense, thanks to you and @fehlix for 2 working solutions, every one of these little quirks teaches me something and I'm happy to keep learning and happy to have a working FM independent Mediainfo launcher!
Re: Thunar - "option not known"
Posted: Sat Oct 19, 2024 3:32 pm
by fehlix
AVLinux wrote: Sat Oct 19, 2024 3:17 pm
That makes sense, thanks to you and @fehlix for 2 working solutions, every one of these little quirks teaches me something and I'm happy to keep learning and happy to have a working FM independent Mediainfo launcher!
In case you have a desktop-entry which needs multiple file arguments, e.g. as %F,
you would do similar and let %F as last argument with the Exec-key line.
You can than assign - and well quoted to preserve spaces in file names - all arguments to an array, and go through the array.
But don't want to bother you now with the code, just in case, you ever have such thing, any you may wonder why sometimes something is not working when spaces are involved.
Re: Thunar - "option not known"
Posted: Sat Oct 19, 2024 3:40 pm
by AVLinux
fehlix wrote: Sat Oct 19, 2024 3:32 pm
AVLinux wrote: Sat Oct 19, 2024 3:17 pm
That makes sense, thanks to you and @fehlix for 2 working solutions, every one of these little quirks teaches me something and I'm happy to keep learning and happy to have a working FM independent Mediainfo launcher!
In case you have a desktop-entry which needs multiple file arguments, e.g. as %F,
you would do similar and let %F as last argument with the Exec-key line.
You can than assign - and well quoted to preserve spaces in file names - all arguments to an array, and go through the array.
But don't want to bother you now with the code, just in case, you ever have such thing, any you may wonder why sometimes something is not working when spaces are involved.
I will keep that in mind, so far most of these Launcher actions are simple one-step operations but I'm sure I will find more complex batch-type of things I might want to do as need arises.
Re: Thunar - "option not known"
Posted: Sat Oct 19, 2024 4:00 pm
by fehlix
AVLinux wrote: Sat Oct 19, 2024 3:40 pm
fehlix wrote: Sat Oct 19, 2024 3:32 pm
AVLinux wrote: Sat Oct 19, 2024 3:17 pm
That makes sense, thanks to you and @fehlix for 2 working solutions, every one of these little quirks teaches me something and I'm happy to keep learning and happy to have a working FM independent Mediainfo launcher!
In case you have a desktop-entry which needs multiple file arguments, e.g. as %F,
you would do similar and let %F as last argument with the Exec-key line.
You can than assign - and well quoted to preserve spaces in file names - all arguments to an array, and go through the array.
But don't want to bother you now with the code, just in case, you ever have such thing, any you may wonder why sometimes something is not working when spaces are involved.
I will keep that in mind, so far most of these Launcher actions are simple one-step operations but I'm sure I will find more complex batch-type of things I might want to do as need arises.
Also keep in mind, the one way where you have %f within the quoted string may work within one file-manager but may also fail within another. Or may fail after an upgrade of that file manger to a newer version. It's highly dependent how the maintainer of the filemanger code do implement cases where spaces are involved. The way guaranteed to work is by going with the spec as mentioned.
Otherwise you may need fix later what now seem to work. I'd prefer fix now, not wait until it breaks.
Re: Thunar - "option not known"
Posted: Sat Oct 19, 2024 4:40 pm
by Aronticuz
AVLinux wrote: Sat Oct 19, 2024 10:15 am
Hi,
Background
... (Dolphin is untested at this point) except for one stubborn edge-case I can't figure out..
I don't know if it helps at all but one thing I have noticed in KRunner searches (Dolphin related?) is that some files appear twiced.
Once as I entered in search field and once again with filename appended with .desktop
It seems to be a recent observation on my part
Re: Thunar - "option not known"
Posted: Sat Oct 19, 2024 7:26 pm
by AVLinux
Aronticuz wrote: Sat Oct 19, 2024 4:40 pm
AVLinux wrote: Sat Oct 19, 2024 10:15 am
Hi,
Background
... (Dolphin is untested at this point) except for one stubborn edge-case I can't figure out..
I don't know if it helps at all but one thing I have noticed in KRunner searches (Dolphin related?) is that some files appear twiced.
Once as I entered in search field and once again with filename appended with .desktop
It seems to be a recent observation on my part
Not sure what's going on there, I actually had uninstalled KDE before I got the brainwave to make my launchers also work with Dolphin, that's why my quote says 'untested'.. The quirk from today was Thunar-only. I did enjoy using KDE and thought it was very attractive but I did notice some of the menu anomalies you mention, it seems to save it's recent sessions and changes to applications and menus could take a few boots to show up sometimes in my experience but in my newbness it could also as easily just been a wrong setting I made.. I will say installing KDE on a system with another DE and then uninstalling it is a messy business, I have all hunted down all KDE Packages and uninstalled from with MXPI and lots of cruft and bad configs left on my system, I will definitely need to reinstall to properly get back to pre-KDE conditions sadly, but I digress...
Re: Thunar - "option not known"
Posted: Sat Oct 19, 2024 10:12 pm
by i_ri
Hello AVLinux and Everyone
mediainfo just stopped on () parenthesis in file name. how about you?
this:/tubbagn/20_-_The_Ten_Black_Berries_(St._James_Infirmary).mp3
edit: inside double or single quote the paren filename works
Re: Thunar - "option not known"
Posted: Sat Oct 19, 2024 11:18 pm
by AVLinux
@i_ri
Thanks for the info. If you replace the 'Exec=' line in mediainfo.desktop with
@fehlix suggestion do parenthesis work?
Code: Select all
Exec=sh -c 'f="$0"; mediainfo "$f" | yad --text-info --wrap --title="Media Info" --image-on-top --image=/usr/local/share/icons/custom/mediainfo-app.png --text="<b>Displaying Codec Info and Details for the Selected File</b>" --text-align=center --fontname="Red Hat Text Medium" --window-icon=/usr/local/share/icons/custom/mediainfo.png --width=640 --height=400 --borders=24' %f
Re: Thunar - "option not known"
Posted: Sat Oct 19, 2024 11:50 pm
by i_ri
Exec=sh -c 'f="$0"; mediainfo "$f" | yad --text-info --wrap --title="Media Info" --image-on-top --image=/usr/local/share/icons/custom/mediainfo-app.png --text-align=center --fontname="Red Hat Text Medium" --window-icon=/usr/local/share/icons/custom/mediainfo.png --width=640 --height=400 --borders=24 --text="<b>Displaying Codec Info and Details for the Selected File</b>"' %f
Hello AVLinux
having this in .desktop works in thunar and efm and dolphin.

Re: Thunar - "option not known"
Posted: Sun Oct 20, 2024 2:00 am
by i_ri
Hello AVLinux and everyone
The preceding Exec does work in the file managers, but
, but sending it through desktop-file-validate /usr/share/applications/mediainfo.desktop
reports a mess.
Getting a clean report from desktop-file-validate and working in thunar, efm, dolphin is this modified Exec. Now it needs pass fehlix' standards and tests for spaces and such expected for a clean report from fehlix. Does it work?
Exec=sh -c " f=\\${0}; mediainfo \\${f} | yad --text-info --wrap --title='Media Info' --image-on-top --image=/usr/local/share/icons/custom/mediainfo-app.png --text-align=center --fontname='Red Hat Text Medium' --window-icon=/usr/local/share/icons/custom/mediainfo.png --width=640 --height=400 --borders=24 --text='<b>Displaying Codec Info and Details for the Selected File</b>' " %f

this fluxbox Thunar is on AVLinux-mxe system.
Re: Thunar - "option not known"
Posted: Sun Oct 20, 2024 6:51 am
by i_ri

mate desktop on MXkde system. caja and pcmanfm work with mediainfo context menu.
Re: Thunar - "option not known"
Posted: Sun Oct 20, 2024 9:37 am
by AVLinux
Hi @i_ri!
Thank you very much for your time to test and confirm!