Xfce Forum

Sub domains
 

You are not logged in.

#1 2024-02-27 05:40:50

zeynep
Member
Registered: 2024-02-15
Posts: 5

Delay after adding a new plugin

Hello guys, I'm trying to add new plugin and get difference between old xfce4-panel.xml and the new one. I'm doing these things from bash script. Let's say I'm adding genmon plugin with xfconf-query after that I copy my custom .rc file to where it belongs and I restart the panel. But the problem is after restarting the xfce4-panel.xml file does not change immediately even though I see changes on my panel. So when I go for difference it looks like nothings change for a while. So what do you think ?

Offline

#2 2024-02-27 18:45:25

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

Re: Delay after adding a new plugin

Hello and welcome.

I'm doing these things from bash script.

It might be helpul to share either the whole script or at least the relevant parts.

Let's say I'm adding genmon plugin with xfconf-query after that I copy my custom .rc file to where it belongs and I restart the panel.

You must be using an older version of genmon if you are still using rc files (it has been migrated to xfconf). What version of xfce4-panel and the genmon plugin?

But the problem is after restarting the xfce4-panel.xml file does not change immediately even though I see changes on my panel.

When you restart the panel, it will first save its state potentially overwriting any changes you make to xml files. xfconfd might also interfere it its running. In addition, if you manually adding a plugin to the panel, you need to create two xfconf entries - one for the plugin and the second to update the list of plugins for the panel. The best way to update the xml files is while you are not logged in and the xfconfd process is not running.

It would be interesting to see your code to see exactly what you are doing.


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 2024-02-28 20:46:42

zeynep
Member
Registered: 2024-02-15
Posts: 5

Re: Delay after adding a new plugin

#!/bin/bash

xfconf-query -c xfce4-panel -p "/plugins/plugin-4" -t string -s 'genmon'

xfce4-panel -r

DIFF=$(diff  ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml ~/default_panel.xml | grep '^<' | cut -c 3-)

something like that. but when I run this diff is empty (there is no change in config file) even though I see some shanges on my panel.

Offline

#4 2024-02-28 23:20:46

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

Re: Delay after adding a new plugin

/plugins/plugin-4

...where does the "4" come from? Is this an arbitrary number? Is this a new plugin that you are adding to the panel (if so, you also need to add it to the /panels/panel-X/plugin-ids array (where X is the number of the plugin), plus you need to properly format that command to "create" a new plugin.

Does the script generate any errors if you run it manually?

Also:

xfce4-panel -V

...and the version of the genmon plugin you are using.


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 2024-02-29 12:27:13

zeynep
Member
Registered: 2024-02-15
Posts: 5

Re: Delay after adding a new plugin

Output: xfce4-panel 4.16.3 (Xfce 4.16)
First of all I want to control the plugin id so 4 is not arbitrary. Actually there is already a fourth plugin on my first panel I just changed the plugin type. So I can get output like this : <property name="plugin-4" type="string" value="genmon"/>  My main purpose is to get this output.
Btw I don't want to add plugin and then change the list because when I do that xfce opens a dialog and ask me which panel I want to add. I don't want to see that when I run my code. This is why I used xfconf-query in the first place.
Second my code works properly but I run line by line from command line to debug. And the delay issue doesn't happen. I see changes immediately So what do you think ?
Additionally I don't know how to see my genmon plugin version.

Offline

#6 2024-02-29 12:35:13

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

Re: Delay after adding a new plugin

zeynep wrote:

Second my code works properly but I run line by line from command line to debug. And the delay issue doesn't happen. I see changes immediately So what do you think ?

Perhaps its just a timing thing then. Try adding sleep commands between the lines to give them time to complete before you execute the next line, to see if that fixes the issue. Something like:

#!/bin/bash

xfconf-query -c xfce4-panel -p "/plugins/plugin-4" -t string -s 'genmon'
sleep 1s
xfce4-panel -r

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

#7 2024-02-29 12:46:46

zeynep
Member
Registered: 2024-02-15
Posts: 5

Re: Delay after adding a new plugin

Unfortunately adding sleep does not work for my situation I tried before.

Offline

#8 2024-02-29 16:00:24

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

Re: Delay after adding a new plugin

I don't understand how "running the script line by line" works, but automating it, including sleep commands, doesn't. How exactly are you running it line by line? Are you just going through the script one line at a time and typing it in a terminal window?

And have you tried increasing the sleep amounts just to be sure?


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

#9 2024-02-29 18:33:54

zeynep
Member
Registered: 2024-02-15
Posts: 5

Re: Delay after adding a new plugin

I wrote my code lines one by one like I write first one and after first one is done I did second and go on. Btw you were right I increase sleep amount and it is worked. But I have two question know
1- Why we can not see difference immediately even though see the changes on panel ? I thought the xfconf-query just changes config file and then panel changes. Something is happening behind the process ?
2- what should I give as a sleep amount so I can get a result for every device?

Offline

#10 2024-02-29 22:40:36

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

Re: Delay after adding a new plugin

In a more recent version, the genmon plugin has migrated to storing all of its settings in xfconf, so the process should be much better. I'm not sure I know why the delay exists, perhaps it takes time to read the new configuration file. For the time being, perhaps the sleep delay is the best approach.


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

Registered users online in this topic: 0, guests: 2
[Bot] CCBot

Board footer

Powered by FluxBB
Modified by Visman

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