User avatar
nuverb
Posts: 2
Joined: Tue May 14, 2019 12:57 pm
Contact: Website

How to change panel/taskbar icon for running program

Tue May 14, 2019 1:36 pm

I have written a program in C++ and created a desktop shortcut to start it. I also assigned an icon to the shortcut.
However, when I run the program, the icon that appears on the panel/taskbar to represent the running program is a plain window.
My panel/taskbar is on the right hand side and the icon is at the bottom, like this: Image

How do I change the panel/taskbar icon to match the one in my desktop shortcut?

Thank You
Louie Cordovado
Nuverb Systems Inc - "Software Tailored for You!"

User avatar
nuverb
Posts: 2
Joined: Tue May 14, 2019 12:57 pm
Contact: Website

Re: How to change panel/taskbar icon for running program

Fri May 17, 2019 8:07 pm

I found the answer to my own question. I am using GTKmm (with C++) and there is a function to set the icon for when a program is minimized. In the main window's constructor you put this:
MainWindow::MainWindow()
{
if(!set_icon_from_file("icon.png") info_box("Can't find taskbar icon");
}

Instead of icon.png put the path name to your icon.
info_box() is a function to display a message using MessageDialog

If someone is writing a Python program there may be similar function.
Louie Cordovado
Nuverb Systems Inc - "Software Tailored for You!"

Andyroo
Posts: 2827
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: How to change panel/taskbar icon for running program

Fri May 17, 2019 8:58 pm

I get the feeling that the run-time icon is due to your app icon not being in a theme.

I think (and have no desktop Pi handy) if the icon is put in /usr/share/icons (possibly /hicolor/48x48/apps/ under that) you should get the same icon when running. At least in your way you can change it depending on program status :)
Need Pi spray - these things are breeding in my house...

Return to “Raspbian”