Difference between revisions of "Mime"

From Blue-IT.org Wiki

(Mime types under Linux)
(mimeapps.list)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
= Mime types under Linux =
 
= Mime types under Linux =
 +
== mimeapps.list ==
 +
 +
Accroding to [http://askubuntu.com/questions/6765/how-to-associate-a-file-with-a-program-installed-in-wine/32919#32919 this post] do (this is an almost excact cite of the post!):
 +
 +
All you need to associate file of some type to be handled by some app, also by wine app, you can find in folder
 +
 +
~/.local/share/applications 
 +
 +
you will need to open
 +
 +
~/.local/share/applications/mimeapps.list
 +
 +
Locate the section [Default Applications] or [Added Associations]
 +
 +
and find needed type, like this:
 +
 +
image/jpeg=eog.desktop;wine-extension-jpeg.desktop;
 +
 +
as you see there are two files which are relative to this type, if the file stand first it will be the default handler for this type, the other will be shown in "Open with" menu
 +
 +
this is example of .desktop file
 +
 +
[Desktop Entry]
 +
Name=PHP Expert Editor
 +
Exec=wine start C:\\\\Program\\ Files\\\\PHP\\ Expert\\ Editor\\ 4.3\\\\phpxedit.exe z:%f
 +
MimeType=image/jpeg
 +
Type=Application
 +
StartupNotify=true
 +
Path=/home/m/.wine/dosdevices/c:/Program Files/PHP Expert Editor 4.3
 +
Icon=/home/m/.local/share/icons/10de_phpxedit.0.png
 +
 +
the whole point in the "Exec=" line at the and "z:%f"
 +
 +
Exec=wine start C:\\\\Program\\ Files\\\\PHP\\ Expert\\ Editor\\ 4.3\\\\phpxedit.exe z:%f
 +
 +
if you don't have this line you should have an error
 +
 +
Can not open file "/home/...."
 +
 +
while trying to open some file with your app, because of wine paths are like windows disks and to open your file, for example "/home/picture.jpg" in wine you should use path "z:/home/picture.jpg"
 +
 +
== xdg ==
 
  $> man  xdg-mime
 
  $> man  xdg-mime
 
  xdg-mime - command line tool for querying information about file type handling and adding descriptions for new file types
 
  xdg-mime - command line tool for querying information about file type handling and adding descriptions for new file types
Line 22: Line 64:
 
  $> xdg-mime query default application/pdf
 
  $> xdg-mime query default application/pdf
 
  kde-kpdf.desktop
 
  kde-kpdf.desktop
 +
 +
 +
[[Category:Ubuntu]]

Latest revision as of 20:07, 11 January 2012

Mime types under Linux

mimeapps.list

Accroding to this post do (this is an almost excact cite of the post!):

All you need to associate file of some type to be handled by some app, also by wine app, you can find in folder

~/.local/share/applications  

you will need to open

~/.local/share/applications/mimeapps.list

Locate the section [Default Applications] or [Added Associations]

and find needed type, like this:

image/jpeg=eog.desktop;wine-extension-jpeg.desktop;

as you see there are two files which are relative to this type, if the file stand first it will be the default handler for this type, the other will be shown in "Open with" menu

this is example of .desktop file

[Desktop Entry]
Name=PHP Expert Editor
Exec=wine start C:\\\\Program\\ Files\\\\PHP\\ Expert\\ Editor\\ 4.3\\\\phpxedit.exe z:%f
MimeType=image/jpeg
Type=Application
StartupNotify=true
Path=/home/m/.wine/dosdevices/c:/Program Files/PHP Expert Editor 4.3
Icon=/home/m/.local/share/icons/10de_phpxedit.0.png

the whole point in the "Exec=" line at the and "z:%f"

Exec=wine start C:\\\\Program\\ Files\\\\PHP\\ Expert\\ Editor\\ 4.3\\\\phpxedit.exe z:%f

if you don't have this line you should have an error

Can not open file "/home/...."

while trying to open some file with your app, because of wine paths are like windows disks and to open your file, for example "/home/picture.jpg" in wine you should use path "z:/home/picture.jpg"

xdg

$> man  xdg-mime
xdg-mime - command line tool for querying information about file type handling and adding descriptions for new file types
[...]
$> man  xdg-open
xdg-open - opens a file or URL in the user's preferred application
[...]

You can open any file with the desired program and the xdg-open command:

$> xdg-open special_file.pdf

Setting the default type is easy:

xdg-mime default
$> xdg-mime query default application/pdf
AdobeReader.desktop

$> xdg-mime default kde-kpdf.desktop application/pdf

$> xdg-mime query default application/pdf
kde-kpdf.desktop