Home Download Buy Blog Forum Support

Launching Sublime from Unity

Launching Sublime from Unity

Postby rchl on Thu Oct 20, 2011 4:36 pm

When I open Sublime it shows in Unity launcher. If I right click and select "Keep in launcher" it will indeed stay there after closing Sublime but clicking "pinned" icon won't start sublime. The icon will blink for a while and then stop.

Ubuntu 11.10.
rchl
 
Posts: 148
Joined: Fri Mar 04, 2011 11:02 pm

Re: Launching Sublime from Unity

Postby nobleach on Fri Oct 21, 2011 3:24 pm

The best way to do this, is to create your own custom launcher for Sublime. Make sure you have a sublime.desktop file in ~/.local/share/applications (You can also put it in /usr/share/applications if you want it to be available to all users on the box, but you'll need root privileges to do so.) Here's a copy of mine:

Code: Select all
[Desktop Entry]
Name=Sublime Text Editor
Comment=Sublime Text Editor
Exec="/home/jim/bin/Sublime Text 2/sublime_text" %F
MimeType=text/plain;
Terminal=false
Type=Application
Icon=/home/jim/Pictures/sublime-64px.png
Categories=GNOME;GTK;Utility;TextEditor;Development;Utility;


Keep in mind that you'll need to know the path to the executable and the path to the icon that you want to use.
nobleach
 
Posts: 48
Joined: Thu Jun 23, 2011 4:14 pm

Re: Launching Sublime from Unity

Postby rchl on Fri Oct 21, 2011 3:44 pm

Very nice to know, thank you.

But can this process be made less painful by default? I guess we would need Jon to publish packages instead (or in addition) to just zip files.
rchl
 
Posts: 148
Joined: Fri Mar 04, 2011 11:02 pm

Re: Launching Sublime from Unity

Postby utotwel on Sun Oct 23, 2011 5:16 am

You can install it via this PPA: http://www.webupd8.org/2011/03/sublime- ... u-ppa.html

Once you do that you will be able to pin it in Unity.
utotwel
 
Posts: 19
Joined: Fri Dec 31, 2010 4:46 am

Re: Launching Sublime from Unity

Postby nobleach on Mon Oct 24, 2011 4:49 pm

rchl wrote:Very nice to know, thank you.

But can this process be made less painful by default? I guess we would need Jon to publish packages instead (or in addition) to just zip files.


I've actually symlinked /usr/bin/sublime to my local bin folder/sublime executable. This way, I just delete the entire folder and unTar the new one every time a release is made. This won't affect the symlink or the pinned icon on my Unity or Gnome3 menu.

There has been quite a bit of yelling on the Oneric forums about Unity and Gnome's decision to make this process harder. (I've spoken out a few times against it too... it's like creating a PIF file back in Windows 3.1 days... not exactly a step forward)

Otherwise, the suggestion above to use the PPA should work just fine for you.
nobleach
 
Posts: 48
Joined: Thu Jun 23, 2011 4:14 pm

Re: Launching Sublime from Unity

Postby ekolguy on Wed Feb 22, 2012 2:08 pm

Here's my version:

Code: Select all
[Desktop Entry]
Type=Application
Terminal=false
Name=Sublime Text 2
StartupNotify=true
GenericName=Text Editor
Comment=Edit text files
Exec=/path_to/st2/sublime_text %U
MimeType=text/plain;text/x-chdr;text/x-csrc;text/x-c++hdr;text/x-c++src;text/x-java;text/x-dsrc;text/x-pascal;text/x-perl;text/x-python;application/x-php;application/x-httpd-php3;application/x-httpd-php4;application/x-httpd-php5;application/xml;text/html;text/css;text/x-sql;text/x-diff;x-directory/normal;inode/directory;
Categories=GNOME;GTK;Utility;TextEditor;Application;Development;
Icon=emacs #don't like the default icon
Name[en_US]=Sublime Text 2
X-Ayatana-Desktop-Shortcuts=NewWindow;

[NewWindow Shortcut Group]
Name=New Editor Window
Exec=/path_to/st2/sublime_text --new-window
TargetEnvironment=Unity


Save this code as Sublime Text.desktop under ~/.local/share/applications and drag that file to Unity dock.
Now that the launcher is there, you can actually drag and drop files and folders (yes, folders too) onto the icon. You can also right click and open a new window:

lunapic_132991910089948_4.png
lunapic_132991910089948_4.png (29.65 KiB) Viewed 19133 times
lunapic_132991910089948_1.png
lunapic_132991910089948_1.png (60.41 KiB) Viewed 19132 times

Hope this gets included by default some day. /cc @jon
ekolguy
 
Posts: 41
Joined: Thu Dec 17, 2009 8:50 am

Re: Launching Sublime from Unity

Postby Wikorask on Wed Mar 07, 2012 10:54 am

I guess we would need Jon to publish packages instead (or in addition) to just zip files.
Wikorask
 
Posts: 3
Joined: Wed Mar 07, 2012 10:43 am

Re: Launching Sublime from Unity

Postby adambrenecki on Tue Mar 27, 2012 12:42 am

Wikorask wrote:I guess we would need Jon to publish packages instead (or in addition) to just zip files.

Not necessarily. He could still just distribute a zip file, but add the .desktop file to it, along with perhaps a short install.sh or something to put the appropriate files in the right places.
adambrenecki
 
Posts: 1
Joined: Tue Mar 27, 2012 12:37 am

Re: Launching Sublime from Unity

Postby TinyClanger on Thu Feb 14, 2013 4:31 pm

ekolguy wrote:Here's my version:

Code: Select all
[Desktop Entry]
Type=Application
Terminal=false
Name=Sublime Text 2
StartupNotify=true
GenericName=Text Editor
Comment=Edit text files
Exec=/path_to/st2/sublime_text %U
MimeType=text/plain;text/x-chdr;text/x-csrc;text/x-c++hdr;text/x-c++src;text/x-java;text/x-dsrc;text/x-pascal;text/x-perl;text/x-python;application/x-php;application/x-httpd-php3;application/x-httpd-php4;application/x-httpd-php5;application/xml;text/html;text/css;text/x-sql;text/x-diff;x-directory/normal;inode/directory;
Categories=GNOME;GTK;Utility;TextEditor;Application;Development;
Icon=emacs #don't like the default icon
Name[en_US]=Sublime Text 2
X-Ayatana-Desktop-Shortcuts=NewWindow;

[NewWindow Shortcut Group]
Name=New Editor Window
Exec=/path_to/st2/sublime_text --new-window
TargetEnvironment=Unity



The [NewWindow Shortcut Group] section doesn't work under 12.04, though I think the reference to Ayatana Desktop is probably a clue. This worked for me:

Code: Select all
[Desktop Entry]
Name=Sublime Text 2
Exec="/opt/Sublime Text 2/sublime_text" %F
MimeType=text/plain;
Terminal=false
Type=Application
Icon=sublime_text
Categories=GNOME;GTK;Utility;TextEditor;Development;
Actions=New;

[Desktop Action New]
Name=New Editor Window
Exec="/opt/Sublime Text 2/sublime_text" --new-window
MimeType=text/plain;
OnlyShowIn=Unity;
TinyClanger
 
Posts: 9
Joined: Sun Jan 27, 2013 12:01 pm

Re: Launching Sublime from Unity

Postby Dygear on Fri Feb 15, 2013 11:27 pm

ekolguy wrote:Here's my version:


Do you mind if I include this in my patch for the Sublime Text Unoffical Documentation?

I plan on also including this

Code: Select all
tar vxjf Sublime\ Text\ 2.0.1.tar.bz2 -C /opt/
sudo ln -s /opt/Sublime\ Text\ 2/sublime_text /usr/bin/sublime


---

Code: Select all
http://c758482.r82.cf2.rackcdn.com/Sublime Text 2.0.1.tar.bz2
http://c758482.r82.cf2.rackcdn.com/Sublime Text 2.0.1 x64.tar.bz2

The one sticking point that I'm having is that the URL to get the latest version is very ugly and changes on each new version. Having like a 302 redirect to the real current version in it's CDN location would greatly help. Something like:

Code: Select all
http://www.sublimetext.com/latest386.tar.bz2
http://www.sublimetext.com/latestx64.tar.bz2


Would be awesome.
Dygear
 
Posts: 6
Joined: Fri Feb 15, 2013 11:05 pm


Return to General Discussion

Who is online

Users browsing this forum: macula and 15 guests