You are not logged in.
Hi,
I've setup a panel launcher to run a bash script so that I can run the script with one click. I set this up by creating a launcher, adding an item, and then editing the item's command and icon. This might not be the simplest setup, but it works well.
But, I would be great if if the script had a way of knowing it's panel configuration file. This is useful because I want the script to change its own panel icon, to indicate that it's been run (or is running). As of now, I have to edit the script to contain the path
.config/xfce4/panel/launcher-13/16647407293.desktop
Which is fine, but is there a way that a program launched from a panel launcher could introspect and determine it's own configuration file? Maybe a system variable that's set when the application is executed from within a panel launcher?
Offline
You could search for the launcher desktop file using, for example, the Name field. Assume that your launcher is named MyLaunch:
grep -Fri "Name=MyLaunch" ~/.config/xfce4/panel/ | awk -F':' '{print $1}'
....will return the file path and name of the launcher desktop file
You can then change the icon with an inplace sed edit:
sed -i 's/Icon=.*/Icon=gtk-edit/' FILENAME
Combining the two together into a one-liner:
sed -i 's/Icon=.*/Icon=gtk-edit/' $(grep -Fri "Name=MyLaunch" ~/.config/xfce4/panel/ | awk -F':' '{print $1}')
..."gtk-edit" being the name of the new icon.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Thanks! I accomplishes what I was hoping for, without the need for direct introspection.
Offline
[ Generated in 0.011 seconds, 7 queries executed - Memory usage: 524.09 KiB (Peak: 532.16 KiB) ]