ubuntu-mate / mate-dock-applet

application dock for the MATE panel
GNU General Public License v3.0
125 stars 34 forks source link

Pycharm icon not appeared (seems like it's problem with *.desktop file parsing?) #107

Closed alex4321 closed 5 years ago

alex4321 commented 7 years ago

I use Pycharm IDE. But IDE icon not appeared. So when I attached debugger to applet process I see next in console (after opening of new project):

Traceback (most recent call last):
  File "/home/user/PycharmProjects/mate-dock-applet/src/dock.py", line 1949, in window_opened
    got_desktop = dock_app.setup_from_wnck(wnck_app, wnck_class, self.app_match)
  File "/home/user/PycharmProjects/mate-dock-applet/src/docked_app.py", line 530, in setup_from_wnck
    return self.read_info_from_desktop_file()
  File "/home/user/PycharmProjects/mate-dock-applet/src/docked_app.py", line 1038, in read_info_from_desktop_file
    self.desktop_ai = Gio.DesktopAppInfo.new_from_filename(self.desktop_file)
TypeError: constructor returned NULL

So I tryed to reproduce problem manually:

from gi.repository import Gio
Gio.DesktopAppInfo.new_from_filename("/home/user/.local/share/applications/jetbrains-pycharm.desktop")

And I see exception:

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2862, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-11-cfa338e27866>", line 1, in <module>
    Gio.DesktopAppInfo.new_from_filename("/home/user/.local/share/applications/jetbrains-pycharm.desktop")
TypeError: constructor returned NULL

There content of /home/user/.local/share/applications/jetbrains-pycharm.desktop

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Name=PyCharm
Icon=/home/user/bin/pycharm-2017.2/bin/pycharm.png
Exec=exec "/home/user/bin/signal-reset" "/home/user/bin/pycharm-2017.2/bin/pycharm.sh" %f
Comment=The Drive to Develop
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-pycharm
alex4321 commented 7 years ago

I found problem. It's related to "exec" parsing:

Exec=exec "/home/user/bin/signal-reset" "/home/user/bin/pycharm-2017.2/bin/pycharm.sh" %f

e.g. I moved this command to "$HOME/bin/pycharm"

and set

Exec="/home/user/bin/pycharm"

So now icon appeared correctly.

But maybe it'll be good idea to add workaround for similar cased - some MATE elements succesfully process this *.desktop file (e.g. it showed in menu), instead of Gio.DesktopAppInfo

robint99 commented 5 years ago

Closed due to age. Also, introduction on Bamf in V0.81 very likely fixed this.