Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-10-02 20:10:59

jyoung
Member
Registered: 2017-08-11
Posts: 31

can a panel launcher find its own configuration file?

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

#2 2022-10-02 21:43:55

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: can a panel launcher find its own configuration file?

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

#3 2022-10-04 01:11:11

jyoung
Member
Registered: 2017-08-11
Posts: 31

Re: can a panel launcher find its own configuration file?

Thanks! I accomplishes what I was hoping for, without the need for direct introspection.

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.011 seconds, 7 queries executed - Memory usage: 524.09 KiB (Peak: 532.16 KiB) ]