Recreating PyCharm launcher in Ubuntu

Solution 1:

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..

Solution 2:

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.

Solution 3:

With Ubuntu 16.04, I used the "snap" installer, which doesn't include an easily accessible icon (there's probably one hidden inside the snap image, but it's hard to get at). Instead it shows a grey question mark icon in the launcher instead. Also there doesn't seem to be a Tools > Create Desktop Entry option in version 2017.3.3 as far as I can see - maybe it has been moved somewhere.

So I copied pycharm.png from an earlier non-snap Community installation, saved it somewhere, then created ~/.local/share/applications/jetbrains-pycharm-ce.desktop:

[Desktop Entry]
Version=1.0
Type=Application
Name=PyCharm Community Edition
Icon=/path/to/pycharm.png
Exec="/snap/bin/pycharm-community" %f
Comment=The Drive to Develop
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-pycharm-ce

Then when I start PyCharm (from the command line), the launcher item appears with the correct icon, and then I right-click on it and choose "Lock to Launcher", and it now persists.

A downside is that the icon will not be automatically updated with the app, so it might fall out of date.

Solution 4:

In case you just want to update your launcher to point to an updated PyCharm, for me changing 4.0.4 to 4.0.6 in the following worked:

nano /usr/share/applications/jetbrains-pycharm.desktop