Welcome!
Important information
-- Spectre and Meltdown vulnerabilities
-- Change in MX sources

News
-- MX Linux on social media: here
-- Mepis support still here

Current releases
-- MX-17.1 Final release info here
-- antiX-17 release info here

New users
-- Please read this first, and don't forget to add system and hardware information to posts!
-- Here are the Forum Rules

is it possible to have different filetype associations per DE

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

is it possible to have different filetype associations per DE

#1 Post by baldyeti » Mon May 21, 2018 12:20 pm

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: 2030
Joined: Fri Dec 12, 2008 10:31 am

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

#2 Post by Richard » 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.

Unless Kde uses different DE variables from Xfce?
MX171 on Lenovo T430-2017: i5-3320M, 8 GBRAM, 4.15.0-1-amd64, intel_pstate, 119GB SSD
MX171 on AA1(ZG5) & EeePC-1005ha: Dual Core N270, 1 GBRAM, 4.15.0-1-686-pae, 150GB HDD
DC9, LibO61, Dbox, PM, FF, mPDFed, CherryT, Vbox. __ Linux Counter #208633

User avatar
Stevo
Forum Veteran
Forum Veteran
Posts: 16175
Joined: Fri Dec 15, 2006 8:07 pm

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

#3 Post by Stevo » Mon May 21, 2018 1:11 pm

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
Forum Novice
Forum  Novice
Posts: 56
Joined: Sat Dec 05, 2009 4:37 pm

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

#4 Post by baldyeti » Mon May 21, 2018 1:37 pm

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
Forum Novice
Forum  Novice
Posts: 56
Joined: Sat Dec 05, 2009 4:37 pm

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

#5 Post by baldyeti » Mon May 21, 2018 1:40 pm

Stevo wrote:
Mon May 21, 2018 1:11 pm
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.
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
Forum Regular
Forum Regular
Posts: 850
Joined: Tue Sep 22, 2015 6:56 pm

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

#6 Post by skidoo » Mon May 21, 2018 2:18 pm

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
Forum Veteran
Forum Veteran
Posts: 16175
Joined: Fri Dec 15, 2006 8:07 pm

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

#7 Post by Stevo » Mon May 21, 2018 2:27 pm


User avatar
baldyeti
Forum Novice
Forum  Novice
Posts: 56
Joined: Sat Dec 05, 2009 4:37 pm

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

#8 Post by baldyeti » Mon May 21, 2018 3:40 pm

Thanks for your input.

User avatar
fehlix
Forum Guide
Forum Guide
Posts: 1473
Joined: Wed Apr 11, 2018 5:09 pm

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

#9 Post by fehlix » Mon May 21, 2018 4:15 pm

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
Forum Novice
Forum  Novice
Posts: 56
Joined: Sat Dec 05, 2009 4:37 pm

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

#10 Post by baldyeti » Tue May 22, 2018 5:37 pm

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

Post Reply

Return to “Desktop Environment”