Xfce Forum

Sub domains
 

You are not logged in.

#1 2023-01-17 00:21:25

carver6
Member
Registered: 2023-01-16
Posts: 3

Script panel launcher with multiple items.

I have a distro that boots from iso and injects files into the system post boot. So I need a script to create a panel launcher and then add multiple items to that launcher. I have been tailoring https://gist.github.com/debxp/aada42c87 … 5b9a7921da which is pretty good but it only creates a single launcher.

I have successfully written script to scrape all my config files and create a *.desktop file for each item. Script creates the folder, adds a bunch of  .desktop files to that folder, creates the launcher and then adds one item for one .desktop file. Even if I itenerate  over item --create, I only get one item in the launcher.

I cannot figure out how to run xfconf-query to append additional .desktop files or if they all have to be submitted with a single xfconf-query call. When I do through the UI, I find an xml file that lists all the launchers, including mine, and items nested underneath. When I create via script I only find the launcher and one .desktop file in the XML. They are all in the directory, just not in the XML .I need the command to nest the other .desktop files under my launcher. Ideas?

Last edited by carver6 (2023-01-17 00:44:35)

Offline

#2 2023-01-17 00:51:33

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

Re: Script panel launcher with multiple items.

Hello and welcome.

It would be helpful to know which version of Xfce and specifically xfce4-panel you are working with as functionality changes over time.

I cannot figure out how to run xfconf-query to append additional .desktop files or if they all have to be submitted with a single xfconf-query call.

Testing on xfce4-panel 4.19.0, all you need to do is drop the .desktop file into the launcher folder that was created - xfce4-panel will automatically notice the file and adjust the xfconf properties to accommodate (including adding the the application to the launcher).

I'll have to test this on earlier panel versions to see if it works that way.

If not, the xfconf property is an array property, so you would need to use something like:

xfconf-query -c xfce4-panel -p /plugins/plugin-XX/items -t string -t string -t string -s "123.desktop, 456.desktop,789.desktop"

...replace XX with the launcher ID. You could script something to create the command and then execute it.


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 2023-01-17 01:12:45

carver6
Member
Registered: 2023-01-16
Posts: 3

Re: Script panel launcher with multiple items.

Looks like its 4.12 . I have 150 items to put in that menu. Good times! May split it up.

Even with the files in the launcher folder, if I restart XFCE it still only shows the first .desktop file. I suspect adding them all in one call may be the answer as suggested. I've searched a lot of docs. Launcher no problem. Launcher items is another matter. I'll give it a shot. Thanks.

Offline

#4 2023-01-17 01:42:47

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

Re: Script panel launcher with multiple items.

You could also try to manually manipulate the xml file (if you can get it right). You need to make sure that you are not logged into Xfce, that the xfconf process isn't running, and that all the pieces in place for when the panel fires up (e.g desktop files, the new launcher plugin ID added to the list of plugins for the specific panel).


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

#5 2023-01-20 03:47:58

carver6
Member
Registered: 2023-01-16
Posts: 3

Re: Script panel launcher with multiple items.

Finally got it all hashed out. To resolve my issue it was

create_array='-t string -s VPN.desktop ' 
for i in $(ls *.desktop | grep -v "VPN"); do
  create_array="${create_array} -t string -s ${i}"
done

xfconf-query -c xfce4-panel -p /plugins/plugin-${next_plugin}/items $create_array -a --create

Or based on a simple command:

 xfconf-query -c xfce4-panel -p /plugins/plugin-XX/items -t string -s 123.desktop -t string -s 456.desktop -t string -s 789.desktop

There's a switch to append to the array but as suggested above, that does not work. Has to all be submitted in a single command. The prior command applied all desktop files under one launcher item.

*** next_plugin = launcher id

Last edited by carver6 (2023-01-20 03:52:06)

Offline

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

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.008 seconds, 8 queries executed - Memory usage: 536.63 KiB (Peak: 537.48 KiB) ]