summaryrefslogtreecommitdiff
path: root/spotify-widget
diff options
context:
space:
mode:
authorpmakhov <pavel.makhov@savoirfairelinux.com>2017-12-02 13:50:14 -0500
committerpmakhov <pavel.makhov@savoirfairelinux.com>2017-12-02 13:50:14 -0500
commitbec18633e67513363265e79e28358e5089f3e85c (patch)
tree96c78d965427516cb70e21f8a820d1c663552918 /spotify-widget
parent8b4c5e7fa0799e9cd06c9969ff017024b92b097b (diff)
use dbus to check is spotify is playing
Diffstat (limited to 'spotify-widget')
-rw-r--r--spotify-widget/README.md9
-rw-r--r--spotify-widget/spotify.lua7
-rwxr-xr-xspotify-widget/spotify_stat2
3 files changed, 4 insertions, 14 deletions
diff --git a/spotify-widget/README.md b/spotify-widget/README.md
index df84927..547c9eb 100644
--- a/spotify-widget/README.md
+++ b/spotify-widget/README.md
@@ -15,8 +15,6 @@ This widget displays currently playing song on [Spotify for Linux](https://www.s
Note that widget uses the Arc icon theme, so it should be [installed](https://github.com/horst3180/arc-icon-theme#installation) first under **/usr/share/icons/Arc/** folder.
-Also this widget uses the output of the **spotify_stat** script which could be found in the widget folder.
-
## Installation
First you need to have spotify CLI installed. Here is how you can do it (except widget part): [pavelmakhov.com/2016/02/awesome-wm-spotify](http://pavelmakhov.com/2016/02/awesome-wm-spotify)
@@ -33,10 +31,3 @@ s.mytasklist, -- Middle widget
spotify_widget,
...
```
-
-## Troubleshooting
-
-_Status icon (play/pause) is not shown_:
- - make **spotify_stat** script executable (by `sudo chmod +x spotify_stat`) and run it in terminal, output should be either `RUNNING` or `CORKED`;
- - the **spotify_stat** script is called by **spotify.lua** so make sure that `get_spotify_status_cmd` in **spotify.lua** contains the right path to the script;
- - create an issue :octocat:.
diff --git a/spotify-widget/spotify.lua b/spotify-widget/spotify.lua
index 4ecce79..be3225c 100644
--- a/spotify-widget/spotify.lua
+++ b/spotify-widget/spotify.lua
@@ -2,7 +2,8 @@ local awful = require("awful")
local wibox = require("wibox")
local watch = require("awful.widget.watch")
-local GET_SPOTIFY_STATUS_CMD = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/spotify-widget/spotify_stat'
+-- local GET_SPOTIFY_STATUS_CMD = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/spotify-widget/spotify_stat'
+local GET_SPOTIFY_STATUS_CMD = 'sp status'
local GET_CURRENT_SONG_CMD = 'sp current-oneline'
local PATH_TO_ICONS = "/usr/share/icons/Arc"
@@ -27,9 +28,9 @@ spotify_widget = wibox.widget {
local update_widget_icon = function(widget, stdout, _, _, _)
stdout = string.gsub(stdout, "\n", "")
- if (stdout == 'RUNNING') then
+ if (stdout == 'Playing') then
widget:set_image(PATH_TO_ICONS .. "/actions/24/player_play.png")
- elseif (stdout == "CORKED") then
+ elseif (stdout == "Paused") then
widget:set_image(PATH_TO_ICONS .. "/actions/24/player_pause.png")
else
widget:set_image(nil)
diff --git a/spotify-widget/spotify_stat b/spotify-widget/spotify_stat
deleted file mode 100755
index b4d4783..0000000
--- a/spotify-widget/spotify_stat
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-pacmd list-sink-inputs | grep -e 'state:' -e 'application.name' | grep -B 1 -i spotify | grep -P -o '(?<=: )[A-Za-z]*'