View Full Version : [ubuntu] Create own file type with icon

January 23rd, 2013, 12:23 AM
Hello everyone,

I've written a program which creates files named '*.not'. Now I would like to associate these files with my program. I've tried adding a mime type but with no effect.

When I go to my file -> properties, there's written: (text/x-mup)

there should be (application/sourcenote or text/x-not)

I've read about a GUI which does that, but I want that to be done when a user installs my package.

I've tried https://help.ubuntu.com/community/AddingMimeTypes

It would be great if someone could briefly summarize the steps or give me a helpful link ;)



January 26th, 2013, 05:43 PM
I've solved my issue

I did the following: (I saw that *.not is already taken by another application so I changed to *.snot)

replace nameOfYourApp with the name of your application.

create mimetype: (for all users)

place here a nameOfYourApp.xml which looks like:

<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/nameOfYourApp">
<comment>Sourcenote Textfile</comment>
<generic-icon name="application-nameOfYourApp" />
<glob pattern="*.snot"/>
replace *.snot with the ending you want

to apply the changes update the mime database with:

sudo update-mime-database /usr/share/mime


to add an Icon place it in:

name of the file should be: application-nameOfYourApp.png

(your can also do this for different sizes replace the 64x64 with another size)

to update the icon cache type:

sudo gtk-update-icon-cache /usr/share/icons/hicolor

(you may want to add --force)

set application to open specific type:


/usr/share/applications/defaults.listmaybe you nedd to add %U to exec = nameOfYourApp in the file nameOfYourApp.desktop, this sign is filled with the files you want to open

the file should look like:

[Desktop Entry]
.. some lines of text
Exec=/usr/bin/SourceNote %U
... some lines of text
the MimeType tells which files can be open by this application

If you would like to change this only for one user, look at:

update the mime-database (change the database: ~/.local/share/mime/)

and update the icons cache (change update location to ~/.local/share/icons/hicolor/)

If you have some additions let me know


October 22nd, 2013, 05:54 PM
Thank you for the very detailed information. Actually I only want to change the icon of PSD files but I think this will help me.