linux – OpenSuse 13.2 – Sublime as default editor

Question:

I downloaded sublimeText2 for text editing and I would like to set it as default editor instead of gedit but I am not able to.

Attempts

  1. Arquivo -> abrir com -> outro aplicativo -> visualizar todas as aplicações
    however it does not appear in the listing, I believe it is because it is downloaded and run, not installed.

  2. Terminal -> su -> usr/share/applications/

    • create sublime.desktop file
    • vim defaults.list replace all gedit to sublime
  3. Terminal -> su -> usr/share/applications/

    • create sublime.desktop file
    • vim mimeinfo.cache replace all gedit to sublime

Sublime content.desktop

[ktop Entry]
Name=Sublime
Comment=Sublime text Editor
Exec=sublime_text %U
Icon=sublime-dark-icon.gif
Terminal=false
Type=Application
Encoding=UTF-8
Categories=text/editor;
MimeType=text/plain;

Question

Would anyone know to tell me what I'm doing wrong? and how to solve?

Answer:

As I told in the comments with @SneepSNinjA, I found the solution by doing some tests on .desktop in usr/share/applications/ .

I noticed that the only difference between the files:

skype.desktop

[Desktop Entry]
Name=Skype
Comment=Skype Internet Telephony
Exec=skype %U
Icon=skype.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Network;Application;
MimeType=x-scheme-handler/skype;
X-KDE-Protocols=skype

Sublime.desktop

[Desktop Entry]
Name=Sublime
Comment=Sublime text Editor
Exec=sublime_text %U
Icon=sublime-text.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=text/editor;
MimeType=text/plain;
X-KDE-Protocols=sublime

It was the lack in X-KDE-Protocols , with Skype appearing in Open with and the sublime not.

This way, after editing the file adding X-KDE-Protocols , it started to appear in Open with . Then I just set it as the default.

Update 02/27/2017

Process

  • 1st – Download it from sublime_text and extract its content.
    Let's say for /home/user/bin/sublime_text
  • 2nd – In the terminal access the folder sublime and permission +x (execution) for sublime_text .
    chmod +x /home/user/bin/sublime_text/sublime_text
  • 3rd – Create a symbolic link to /usr/bin (Note that this will affect all users, and you must have permission).
    ln -s /home/user/bin/sublime_text/sublime_text /usr/bin/sublime_text
  • 4th – Copy the Sublime Icon to /usr/share/pixmaps/ .
    cp /home/user/bin/sublime_text/Icon/128x128/sublime-text.png /usr/share/pixmaps/sublime-text.png
  • 5th – Create a .desktop in /usr/share/applications/ (As mentioned above).
    NOTE: This is only to create an icon in the menu.
  • 6th – alt+r and run command r , if it doesn't work maybe have to restart.
Scroll to Top