Is there a way to launch a commandline application with a desktop icon and have the terminal window be linked to the application icon?

Hello.

I have installed Cmus from Flathub. Since it’s a commandline application, clicking on its icon launches it in Gnome Console, which is fine, but the window is also assigned to the Gnome Console icon in the app menu. Is there a way to instead have it assigned to the Cmus icon?

I am using the X11 session.

the corresponding .desktop files (“launcher”) is likely

/var/lib/flatpak/app/io.github.cmus.cmus/current/active/files/share/applications/io.github.cmus.cmus.desktop

Open it and define the icon you would like to use for the launcher

Sorry, I worded my question poorly. I don’t want to change the application icon. I want to “link” a window to a different “launcher”. Is this even possible in Gnome? I know you can add StartupWMClass to the .desktop file, but I’m not sure that would help in this case.

Only GUI apps have an icon.

I do not think you can change the icon of a terminal windows based on the CLI tool running in it.

I made me a bash menu script to launch proton-cli.

For this I had to make a .desktop File to call a bash script … I do not know if you mean this …
For the Proton Menu I could set a separate Icon In the .desktop file as already mentioned above.

cat proton.desktop 
[Desktop Entry]
Type=Application
Name=Proton VPN Free
Icon=/usr/share/icons/Adwaita/scalable/places/network-server.svg
Exec=gnome-terminal --command /home/ilikelinux/bin/protonmenu --geometry=38x11+1-1
StartupNotify=false
Categories=
X-Desktop-File-Install-Version=0.26
Comment=* Proton VPN Free *