I am using Ubuntu 12.04 with default Unity interface. I installed later the KDE desktop, XFCE, LXDE, gnome-shell and Cinnamon.
The KDE comes with different default applications than Unity, such as
kwrite
for text editing,konsole
as virtual terminal,kfontview
for font viewing and installing,dolphin
as File browser etc.
Other DE come with some other default applications.
The problem arises when you want to open a file such as a text file, with which can both be opened by gedit
and kwrite
, I want to use kwrite
on KDE and gedit
on Unity or Gnome. But, there is no way to set like this. I can set default application for text file by changing respective settings in both KDE and Unity, but It become default for both DE.
For example, If I set kfontviewer
as default font viewing application in KDE, it also opens fonts when I am in Unity or Gnome and vice versa. This is a problem because, loading other DE's program takes long time than the default one for the used DE.
My question is: Can I use different default applications for different DE? How?
I've put together this solution to resolve your issue, and tested it on KDE and XFCE with opening text files and font files. It is a generic solution that should be applicable to any number of desktop environments and mime types. The way it works is there is a simple python script called custom-open that will open a file using different applications for different desktop environments. These are the steps to setup the solution:
custom-open
.custom-open.ini
so what's great about this solution is that you can add as many new desktop environments as you want and as many mime type you want. to check what name you should provide for the desktop environment run the below command in a terminal.
to check the exact mime type of a file just run:
EDITED: The need for symbolic links has been removed this should make it easier to use. I've also added a graphical error handler that will bring up an alert if an error occurs.
If you don't find the "right" way to do it, you could use a brute force method something like:
cd $HOME;ls -Rlrt | less
to find out what files were just updated - i.e where those choices were savedHopefully, there's a way to switch desktop environments from a shell script with the option of telling the desktop environment where to get it's configuration files from. That might be cleaner than moving files around all the time, but I haven't researched if or how that works.
Another, much simpler solution, but not exactly what you asked for, would be to just:
Make any common data files you need to access from all these users
-rwxrwxr-x
(chmod 775 list-of-files-and-directories
). That way you won't get permission errors trying to write to a file that another one of your "users" wrote to first.