diff options
| author | Romanos Skiadas <rom.skiad@gmail.com> | 2021-10-15 18:34:09 +0300 | 
|---|---|---|
| committer | Romanos Skiadas <rom.skiad@gmail.com> | 2021-10-15 18:34:09 +0300 | 
| commit | 567b5bb84fb0a572c30d72b09b3db195ca06a6bf (patch) | |
| tree | 80eff4218c53fd48105c59cf88a2b87eb70e7aa3 | |
| parent | aacbf61fac0e0a52ddd641699c373745de547c9f (diff) | |
mpris-widget: make play/pause icon work
The middle part of mpris_widget was meant to be a play/pause icon. It
only displayed a circle, as an unrelated widget that was not shown was
set up and modified according to the play state. Delete the invisible
widget, add the icon where it should be.
| -rw-r--r-- | mpris-widget/init.lua | 34 | 
1 files changed, 7 insertions, 27 deletions
diff --git a/mpris-widget/init.lua b/mpris-widget/init.lua index 0398951..74bb74e 100644 --- a/mpris-widget/init.lua +++ b/mpris-widget/init.lua @@ -28,12 +28,19 @@ local LIBRARY_ICON_NAME = PATH_TO_ICONS .. "/actions/24/music-library.png"  local default_player = '' +local icon = wibox.widget { +    id = "icon", +    widget = wibox.widget.imagebox, +    image = PLAY_ICON_NAME +} +  local mpris_widget = wibox.widget{      {          id = 'artist',          widget = wibox.widget.textbox      },      { +        icon,          max_value = 1,          value = 0,          thickness = 2, @@ -130,29 +137,6 @@ local function worker()      -- retrieve song info      local current_song, artist, player_status, art, artUrl -    local icon = wibox.widget { -        id = "icon", -        widget = wibox.widget.imagebox, -        image = PLAY_ICON_NAME -    } -    local mirrored_icon = wibox.container.mirror(icon, {horizontal = true}) - -    local mpdarc = wibox.widget { -        mirrored_icon, -        -- max_value = 1, -        -- value = 0, -        thickness = 2, -        start_angle = 4.71238898, -- 2pi*3/4 -        forced_height = 24, -        forced_width = 24, -        rounded_edge = true, -        bg = "#ffffff11", -        paddings = 0, -        widget = wibox.container.arcchart -    } - -    local mpdarc_icon_widget = wibox.container.mirror(mpdarc, {horizontal = true}) -      local update_graphic = function(widget, stdout, _, _, _)          local words = {}          for w in stdout:gmatch("([^;]*);") do table.insert(words, w) end @@ -170,21 +154,17 @@ local function worker()          if art ~= nil then artUrl = string.sub(art, 8, -1) end          if player_status == "Playing" then -            mpdarc_icon_widget.visible = true              icon.image = PLAY_ICON_NAME              widget.colors = {beautiful.widget_main_color}              widget:set_text(artist, current_song)          elseif player_status == "Paused" then -            mpdarc_icon_widget.visible = true              icon.image = PAUSE_ICON_NAME              widget.colors = {beautiful.widget_main_color}              widget:set_text(artist, current_song)          elseif player_status == "Stopped" then -            mpdarc_icon_widget.visible = true              icon.image = STOP_ICON_NAME          else -- no player is running              icon.image = LIBRARY_ICON_NAME -            mpdarc_icon_widget.visible = false              widget.colors = {beautiful.widget_red}          end      end  | 
