Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: HOWTO: Change icon for specific file types in Gnome

  1. #11
    Join Date
    Aug 2005
    Location
    Fort Worth
    Beans
    44

    Re: HOWTO: Change icon for specific file types in Gnome

    You make it sound so easy, and it was under breezy, but it hasn't under edgy.

    I'm trying to associate an icon, gnome-mime-video-ty.png, with tystreams. I've edited /usr/share/mime/packages/freedesktop.org.xml to include:

    <mime-type type="video/ty">
    <comment>Tivo transport stream</comment>
    <acronym>TY</acronym>
    <expanded-acronym>Tystream</expanded-acronym>
    <glob pattern="*.ty"/>
    </mime-type>

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

    Sure enough, nautilus describes Doctor Who-Rose.ty as:

    Type: Tivo transport stream
    MIME type: video/ty

    I put my icon in ~/.icons/Nuovo/24x24/mimetypes as gnome-mime-video-ty.png, and in gnome-theme-manager->Theme Details->Icons I selected Dropline Nuovo, noticing when I did that the folder icons in nautilus changed to the distinctive yellow icons. (Note: Dropline Nuovo "Inherits=gnome".)

    The icon associated with *.ty files is, however, the gnome one that looks like /usr/share/icons/gnome/32x32/mimetypes/video-x-generic.png, to which gnome-mime-video.png is symlinked. It is the same icon associated with Doctor Who-Rose.ty.vob, described in nautilus as:

    Type: MPEG video
    MIME type: video/mpeg

    What do I have to name my icon to get nautilus to use it for tystreams?

  2. #12
    Join Date
    Sep 2007
    Beans
    2

    Re: HOWTO: Change icon for specific file types in Gnome

    Quote Originally Posted by lllSpylll View Post
    ...

    1) Go to the folder where your icon theme is installed. Mine is in ~/.icons/Vista-Inspirate_1.0
    hi lllSpylll,

    I am using Fedora 9
    There is nothing in ~/.icons folder:
    Code:
    $ ls -la ~/.icons
    total 12
    drwxrwxr-x   2 quanta quanta 4096 2007-12-22 04:35 .
    drwx------ 107 quanta quanta 4096 2008-05-23 23:09 ..
    I have followed your way except for manipulate with /usr/share/icons folder, but not succeed.

    I found the topic.
    Nothing in ~/.local/share/mime/packages folder except for Override.xml.

    I have inserted some code like below:
    Code:
            <mime-type type="application/x-chm2">
    		<comment>chm document</comment>
    		<glob pattern="*.chm"/>
    	</mime-type>
    In /usr/share/mime/packages/freedesktop.org.xml, I changed:
    Code:
    <mime-type type="application/x-chm">
        <comment>CHM document</comment>
        <acronym>CHM</acronym>
        <expanded-acronym>Compiled Help Modules</expanded-acronym>
        <glob pattern="*.chm"/>
      </mime-type>
    to:
    Code:
    <mime-type type="application/x-chm2">
        <comment>CHM document</comment>
        <acronym>CHM</acronym>
        <expanded-acronym>Compiled Help Modules</expanded-acronym>
        <glob pattern="*.chm"/>
      </mime-type>
    after that I copied kchmviewer icon to: /usr/share/icons/Fedora/48x48/mimetypes and renamed it to gnome-mime-application-x-chm2.png, logout and login back but nothing happen. Everything icons of *.chm file not change.

    Is there any other way to change file type icon?

  3. #13
    Join Date
    Oct 2007
    Location
    NY, NY
    Beans
    77
    Distro
    Lubuntu 12.04 Precise Pangolin

    Re: HOWTO: Change icon for specific file types in Gnome

    so is there a better & easier way to achieve this in the "latest and greatest" Gnome 2.22.2 ???
    HP Pavilion dv6700t
    Ubuntu 12.04/Unity

  4. #14
    Join Date
    Sep 2005
    Location
    UK.
    Beans
    86
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: HOWTO: Change icon for specific file types in Gnome

    I figured it out!!!

    Check out the How-To here:

    http://ubuntuforums.org/showthread.php?t=916847

  5. #15
    Join Date
    Jan 2008
    Beans
    185
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: HOWTO: Change icon for specific file types in Gnome

    There is a gui for making this mimes called assogiate. You can download it from the Add/Remove... application tool.
    **America != USA | American != Usanian**
    Own a Dell XPS M1530? Join the group!

  6. #16
    Join Date
    Apr 2009
    Location
    Brazil
    Beans
    60
    Distro
    Ubuntu 10.04 Lucid Lynx

    Smile Re: HOWTO: Change icon for specific file types in Gnome

    Thanks very much now i can use my custom icons for Ruby, Ruby on Rails and Java!!!!!


    Thanks For All,
    Nathan Paulino Campos
    about.me | Twitter | Google+
    Macbook Pro 17" Mac OS X 10.7 - System76 Bonobo Extreme (2TB HDD, 32GB RAM) Ubuntu 13.04

  7. #17
    Join Date
    Sep 2009
    Beans
    72

    Wink Re: HOWTO: Change icon for specific file types in Gnome

    Hi all,

    Thanks for all the suggestions - especially for:

    Quote Originally Posted by woli View Post
    There is a gui for making this mimes called assogiate.
    I installed it under Lucid, and wanted to add icons for *.v (which doesn't have associated) and *.vhdl (which has standard association as a text/source file). First, I created a mimetype for *.v as 'text/source', and my icons as '/usr/share/icons/icon-verilog.png' and '/usr/share/icons/icon-vhdl.png' -- and tried to assign these as default icons via assogiate. Assogiate would show the icons in its window, but nautilus would not apply them at all (even after logout / sudo service gdm restart)!

    Then I copied these icons as ~/.icons/gnome-mime-application-x-verilog.png and ~/.icons/gnome-mime-application-x-vhdl.png and tried to assign these as default icons - still no dice!

    Finally, I changed the parent type of verilog from 'text/source' to 'Multipurpose file' - and finally (after logout) the icons DID show in nautilus - even without an explicit "default icon" link via assogiate! Did the same for the vhdl - since vhdl is already 'text/source' in standard, I simply added another mime-type, same name (x-vhdl), just under a 'Multipurpose file' parent type (so it becomes 'application/x-vhdl') - and the *.vhdl files showed the new icon in Nautilus as well (again, after logout or gdm restart).

    Thanks again to everyone for this thread,

    Cheers!

    References:



    EDIT 28 Feb: After a few reboots, I realized that VHDL icon doesn't show anymore: on right-click/Properties, Nautilus would show 'VHDL document (text/x-vhdl)' as 'Type'. Then I first made an appropriate copy of the icon:
    Code:
    cp ~/.icons/gnome-mime-application-x-vhdl.png ~/.icons/gnome-mime-text-x-vhdl.png
    ... but that, on its own, didn't seem to help..

    Then, I went to 'assogiate' (Applications/System Tools/File Types Editor), and there, opened up the 'Text and Source Code' entry for 'text/x-vhdl'; and in there, under 'Related Types' tab, I simply added the previously made 'application/x-vhdl' under 'Aliases'; as soon as that passed, icons for .vhdl files reappeared after simply refreshing the directory view in Nautilus
    Last edited by sdaau; February 28th, 2011 at 10:48 PM.

  8. #18
    Join Date
    Jul 2010
    Beans
    57

    Re: HOWTO: Change icon for specific file types in Gnome

    Changing an associated icon in Gnome is a nightmare. Pfffffff. Here's what worked for me. Notice that:
    • I use Gnome 2.30 (Ubuntu Lucid).
    • The icon theme that I use did not have "mime types" associated w/ it.

    Most methods on the internet, and in this forum (i.e. Assogiate), assume that the icon theme that you use is "complete" in the sense that it has an direcory called "mimetype" in /usr/share/icons/your_icon_theme. Mine did not. So nothing seemed to work for me.

    What worked for me in the end was:
    • Check mimetype w/ right mouse button in Nautilus (click: "properties -> type"). Example: application/pdf.
    • Create a folder called "mimetypes" in '/usr/share/icons/your_icon_theme/scalable/' if it does not exists yet.
    • Place icon in that dir. Make sure it has the right filename! Example for PDF: gnome-mime-application-pdf.svg
    • And the hat trick:
      Code:
      $ sudo gtk-update-icon-cache /usr/share/icons/my_icon_theme/
      [sudo] password for user: 
      gtk-update-icon-cache: Cache file created successfully.

    No need to re-log-in or restart Nautilus. Just click on 'Refresh' button and if you're lucky the right icon will pop up.

  9. #19
    Join Date
    Jul 2010
    Beans
    57

    Re: HOWTO: Change icon for specific file types in Gnome

    Made a little shell script that works for me. See my post above. Do you like it?

    Code:
    #!/bin/bash
    # Shell script to change the associated icon of a mimetype (= an application) in Gnome 2.30.
    # This script is writtn for Ubuntu because it uses 'sudo'.
    
    # 1. Give Theme name:
    echo "Type in the (icon) Theme name that u use in Gnome:"
    echo "   Hint: use 'gnome-appearance-properties' to determine your icon thme."
    read themename
    echo " "
    
    # Path to icons:
    location="/usr/share/icons/$themename/scalable"
    
    # 2. Give location/name of icon to copy:
    echo "Give location and name of icon to copy."
    echo "   Hint: use the command 'locate' to locate a nice icon for ya and"
    echo "   copy/paste it into this console"
    read iconname
    echo " "
    
    # 3. Give mimetype-icon name"
    echo "Type in the name that the mimetype icon should get."
    echo "   Hint: use Nautilus' file properties dialog screen to determine"
    echo "   the proper filename."
    echo "   Example: the (mime)type of a PDF file is: application/pdf."
    echo "   So the Gnome icon name of that mimetype is: gnome-mime-application-pdf.svg."
    read mimetype_iconname
    echo " "
    
    # 4. If not exist, then create folder "mimetypes""
    folder="$location/mimetypes"
    if [ -d $folder ]; then 
            echo "Not gonna create directory 'mimetypes' because it already exists. See"
    	echo "output of ls:"
    	ls $folder
    	else 
    	echo "No folder called 'mimetypes' found. Gonna create it:"
    	sudo mkdir $location/mimetypes
    	sleep 3
    fi
    
    # 5. List data:
    clear
    echo --------------------------------------------------- 
    echo "Theme name:"
    echo "   $themename"
    echo "Path to theme:"
    echo "   $location"
    echo "Name of icon to copy:"
    echo "   $iconname"
    echo "The icon name you chose for the icon:"
    echo "   $mimetype_iconname"
    echo ----------------------------------------------------
    echo " "
    echo "Press CTRL-C to abort! Else: press the Any key."
    read blabla
    
    # 6. Copy icon to theme dir.
    sudo cp $iconname $location/mimetypes/$mimetype_iconname
    
    # 7. Now update Gnome's icon database:
    sudo gtk-update-icon-cache /usr/share/icons/$themename

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •