Can i change the icon of the launcher dynamically when i press on it?(xfce)

I've made launcher for a command , and i fixed it on panel , i want to make the icon of it get changing when i press on it, to indicate the command is running.
i notice the network icon has that feature, when it disconnects his icon is changed or composite with yellow or red mark.

A launcher icon does not have the ability to have a dynamic icon.

The network plugin is an indicator plugin, not a launcher.

To create what you want; you would need to write some code for creating a panel indicator.

1 Like

If you have access to the code of the app you are attempting this for, you could change the onClick method so that the icon is changed. Without this, maybe a bash/python script to monitor processes for that app. Once detected, you could modify the .desktop file and reload the desktop.

This is an awful lot of trouble for a customized icon indicating an application running.

Ask the Developers of the application to implement an indicator icon for the system tray or integrate your idea into the app.

1 Like

the app is cortile, it doesn't have gui window to show it's icon on the panel which show or indicate the running app, it run in background for making tiling. so i make launcher for it to run it.
I thought it is easy to customizing icon of the launcher to indicate the app is running, but launcher icon doesn't has any option for dynamically change or i hope if it is highlight during running or when i press it.
i found there are alot of other ways to indicate the app is running like using notify command or by echo message when the app run or stop.
but i want ways that show or echo the state or show icon on the panel, i searched about that , i found plugin xfce4-genmon ,which allow to echo or print the result of command on the panel, and i found it also allow to echo icon.
Peek 2023-12-28 01-54

1 Like

If it echos icon, can you have an alternate .desktop file that the echo points to (mainly for the icon change).

Since you have been speaking of XFCE, I am under the impression you are running Zorin Lite?

This may be of some use for you. If you setup the .desktop file in ~/Desktop, it will have one icon. In the ~/.local/share/applications/ place a copy of the .desktop file with the other icon. Pin the app to the taskbar. Hide the .desktop from your Desktop.

My thinking: The Desktop version would be what is pinned to the panel, and will show one icon. When clicked, the .local directory will be accessed and override the Desktop icon. This could possibly work as the .local directory overrides the desktop directory, though I don't know when this takes place.

linux - Add a changing icon to Ubuntu Panel - Stack Overflow has both a bash script and python script, monitoring for an executable, that will allow you to modify the icon according to state. These both will need you to modify the scripts for your needs.

1 Like

I'm using zorin lite xfce,display the icon on it depend on launcher plugin that can fix on the panel with it's default icon or u can change the icon of the app,if the app has gui window, when click on the launcher of it ,it show the default icon of the app separately on the panel using the built-in one which is window button plugin it has certain mechanism on display the icon on the panel not similar to anther plugin it's name is docklike(i think it depend on .desktop, ~/.local/share/applications/ it has problem with panel(he can't not recognize the icons executable apps) , also i'm talking about app not have gui window so no window button for it.
genmon plugin in xfce allow displaying the result of command in field on the panel.
i used it to indicate the state by query command(if app is run echo icon.png if not echo " "
here i used it to indicate it's running

Instead of the empty string, change it to the other idle icon.

I didn't realize you could use a conditional with that.

1 Like
if pgrep -f "/home/eid/cortile" > /dev/null; then
  echo "<icon>preferences-color</icon>"
else
  echo ""
fi

image

Yeah, add the alternate icon here.

The first would be while in use (it's sending the output to null, so nothing is printed on screen). The else would be when it's not active.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.