From cd162c9a1734e448514f16e0037d949bfafe3c84 Mon Sep 17 00:00:00 2001 From: Christopher Crockett Date: Wed, 13 Jul 2022 14:03:53 -0400 Subject: Added sp_bin option to spotify-widget Allows specifying a custom location for the sp binary via widget config. This is intended for users who don't want to add the sp binary to their system PATH. --- spotify-widget/spotify.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'spotify-widget') diff --git a/spotify-widget/spotify.lua b/spotify-widget/spotify.lua index f8df1ea..85ea6b4 100644 --- a/spotify-widget/spotify.lua +++ b/spotify-widget/spotify.lua @@ -12,9 +12,6 @@ local awful = require("awful") local wibox = require("wibox") local watch = require("awful.widget.watch") -local GET_SPOTIFY_STATUS_CMD = 'sp status' -local GET_CURRENT_SONG_CMD = 'sp current' - local function ellipsize(text, length) -- utf8 only available in Lua 5.3+ if utf8 == nil then @@ -39,6 +36,10 @@ local function worker(user_args) local max_length = args.max_length or 15 local show_tooltip = args.show_tooltip == nil and true or args.show_tooltip local timeout = args.timeout or 1 + local sp_bin = args.sp_bin or 'sp' + + local GET_SPOTIFY_STATUS_CMD = sp_bin .. ' status' + local GET_CURRENT_SONG_CMD = sp_bin .. ' current' local cur_artist = '' local cur_title = '' -- cgit v1.2.3 From 5d50fe7fab8dcfcf649bafdcd4197219b76bc0b9 Mon Sep 17 00:00:00 2001 From: Christopher Crockett Date: Wed, 13 Jul 2022 14:08:17 -0400 Subject: Document new sp_bin option for spotify-widget --- spotify-widget/README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'spotify-widget') diff --git a/spotify-widget/README.md b/spotify-widget/README.md index 3d18559..3a7b8d7 100644 --- a/spotify-widget/README.md +++ b/spotify-widget/README.md @@ -34,6 +34,7 @@ It is possible to customize widget by providing a table with all or some of the | `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 | +| `sp_bin` | `sp` | Path to the `sp` binary. Required if `sp` is not in environment PATH. | ### Example: @@ -46,7 +47,8 @@ spotify_widget({ dim_when_paused = true, dim_opacity = 0.5, max_length = -1, - show_tooltip = false + show_tooltip = false, + sp_bin = gears.filesystem.get_configuration_dir() .. 'scripts/sp' }) ``` @@ -66,7 +68,10 @@ First you need to have spotify CLI installed, it uses dbus to communicate with s git clone https://gist.github.com/fa6258f3ff7b17747ee3.git cd ./fa6258f3ff7b17747ee3 chmod +x sp +# This widget will work by default if the binary is in the system PATH sudo cp ./sp /usr/local/bin/ +# Alternatively, you may save the binary anywhere and supply the path via this widget's sp_bin argument: +# cp ./sp ~/.config/awesome/scripts/ ``` Then clone repo under **~/.config/awesome/** and add widget in **rc.lua**: -- cgit v1.2.3