Skip to content

Instantly share code, notes, and snippets.

@AnwarShah
Forked from thebinarypenguin/sublime-text-2.desktop
Created December 12, 2015 14:23
Show Gist options
  • Save AnwarShah/29aab7367980311cc866 to your computer and use it in GitHub Desktop.
Save AnwarShah/29aab7367980311cc866 to your computer and use it in GitHub Desktop.
A desktop application launcher for Sublime Text 3
[Desktop Entry]
Type=Application
Terminal=false
StartupNotify=true
Name=Sublime Text 3
Name[en_US]=Sublime Text 3
GenericName=Text Editor
GenericName[en_US]=Text Editor
Comment=Edit text files
Comment[en_US]=Edit text files
Exec=/opt/sublime_text/sublime_text %U
Icon=/opt/sublime_text/Icon/128x128/sublime-text.png
Categories=Development;TextEditor;
MimeType=text/plain;
Actions=Window;
[Desktop Action Window]
Name=Open a New Window
Name[en_US]=Open a New Window
Exec=/opt/sublime_text/sublime_text --new-window %U
OnlyShowIn=Unity;
@AnwarShah
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

Create ~/.local/share/applications/defaults.list if it doesn't already exist
Open /usr/share/applications/defaults.list and copy the appropriate mime type lines into ~/.local/share/applications/defaults.list
Edit the lines to point to sublime-text-3.desktop
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

Credit

The original file was for sublime-text-2 from this gist https://gist.github.com/thebinarypenguin/2963829

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