is it possible to have different filetype associations per DE

Message
Author
User avatar
baldyeti
Posts: 678
Joined: Sat Dec 05, 2009 4:37 pm

is it possible to have different filetype associations per DE

#1 Post by baldyeti »

hello, I am not sure i am posting in the right section or that my title is clear.
I have installed plasma 5.12 (from neptuneos) alongside xfce on MX17.1
When using KDE's file browser (dolphin), qpdf is invoked when doucble-clicking a pdf, and nomacs for pictures.
I'd like these to be respectively okular and gwenview - but only when logged in unde plasma, under xfce these are alright.
Is this possible ?

User avatar
Richard
Posts: 1577
Joined: Fri Dec 12, 2008 10:31 am

Re: is it possible to have different filetype associations per DE

#2 Post by Richard »

I have never tried it, but imagine that it would work,
if you created separate users for Kde & Xfce.

Unless Kde uses different DE variables from Xfce?
Thinkpad T430 & Dell Latitude E7450, both with MX-21.3.1
kernal 5.10.0-26-amd64 x86_64; Xfce-4.18.0; 8 GB RAM
Intel Core i5-3380M, Graphics, Audio, Video; & SSDs.

User avatar
Stevo
Developer
Posts: 12774
Joined: Fri Dec 15, 2006 8:07 pm

Re: is it possible to have different filetype associations per DE

#3 Post by Stevo »

I believe it is possible, but I think you may have to swap in a different, custom mimetypes file when you start up a specific desktop.

User avatar
baldyeti
Posts: 678
Joined: Sat Dec 05, 2009 4:37 pm

Re: is it possible to have different filetype associations per DE

#4 Post by baldyeti »

Richard wrote: Mon May 21, 2018 1:05 pm I have never tried it, but imagine that it would work,if you created separate users for Kde & Xfce.
Thanks for the suggestion, but i'd like to avoid it (too afraid of split-personality effects ;-)
I'd also rather avoid a mess of links between the two home folders (to share e.g. mozilla profile...)
Last edited by baldyeti on Mon May 21, 2018 1:41 pm, edited 1 time in total.

User avatar
baldyeti
Posts: 678
Joined: Sat Dec 05, 2009 4:37 pm

Re: is it possible to have different filetype associations per DE

#5 Post by baldyeti »

Stevo wrote: Mon May 21, 2018 1:11 pmI believe it is possible, but I think you may have to swap in a different, custom mimetypes file when you start up a specific desktop.
I was thinking along those lines, too. Except I have no idea where the personal mime associations are kept, and do not know of a hook run at login time that could perform the swap.
The right-click 'open with" is usable (the relevant programs *are* available from that menu), but i was curious to ask if someone had ever automated this.

skidoo
Posts: 753
Joined: Tue Sep 22, 2015 6:56 pm

Re: is it possible to have different filetype associations per DE

#6 Post by skidoo »

Except
yeah, except it wouldn't be particularly useful to me because half or more of my chosen applications don't utilize the xdg mimeapps list, nor gvfs, nor recently-used.xbel...

If you typically work from within a file manager (I do), thunar CustomActions or spacefm custom comands via "design mode" are helpful toward quick OpenWith. Also, dragging from file manager and using application desktop icons as drop targets comes in handy. (ps: I've also learned to create & toggle multiple task-oriented rox panels to display droptarget icons. I guess this approach is similar to KDE activities.)

User avatar
Stevo
Developer
Posts: 12774
Joined: Fri Dec 15, 2006 8:07 pm

Re: is it possible to have different filetype associations per DE

#7 Post by Stevo »


User avatar
baldyeti
Posts: 678
Joined: Sat Dec 05, 2009 4:37 pm

Re: is it possible to have different filetype associations per DE

#8 Post by baldyeti »

Thanks for your input.

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

Re: is it possible to have different filetype associations per DE

#9 Post by fehlix »

baldyeti wrote: Mon May 21, 2018 12:20 pm..
When using KDE's file browser (dolphin), qpdf is invoked when doucble-clicking a pdf, and nomacs for pictures.
I'd like these to be respectively okular and gwenview - but only when logged in unde plasma, under xfce these are alright.
Is this possible ?
Well, instead of trying to fiddle with DE-specific mime-settings you can achieve this the other way round. One way is shown in the below desktop file where I have squeezed to open pdf-files DE-specifically into the Exec-line as one-liner.
This will open pdf-files with okular in KDE and with qpdfview in XFCE,
Save the desktop-file eg.as „MyPDFViewer.desktop“ into your user specific applications folder "~/.local/share/applications"
or copy like this with the terminal:

Code: Select all

cp MyPDFViewer.desktop ~/.local/share/applications/MyPDFViewer.desktop
Open now within Thunar by right-click an a PDF-file via open/with and select as default-application.
By this you have within your mime-database re-defined the default applicition to this little pdf-helper, which will become in both DE's.

Code: Select all

[Desktop Entry]
# file: ~/.local/share/applications/MyPDFViewer.desktop
Encoding=UTF-8
Type=Application
Terminal=false
Name=MyPDFviewer
Icon=application-pdf
GenericName=PDFviewer for XFCE and KDE 
Comment=Run default pdfviewer for XFCE and KDE selectively
Categories=Viewer;Office;
Keywords=viewer;document;presentation;pdf;ps;djvu;
Exec=bash -c 'declare -A T;T=([XFCE]="/usr/bin/qpdfview --unique" [KDE]=/usr/bin/okular); exec ${T[${XDG_CURRENT_DESKTOP}]} "$@"' ""  %F 
MimeType=application/pdf;application/x-pdf;text/pdf;text/x-pdf;image/pdf;image/x-pdf;application/postscript;image/vnd.djvu;image/x-djvu;
Path=
StartupNotify=false
With the same template you can achieve to open images with nomacs and pictures, respectively.
Let me know if that works.
Gigabyte Z77M-D3H, Intel Xeon E3-1240 V2 (Quad core), 32GB RAM,
GeForce GTX 770, Samsung SSD 850 EVO 500GB, Seagate Barracuda 4TB

User avatar
baldyeti
Posts: 678
Joined: Sat Dec 05, 2009 4:37 pm

Re: is it possible to have different filetype associations per DE

#10 Post by baldyeti »

Hello fehlix, I just tried your .desktop file and it works just fine. Very neat.

Post Reply

Return to “XFCE Desktop Environment”