P
P
protasovmikhail2022-02-20 17:06:47
User interface
protasovmikhail, 2022-02-20 17:06:47

How to attach a new window to a favorite icon on the panel when launching a program through ubuntu .desktop file?

Standard label:

[Desktop Entry]
Version=1.0
Name=name
Exec=python /file/to/path
Icon=file/to/path
Type=Application
Terminal=false
Categories=Utility;Development;
Name[ru_RU]=имя.desktop


I wrote a program using PyQt5. Now, at startup, a new window opens (and without an icon, although setWindowIcon is set) with a new shortcut next to the selected shortcut on the panel. How do I attach it to a favorite icon?

62124ac69390e804697563.png

I can not correctly formulate the question for Google. Please tell me the solution or the manual

UPD - THERE IS A SOLUTION, but I did not set the answer, I explained why in the decision.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
nihi1ist, 2022-02-23
@nihi1ist

Try like this. It is necessary to add the parameter to the *.desktop file StartupWMClass=. You can get the value for this parameter using the utility xprop. In the console, run the command:
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"

As a result, in *.desktop you should get a line like this, but with its own value:
StartupWMClass=jetbrains-pycharm-ce

P
protasovmikhail, 2022-02-24
@protasovmikhail

In general, what I did:
earlier the program was in the same folder in .local/dir and launched through a shortcut, where - Exec=python3 filepath
now it is "as it should be", in folders, etc, usr/bin , usr/share .. and it just starts - Exec=program_name
inside the script #!/usr/bin/python3
and installed via dpkg , I made a .deb (I don't know if this somehow affects my question) the
line ""StartupWMClass=" , I added, although now it works without it. xproc gives out - "program_name", "program_name"
62173c1d32150608433589.png
Thank you, everyone who responded. I will not put the solution, because I do not understand why everything turned out.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question