summaryrefslogtreecommitdiff
path: root/spotify-widget
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@users.noreply.github.com>2020-09-21 20:53:22 -0400
committerGitHub <noreply@github.com>2020-09-21 20:53:22 -0400
commit31213af0082bef8344475dbeb84205f1a7e31c7d (patch)
tree2a8b4cad8363c5a0019466edf86d8ef99941d2f4 /spotify-widget
parenta127ffe8efc8ccb91b7a8495c23f67278609df25 (diff)
parent21150bd640f086f617c61b32cde5e45ecfb5158f (diff)
Merge pull request #188 from brucec5/widget-tweaks
Add customizable refresh timeouts to most widgets
Diffstat (limited to 'spotify-widget')
-rw-r--r--spotify-widget/README.md1
-rw-r--r--spotify-widget/spotify.lua5
2 files changed, 4 insertions, 2 deletions
diff --git a/spotify-widget/README.md b/spotify-widget/README.md
index e52e58f..2ae8dfc 100644
--- a/spotify-widget/README.md
+++ b/spotify-widget/README.md
@@ -33,6 +33,7 @@ It is possible to customize widget by providing a table with all or some of the
| `dim_opacity` | `0.2` | Widget's opacity when dimmed, `dim_when_paused` should be set to `true` |
| `max_length` | `15` | Maximum lentgh of artist and title names. Text will be ellipsized if longer. |
| `show_tooltip` | `true`| Show tooltip on hover with information about the playing song |
+| `timeout` | 1 | How often in seconds the widget refreshes |
### Example:
diff --git a/spotify-widget/spotify.lua b/spotify-widget/spotify.lua
index eea9b0b..abd19ef 100644
--- a/spotify-widget/spotify.lua
+++ b/spotify-widget/spotify.lua
@@ -35,6 +35,7 @@ local function worker(args)
local dim_opacity = args.dim_opacity or 0.2
local max_length = args.max_length or 15
local show_tooltip = args.show_tooltip == nil and false or args.show_tooltip
+ local timeout = args.timeout or 1
local cur_artist = ''
local cur_title = ''
@@ -106,8 +107,8 @@ local function worker(args)
end
end
- watch(GET_SPOTIFY_STATUS_CMD, 1, update_widget_icon, spotify_widget)
- watch(GET_CURRENT_SONG_CMD, 1, update_widget_text, spotify_widget)
+ watch(GET_SPOTIFY_STATUS_CMD, timeout, update_widget_icon, spotify_widget)
+ watch(GET_CURRENT_SONG_CMD, timeout, update_widget_text, spotify_widget)
--- Adds mouse controls to the widget:
-- - left click - play/pause