Thunar - "option not known"  [Solved]

For issues with MX that has been modified from the initial install. Example: adding packages that then cause issues.
Message
Author
User avatar
AVLinux
Posts: 3023
Joined: Wed Jul 15, 2020 1:15 am

Thunar - "option not known"

#1 Post 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 :hug: 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)..
You do not have the required permissions to view the files attached to this post.

User avatar
dolphin_oracle
Developer
Posts: 22346
Joined: Sun Dec 16, 2007 12:17 pm

Re: Thunar - "option not known"

#2 Post 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.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
fehlix
Developer
Posts: 12737
Joined: Wed Apr 11, 2018 5:09 pm

Re: Thunar - "option not known"

#3 Post 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.

User avatar
AVLinux
Posts: 3023
Joined: Wed Jul 15, 2020 1:15 am

Re: Thunar - "option not known"  [Solved]

#4 Post 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!

User avatar
fehlix
Developer
Posts: 12737
Joined: Wed Apr 11, 2018 5:09 pm

Re: Thunar - "option not known"

#5 Post 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?

User avatar
dolphin_oracle
Developer
Posts: 22346
Joined: Sun Dec 16, 2007 12:17 pm

Re: Thunar - "option not known"

#6 Post 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"
Image
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
fehlix
Developer
Posts: 12737
Joined: Wed Apr 11, 2018 5:09 pm

Re: Thunar - "option not known"

#7 Post 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"
Image
That's called "undefined": with luck it works, next upgrade, in case some fixes get applied, it may no longer work.

User avatar
AVLinux
Posts: 3023
Joined: Wed Jul 15, 2020 1:15 am

Re: Thunar - "option not known"

#8 Post 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...?

User avatar
dolphin_oracle
Developer
Posts: 22346
Joined: Sun Dec 16, 2007 12:17 pm

Re: Thunar - "option not known"

#9 Post 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.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
AVLinux
Posts: 3023
Joined: Wed Jul 15, 2020 1:15 am

Re: Thunar - "option not known"

#10 Post 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!

Post Reply

Return to “MX Modified”