Question

I open text with command "vim" from thunar(A file manager) just as open picture with command "feh" from thunar, and almost all applications broken.

Don't want open xterm, cd to that path and vi that file if can just double-click.

Is there a solution?

arch + openbox + thunar + xterm


There is a simpler solution: right click -> open with other application -> use a custom command and input "xterm -e vim".

This from one of my QQ friends, actually similar with evnu's. Thanks @evnu.

Was it helpful?

Solution

You can do that using Xdg as described in the ArchLinux Wiki. For GUI applications, a filetype can be associated directly with an application by using left-click -> Properties -> Open With. If you want to run a xterm with a program, you can associate a MimeType with a command to run like this:

Go to ~/.local/share/applications. There, add a file describing how to start your application and save it as my-application.desktop or similar:

[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=vim
Exec=/usr/bin/xterm -name vim -e /usr/bin/vim
MimeType=text/plain

Now you have to edit the file defaults.list. There, add an entry for the MimeType you want to associate with your new entry:

[Default Applications]
text/plain=`my-application.desktop`

After a restart, thunar should be able to start xterm with vim when you click plain textfiles.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top