From 8ed6decb5e3d6f95da0263c7cf5373db92a5994c Mon Sep 17 00:00:00 2001 From: YunDanTianChang <2472041823@qq.com> Date: Thu, 9 Apr 2020 00:37:01 +0800 Subject: [PATCH 1/2] argos:when menu is close, allow disable argos button via - Signed-off-by: YunDanTianChang <2472041823@qq.com> --- argos@pew.worldwidemann.com/button.js | 3 ++- argos@pew.worldwidemann.com/utilities.js | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/argos@pew.worldwidemann.com/button.js b/argos@pew.worldwidemann.com/button.js index cd7bec2..72f5b19 100644 --- a/argos@pew.worldwidemann.com/button.js +++ b/argos@pew.worldwidemann.com/button.js @@ -30,6 +30,7 @@ var ArgosButton = new Lang.Class({ this._file = file; this._updateInterval = settings.updateInterval; + this._updateOnClose = settings.updateOnClose; this._lineView = new ArgosLineView(); this._lineView.setMarkup("" + GLib.markup_escape_text(file.get_basename(), -1) + " ..."); @@ -94,7 +95,7 @@ var ArgosButton = new Lang.Class({ this._processOutput(standardOutput.split("\n")); - if (this._updateInterval !== null) { + if (this._updateInterval !== null && (this.menu.isOpen || (!this.menu.isOpen && this._updateOnClose))) { this._updateTimeout = Mainloop.timeout_add_seconds(this._updateInterval, Lang.bind(this, function() { this._updateTimeout = null; this._update(); diff --git a/argos@pew.worldwidemann.com/utilities.js b/argos@pew.worldwidemann.com/utilities.js index 5cb795f..ba8310e 100644 --- a/argos@pew.worldwidemann.com/utilities.js +++ b/argos@pew.worldwidemann.com/utilities.js @@ -24,6 +24,7 @@ const BOXES = { function parseFilename(filename) { let settings = { updateOnOpen: false, + updateOnClose: true, updateInterval: null, position: 0, box: "right" @@ -39,6 +40,12 @@ function parseFilename(filename) { updatePart = updatePart.substring(0, updatePart.length - 1); } + if (updatePart !== null && updatePart.endsWith("-")) { + settings.updateOnClose = false; + settings.updateOnOpen = true; + updatePart = updatePart.substring(0, updatePart.length - 1); + } + if (updatePart !== null && updatePart.length >= 2) { // Attempt to parse BitBar refresh time string let number = updatePart.substring(0, updatePart.length - 1); From 9925298f336d36132e9ff0964a4d5b170aad04e4 Mon Sep 17 00:00:00 2001 From: YunDanTianChang <2472041823@qq.com> Date: Thu, 9 Apr 2020 01:03:58 +0800 Subject: [PATCH 2/2] add INTERVAL - document Signed-off-by: YunDanTianChang <2472041823@qq.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fb06d67..3236120 100644 --- a/README.md +++ b/README.md @@ -180,7 +180,7 @@ then * the dropdown menu button is placed in the panel at `POSITION`, and * the plugin is re-run and its output re-rendered every `INTERVAL`, and -* if `INTERVAL` is followed by `+`, the plugin is additionally re-run each time the dropdown menu is opened. +* if `INTERVAL` is followed by `+`, the plugin is additionally re-run each time the dropdown menu is opened. if `INTERVAL` is followed by `-`, the plugin is only run when the dropdown menu is opened. `POSITION` may be omitted entirely (in which case the button is placed before all other buttons on the right-hand side of the panel) while `INTERVAL` can be left empty. For example, a script named `plugin.10s.sh` is updated every 10 seconds, the button belonging to `plugin.1c..sh` is positioned just right of the GNOME Shell clock, and `plugin.l.1m.sh` is displayed left of the "Activities" button and updated every minute.