Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recreating PyCharm launcher in Ubuntu

I installed pycharm normally via bin/pycharm.sh, but the mistake I made was doing bash pycharm.sh while the pycharm directory has inside the Downloads folder.

I later on moved the directory to /opt/Pycharm/. This is causing the once functioning unity launcher (which was added when PyCharm was initially installed) to fail every time I attempt to use it (as expected).

How can I re-add pycharm.sh as a lauchable app from the unity launcher? I know the location of the pycharm.sh file. I've tried to add it to /usr/bin/ but that does not change anything.

I can still launch pycharm via bash /usr/opt/Pycharm/bin/Pycharm.sh. But this is tedious.

UPDATE

I have tried making a new .desktop file for pycharm, using the following script:

[Desktop Entry] Encoding=UTF-8 Name=PyCharm Exec=/opt/Pycharm-3.0.1/bin/pycharm.sh Icon=/opt/Pycharm-3.0.1/bin/PyCharm_32.png Type=Application Categories=Development; StartupWMClass=PyCharm 

However, I get a "Unable to save Pycharm.desktop" error when I try to save the file inside /usr/share/applications/pycharm.desktop. Any help regarding this would be deeply appreciated.

like image 781
Games Brainiac Avatar asked Nov 02 '13 04:11

Games Brainiac


People also ask

How do I get the PyCharm icon in Linux?

Open up PyCharm to the Welcome to PyCharm screen (you may have to exit your project if it loads instead) then click on configure at the bottom (gear icon), and select the dropdown for "Create Desktop Entry" there instead. This is the answer I needed. Thank you!


2 Answers

First start pyCharm from it's bin folder via command line

$ ./pycharm.sh

Then, goto

Tools -> Create Desktop Entry.

It will create a correct Desktop file in the correct place. Afterward you can initiate it from the menu and pin the icon or drag and drop it to the bar. This way, you don't have to deal with .desktop files and mumbo jumbo..

like image 95
Shan Valleru Avatar answered Sep 17 '22 15:09

Shan Valleru


I managed to solve it. The thing is, Pycharm already installs a launcher inside .local/share/applications. Thus, you need to get rid of it before proceeding to create your own. After that, all you have to do is add your own *.desktop file to the applications directory inside usr/share/applications/.

You need to create your .desktop file using sudo and inside the desktop file:

[Desktop Entry] Encoding=UTF-8 Name=PyCharm Exec=/opt/pycharm-3.0.1/bin/pycharm.sh Icon=/opt/pycharm-3.0.1/bin/pyCharm.png  # Changed from pycharm_32.png Type=Application Categories=Development; StartupWMClass=PyCharm 

After that is done, you can launch your app properly. Please note that pycharm.sh must also have execution rights.

like image 27
Games Brainiac Avatar answered Sep 21 '22 15:09

Games Brainiac