N
N
nihi1ist2021-01-01 07:17:49
linux
nihi1ist, 2021-01-01 07:17:49

How to assign your own Pycharm icon in Linux?

The *.desktop file has been created and the icon is displayed correctly there. But after launching the application, the icon is the one that goes by default.
There is a similar problem not only with PyCharm, but also, for example, in Valentina Studio, 1C:EDT.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
nihi1ist, 2022-01-15
@nihi1ist

Eugene TI , I was right. And that's the problem with applications written in Java. Found the solution here . You need to determine the value of the WMClass property of the problematic application. Run the following command in the console:
xprop WM_CLASS
Then click on the desired window. The command should output a line like:

WM_CLASS(STRING) = "jetbrains-pycharm-ce", "jetbrains-pycharm-ce"

At the end of the *.desktop file, add two lines:
StartupNotify=true
StartupWMClass=jetbrains-pycharm-ce # Здесь указываем первое значение полученное с помощью команды xprop WM_CLASS

And that's it, the application shortcut is attached to the application window. Result:
61e2bad8688ec836420803.png

V
Valdemar Smorman, 2021-01-01
@smorman

The *.desktop file has been created and the icon is displayed correctly there. But after launching the application, the icon is the one that goes by default

And depending on how *.desktop was created...
It should be correct like this:
echo -e '[Desktop Entry]\nEncoding=UTF-8\nName=PyCharm\nComment=PyCharm\nExec=/opt/PyCharm/bin/pycharm.sh\nIcon=/opt/PyCharm/bin/pycharm.png\nTerminal=false\nStartupNotify=true\nType=Application' | tee .local/share/applications/pycharm.desktop  > /dev/null; sudo cp .local/share/applications/pycharm.desktop /usr/share/applications/; cd /tmp; wget https://download.jetbrains.com/python/pycharm-professional-2021.3.tar.gz -O pycharm.tar.gz; sudo tar -zxf pycharm.tar.gz -C /opt; cd /opt; sudo mv pycharm-2021.3 PyCharm; sudo chown -R $USER:$USER PyCharm; cd

E
Eugene TI, 2022-01-03
@justhabrauser

Prescribing the path to the icon in *.desktop is an incorrect solution.
Any *.desktop linter will be sent by forest (desktop-file-vaidate for example).
It will be correct to copy the icon to /usr/share/pixmaps (if it is one and bitmap) and specify in *.desktop:
Icon=myicon
(no path, no extension)
Perhaps after changing *.desktop you need to update the icon cache, but this depends on the DE.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question