! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Enhancement in click function
Status:
RESOLVED: FIXED
Severity:
enhancement
Product:
Xfce4-genmon-plugin
Component:
General

Comments

Description Anatoly Smaznov 2013-05-23 09:17:04 CEST
Hi!

First, BIG THANKS for such xfce plugin - I love it!

But I need some additional functions, such as:
1. Update applet on click. If I want to run attached program/script and update applet xml on applet button click, bypassing timer or maybe with timer reset.
2. Update applet from external script. For example I want run long script on click from 1 and want to update applet only after script is complete.
3. Update applet with timeout after first click. As another method for 2.

I'm not developer, and I can't write correct clean code for this enhancements. 
I think for the 1 it needs additional command for parsing in <click>-tag. For example:
<click>reset-timer</click>
will reset the timer and applet will update automatically.
Comment 1 Landry Breuil editbugs 2014-11-23 21:42:17 CET
Mass-reassign all bugs from florian@ to goodies-dev@, thanks for the maintenance work! (and sorry for the bugmail spam..)
Comment 2 James Le Cuirot 2015-01-12 00:35:10 CET
Created attachment 5857 
0001-Process-output-of-click-command.patch

Here's a suggested patch for #1. Simply resetting the timer didn't work well for me due to race conditions so I allowed the output of the click command to be processed in the same way as the timer command. Some additional configuration is probably needed around this but I thought I'd run the idea by you first.
Comment 3 Steve Dodier-Lazaro editbugs 2015-02-08 20:56:44 CET
James,

Thanks for the patch. Is there any chance that you add a checkbox labelled "Refresh on click", and set it to True by default?

The reason is we might have people who run a heavy command on e.g. a daily basis, and who might not want to accidentally run it by clicking the panel.

Also, the UI of the panel plugin could be improved in a few ways. If you're interested in contributing more patches to this plugin, feel free to come and talk to me (sidi) on IRC (#xfce-dev).

Thanks!
Comment 4 James Le Cuirot 2015-02-11 21:20:29 CET
Created attachment 5927 
Script to toggle screen blanking and DPMS

As discussed on IRC, Steve may not have fully understood the change so I'm uploading a couple of examples of how I'm using this.

The timer command isn't simply executed as usual after executing the click command. The stdout of the click action is used to refresh the state. Currently the output of the click command is ignored and bad things would happen if we suddenly started using it by default so the new UI option would need to default to "off" and would probably be called something like "Use click command output".

So the first example is a script to toggle screen blanking and DPMS. I configure genmon to execute this without any arguments. Clicking on it executes the same script again but with an argument. XML is output in either case.
Comment 5 James Le Cuirot 2015-02-11 21:21:22 CET
Created attachment 5928 
Script to toggle audio between my monitor and AV unit

This script to toggle audio between my monitor and AV unit follows the same principle.
Comment 6 James Le Cuirot 2015-02-11 21:22:37 CET
Just to clarify, you don't have to execute the same script for the click command, it was just easier to do it that way in these cases.
Comment 7 ToZ editbugs 2015-03-07 00:49:55 CET
@ James Le Cuirot, I tried out your patch and have some questions/concerns. It would seem to me that your patch is changing the genmon plugin into a toggle-like plugin. I have 2 current use-cases for genmon that get broken by the patch:

1. An update checker. I use to genmon to check for available updates. If some exist, the icon changes to indicate that updates are available. Clicking on the plugin fires up a terminal window that runs the update command. On completion, I close the window. Here, I would like to see the plugin reset itself (re-run the command). Currently, I have to right-click and select properties then okay to have it reset.

2. A modified weather applet. There are some other conditions/layouts that I prefer in my weather monitor and have created my own script to display the icon and weather conditions. Clicking on the plugin opens the weather page in my web browser. It is working fine.

After installing your patch, and clicking the icon, I find the following:
1. The text changes to XXX and the icon disappears. The tooltip remains intact. I have to right-click, properties to get it to reset.

2. The weather icon and information disappears and I get a "GLib-CRITICAL**.g_slice_set_config" error as the text output. Tooltip still works, but I cannot reset the plugin.

So to confirm, does your code now change this plugin into a toggle-like plugin? And if not, how would you script out the two use cases above to work properly with the patch?
Comment 8 James Le Cuirot 2015-03-07 10:55:38 CET
Hi ToZ. My proposed change should not break existing configuration but the reason you saw breakage is because I haven't added the checkbox to make this new feature optional yet. I believe the change would certainly benefit your first use case but you will have to rejig things a bit. If you paste your script somewhere then I will make the adjustment and also revise the patch with a checkbox.
Comment 9 ToZ editbugs 2015-03-07 14:37:57 CET
Thanks. The toggle functionality would be a useful enhancement as long as the existing functionality is not affected.

The update script I use for use case #1: https://www.dropbox.com/s/urgg0yjk447xhbu/pacinfo.tar.gz?dl=0

The weather script I use for #2: https://www.dropbox.com/s/0bn266nzaokw3kc/weather.tar.gz
Comment 10 ToZ editbugs 2018-09-06 04:34:48 CEST
@James Le Cuirot, I have implemented plugin-event for the genmon plugin a while back (https://git.xfce.org/panel-plugins/xfce4-genmon-plugin/commit/?id=76bd6d78220ca0c5af7beaa6700a271459d6806b). This will allow you to refresh the plugin and restart the timer. I believe this may meet all 3 of your use cases (the third being programatically managed in a shell script by adding a timeout there and then initiated the refresh event. More info about refreshing the plugin can be found here.

Does this meet your use cases?
Comment 11 ToZ editbugs 2018-10-27 14:45:54 CEST
Closing this report. If the plugin-event doesn't resolve your issue, please feel free to re-open.

Bug #10111

Reported by:
Anatoly Smaznov
Reported on: 2013-05-23
Last modified on: 2018-10-27

People

Assignee:
James Le Cuirot
CC List:
3 users

Version

Version:
unspecified

Attachments

0001-Process-output-of-click-command.patch (4.84 KB, patch)
2015-01-12 00:35 CET , James Le Cuirot
no flags
Script to toggle screen blanking and DPMS (537 bytes, text/plain)
2015-02-11 21:20 CET , James Le Cuirot
no flags
Script to toggle audio between my monitor and AV unit (738 bytes, text/plain)
2015-02-11 21:21 CET , James Le Cuirot
no flags

Additional information