Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: HowTo Change Default GNOME Text Editor or Any Other Default Program

  1. #1
    Join Date
    Mar 2005
    Beans
    Hidden!

    HowTo Change Default GNOME Text Editor or Any Other Default Program

    How-To Change Default Text Editor (or any other default program)

    The following step-by-step guide will make the program Scribes open every plain text document instead of Gedit. Instead of Scribes, you may use any other program.

    Check if this file exists:
    Code:
    ~/.local/share/applications/defaults.list
    If so, open it, if not:
    Code:
    touch ~/.local/share/applications/defaults.list
    Open ~/.local/share/applications/defaults.list and look for this entry:
    Code:
    [Default Applications]
    If it does not exist, add it on top. Next, add the following below "[Default Applications]":
    Code:
    text/plain=scribes.desktop
    Your completed entry should look like this:
    Code:
    [Default Applications]
    text/plain=scribes.desktop
    Now run:
    Code:
    pkill nautilus
    It is possible to set any mime type and any program that has a *.desktop entry. Find out your favorite program's desktop entry by looking in this folder:
    Code:
    /usr/share/applications/
    You need to know what mime type you want to have your new program open. text/plain means opening up any normal text file. If you would like Scribes to open ANY text file, you would substitute text/plain with text/* and follow everything else.

    Why is this better than just right-click on file -> Open With? Because with the above, ALL plain text files will be opened by Scribes, not just ones that have a particular extension.

    For more details on what programs are used for what mime types, see file:
    /usr/share/applications/defaults.list
    One easy way to replace a program like gedit would be to get all entries containing gedit, replace them with scribes, and add that list to ~/.local/share/applications/defaults.list.

    This quit one-liner does exactly that, except that it posts the results in terminal and you will just have to copy/paste it into your file:
    Code:
     grep gedit /usr/share/applications/defaults.list | sed s/gedit/scribes/g
    Last edited by AgenT; November 14th, 2006 at 09:18 PM.
    STOP!
    Before you sign up to Dropbox, click here to read my post showing you how to get an additional 500mb free! That's 2.5GB of free space!

  2. #2
    Join Date
    Sep 2007
    Beans
    6
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: HowTo Change Default GNOME Text Editor or Any Other Default Program

    Hey, thanks for this!

  3. #3
    Join Date
    Oct 2007
    Location
    Redmond, WA (USA)
    Beans
    11
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Exclamation Re: HowTo Change Default GNOME Text Editor or Any Other Default Program

    Could you please explain as to how to make Geany the default editor for just PHP files (NOT text files)? Currently it is defaulted to "Gedit".

    I can't figure out what the mimetype should be?
    Here is what I have currently, but they don't work:

    $ cat ~/.local/share/applications/defaults.list
    [Default Applications]
    application/x-httpd-php=geany.desktop
    application/x-php=geany.desktop
    text/x-php=geany.desktop

    $ grep php /usr/share/applications/defaults.list
    $

    $ grep gedit /usr/share/applications/defaults.list
    application/x-perl=gedit.desktop
    text/plain=gedit.desktop
    text/x-chdr=gedit.desktop
    text/x-csrc=gedit.desktop
    text/x-dtd=gedit.desktop
    text/x-java=gedit.desktop
    text/mathml=gedit.desktop
    text/x-python=gedit.desktop
    text/x-sql=gedit.desktop

    it doesn't list PHP there at all
    Last edited by DAE51D; January 8th, 2009 at 01:04 AM.

  4. #4
    Join Date
    Mar 2007
    Location
    Kansas
    Beans
    19
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: HowTo Change Default GNOME Text Editor or Any Other Default Program

    I, too, would be very interested in making Geany the default program to handle PHP files.

  5. #5
    Join Date
    Dec 2005
    Location
    Hickory N.C. U.S.A.
    Beans
    98
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: HowTo Change Default GNOME Text Editor or Any Other Default Program

    I want Gmail to be my default as opposed to Evolution. I followed your instruction and:


    Code:

    grep gedit /usr/share/applications/defaults.list | sed s/gedit/scribes/g

    I got the following:

    application/x-perl=Evolution.desktop
    text/plain=Evolution.desktop
    text/x-chdr=Evolution.desktop
    text/x-csrc=Evolution.desktop
    text/x-dtd=Evolution.desktop
    text/x-java=Evolution.desktop
    text/mathml=Evolution.desktop
    text/x-python=Evolution.desktop
    text/x-sql=Evolution.desktop

    I tried:


    Code:

    /usr/share/applications/

    and got:

    bash: /usr/share/applications/: is a directory

    no help there, would the substition of Gmail for Evolution on my list work?

  6. #6
    Join Date
    Apr 2005
    Location
    NJ
    Beans
    6
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: HowTo Change Default GNOME Text Editor or Any Other Default Program

    How-To Change Default Text Editor (or any other default program)

    The following step-by-step guide will make the program Scribes open every plain text document instead of Gedit. Instead of Scribes, you may use any other program.
    How about something like:

    Navigate to /usr/share/applications in Nautilis.
    Scroll down to Text Editor.
    Right-click Text Editor, select Properties.
    Change the command line to your application. (in my case, medit)

    EnjoY!

    Mindless Automaton
    Last edited by Mindless Automaton; June 17th, 2009 at 05:47 AM.

  7. #7
    Join Date
    Apr 2005
    Location
    NJ
    Beans
    6
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: HowTo Change Default GNOME Text Editor or Any Other Default Program

    Quote Originally Posted by traffas View Post
    I, too, would be very interested in making Geany the default program to handle PHP files.
    Does this do what you would like?

    In Nautilus, find a php file.
    Right-click the php file and select properties.
    Select the Open With tab.
    Left-click Add button.
    Find Geany or set custom command to launch Geany.

    Thanks!

    Mindless Automaton

  8. #8
    Join Date
    Sep 2007
    Beans
    13

    Talking Re: HowTo Change Default GNOME Text Editor or Any Other Default Program

    So far all of above changes the behaviour for one user. I wanted to set smplayer as system wide multimedia player instead of totem. I did this to get the desired effect:

    Code:
    sudo perl -pi.old -e 's/^([^=]+)=totem\.desktop/$1=smplayer.desktop/' /usr/share/applications/defaults.list
    To only change for video files one can do this:
    Code:
    sudo perl -pi.old -e 's/^(video[^=]+)=totem\.desktop/$1=smplayer.desktop/' /usr/share/applications/defaults.list
    make sure the file smplayer.desktop (or watherver you use or change from/to) exists under /usr/share/applications/.

  9. #9
    Join Date
    Nov 2005
    Location
    Nürnberg, Deutschland
    Beans
    21
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: HowTo Change Default GNOME Text Editor or Any Other Default Program

    Quote Originally Posted by AgenT View Post
    How-To Change Default Text Editor (or any other default program)
    There is another way to do this. It is a somewhat clumsy way but it works. As it needs a longer explanation, I have written an article about this:

    How to change file associations on Ubuntu

    (Tested with Ubuntu 10.10 Maverick Meerkat)

  10. #10
    Join Date
    Jan 2006
    Beans
    53

    Re: HowTo Change Default GNOME Text Editor or Any Other Default Program

    For Ubuntu 10.10 I found this simple solution to make geany your default text editor.

    -In GNome menu Right Click and press Edit Menus
    -Go to Accessories, Text Editor and press properties
    -Change the command tou geany

    Now all documents open with geany instead of gedit

    Nikos

Page 1 of 2 12 LastLast

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
  •