summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Makhov <pmakhov@touchtunes.com>2018-10-05 11:21:57 -0400
committerPavel Makhov <pmakhov@touchtunes.com>2018-10-05 11:21:57 -0400
commit5e522350b61453a11a37fc83314948c35a2cdeee (patch)
treea4a5f1e34779a4d77cda1097815a60a32a3e1efa
parentd185af3b87c17d9afd5602930e3128ba22ab6835 (diff)
small refactoring
-rw-r--r--spotify-widget/spotify.lua14
1 files changed, 4 insertions, 10 deletions
diff --git a/spotify-widget/spotify.lua b/spotify-widget/spotify.lua
index ee5217b..c6f2188 100644
--- a/spotify-widget/spotify.lua
+++ b/spotify-widget/spotify.lua
@@ -28,11 +28,9 @@ local spotify_widget = wibox.widget {
},
layout = wibox.layout.align.horizontal,
set_status = function(self, is_playing)
- if (is_playing) then
- self.icon.image = PATH_TO_ICONS .. "/actions/24/player_play.png"
- else
- self.icon.image = PATH_TO_ICONS .. "/actions/24/player_pause.png"
- end
+ self.icon.image = PATH_TO_ICONS ..
+ (is_playing and "/actions/24/player_play.png"
+ or "/actions/24/player_pause.png")
end,
set_text = function(self, path)
self.current_song.markup = path
@@ -41,11 +39,7 @@ local spotify_widget = wibox.widget {
local update_widget_icon = function(widget, stdout, _, _, _)
stdout = string.gsub(stdout, "\n", "")
- if (stdout == 'Playing') then
- widget:set_status(true)
- else
- widget:set_status(false)
- end
+ widget:set_status(stdout == 'Playing' and true or false)
end
local update_widget_text = function(widget, stdout, _, _, _)