Skip to content

Instantly share code, notes, and snippets.

@thebinarypenguin
Created June 21, 2012 04:26
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thebinarypenguin/2963829 to your computer and use it in GitHub Desktop.
Save thebinarypenguin/2963829 to your computer and use it in GitHub Desktop.
A desktop application launcher for Sublime Text 2
[Desktop Entry]
Type=Application
Terminal=false
StartupNotify=true
Name=Sublime Text 2
Name[en_US]=Sublime Text 2
GenericName=Text Editor
GenericName[en_US]=Text Editor
Comment=Edit text files
Comment[en_US]=Edit text files
Exec=/PATH/TO/EXECUTABLE %U
Icon=/PATH/TO/ICON
Categories=Development;TextEditor;
MimeType=text/plain;
Actions=Window;
[Desktop Action Window]
Name=Open a New Window
Name[en_US]=Open a New Window
Exec=/PATH/TO/EXECUTABLE --new-window %U
OnlyShowIn=Unity;
@thebinarypenguin
Copy link
Author

Notes

  • This file should be saved in ~/.local/share/applications/ or /usr/share/applications/
  • Documentation for the .desktop file format can be found here http://standards.freedesktop.org/desktop-entry-spec/latest/
  • If you're using GNOME Shell you probably want to include the --new-window flag in both Exec lines

Setting as default text editor

  1. Create ~/.local/share/applications/defaults.list if it doesn't already exist
  2. Open /usr/share/applications/defaults.list and copy the appropriate mime type lines into ~/.local/share/applications/defaults.list
  3. Edit the lines to point to sublime-text-2.desktop
  4. It should look like this
[Default Applications]
application/x-perl=sublime-text-2.desktop
text/plain=sublime-text-2.desktop
text/x-chdr=sublime-text-2.desktop
text/x-csrc=sublime-text-2.desktop
text/x-dtd=sublime-text-2.desktop
text/x-java=sublime-text-2.desktop
text/mathml=sublime-text-2.desktop
text/x-python=sublime-text-2.desktop
text/x-sql=sublime-text-2.desktop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment