Issues the spotify widget for Conky

Hey guys so I've been trying to adapt the REGULUS conky theme by Khiky-Merveilles (u/Khiky73) for my High Res display (it's originally meant for a HD display) and also to make it work with Madh93's Spotify Scripts for Conky as by default REGULUS uses MPD to handle music stats. I have manage to make it work after hours of work (this is my first time working with Conky in such depth). Now when I launch launch Spofity the song title and artists's name shows up at the bottom right corner of the desktop along with the cover art of the song. And when I close spotify it disappears.

The problem I am hainvig is that the spotify stats don't show up when conky starts at system startup. When I launch spoity only the ": " symbols show up but nothing else. For some reason the external scripts aren't being executied in the execi object. But once I remove the ${if_running spotify} from my script it starts working correctly, then once I add ${if_running spotify} back in the script and resart conky it works comepltely fine as intended. I really have no clue what's going on. It would makes sense of the text to not show because the external scripts need to be executed for the text (song's title and artist's name) but then why does the cover image and spotify icon is not being displayed either, even though they not connected to the scripts.

Image indicating the issue

Does anyone know what might be causing this weird behaviour?

conky.config = {
--==============================================================================
--  2021/10/2
--  this is for conky version 1.10 or Newer
-- 
--  RegSpot - Conky theme (Based on REGULUS theme)

--  authors  : Khiky-Merveilles & Madh93 & Argus_Khan 
--  license : Distributed under the terms of GNU GPL version 3 or later
--  notes   : Created on 2048x1152 resolution.

--==============================================================================

-- Size and Position settings --
  alignment = 'top_right',
  gap_x = 0,
  gap_y = 0,
  minimum_height = 1152,
  minimum_width = 900,
  
-- Text settings --
  use_xft = true,
  font = 'Roboto:light:size=9',
  
-- Color Settings --
  default_color = 'white',
  default_outline_color = 'white',
  default_shade_color = 'white',
  color1 = '212021',
  color2 = 'FF3A70',
  color3 = '0165FE',
  
-- Window Settings --
  background = false,
  border_width = 1,
  draw_borders = false,
  draw_graph_borders = false,
  draw_outline = false,
  draw_shades = false,
  own_window = true,
  own_window_colour = '000000',
  own_window_class = 'Conky',
  own_window_argb_visual = false,
  own_window_type = 'desktop',
  own_window_transparent = true,
  own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
  stippled_borders = 0,
  
-- Others --
  cpu_avg_samples = 2,
  net_avg_samples = 2,
  double_buffer = true,
  out_to_console = false,
  out_to_stderr = false,
  extra_newline = false,
  update_interval = 1,
  uppercase = false,
  use_spacer = 'none',
  show_graph_scale = false,
  show_graph_range = false,
  lua_load = '~/.config/conky/Regulus/rings-v1.2.1.lua',
  lua_draw_hook_pre = 'ring_stats',
}

conky.text = [[
${offset 470}${voffset 0}${color}${font Bebas Neue:size=138}${time %H}${font Bebas Neue:size=0}
${offset 470}${voffset 0}${color}${font Bebas Neue:size=138}${time %M}${font Bebas Neue:size=0}
${offset 470}${voffset 30}${color}${font Bebas Neue:size=20}${time %^A}
${offset 470}${voffset 0}${color}${font Bebas Neue:size=20}${time %d / %B / %Y}${font Bebas Neue:size=0}

# --- Weather scripts --- #
${execi 50 ~/.config/conky/Regulus/scripts/weather.sh}
${execi 50 ~/.config/conky/Regulus/scripts/weather-icon.sh white3 $(cat ~/.cache/weather.json | jq -r '.weather[0].icon')}
${offset 775}${voffset -170}${color}${font Bebas Neue:size=38}${execi 50 cat ~/.cache/weather.json | jq '.main.temp' | awk '{print int($1+0.5)}'}°C${font Bebas Neue:size=0}
${offset 700}${voffset 12}${color}${font Helvetica Neue:size=12}.............
${offset 700}${voffset 0}${color2}${font Helvetica Neue:bold:size=10}${execi 50 cat ~/.cache/weather.json | jq -r '.name'}
${offset 700}${voffset 0}${color}${font Helvetica Neue:size=12}${execi 50 cat ~/.cache/weather.json | jq -r '.weather[0].description' | sed "s|\<.|\U&|g"}${font HelveticaNeue:size=1}
${offset 700}${voffset 3}${color}${font Helvetica Neue:size=10}Wind speed : ${execi 50 (cat ~/.cache/weather.json | jq '.wind.speed')}km/h
${offset 700}${voffset 0}${color}${font Helvetica Neue:size=10}Humidity : ${execi 50 (cat ~/.cache/weather.json | jq '.main.humidity')}%

# --- Network scripts --- #
${offset 700}${voffset 40}${font Material:size=10}${font Helvetica Neue:bold:size=9}: ${execi 5 ~/.config/conky/Regulus/scripts/ssid}
${offset 700}${voffset 5}${font Helvetica Neue:size=10}Downspeed : ${downspeed wlp5s0}
${offset 700}${voffset 0}${color 1EF75E}${downspeedgraph wlp5s0 35,150 1EF75E 1EF75E}
${offset 700}${voffset 0}${color}${font Helvetica Neue:size=10}Upspeed : ${upspeed wlp5s0}
${offset 700}${voffset 0}${color FF3A70}${upspeedgraph wlp5s0 35,150 FF3A70 FF3A70}

# --- Music scripts --- #

${execi 1 cd ./scripts/spotify/ ; ./cover.sh ; cd .. ; cd ..}
${color}${alignr 13}${offset -260}${voffset 300}${font Helvetica Neue:bold:size=18}${if_running spotify}${execi 1 sh ./scripts/spotify/status.sh} :${else} ${endif}
${color2}${alignr 13}${offset -220}${voffset 5}${font Bebas Neue:size=45}${if_running spotify}${execi 1 sh ./scripts/spotify/artist.sh}${else} ${endif}${font Google Sans:bold:size=2}
${color}${alignr 13}${offset -220}${voffset 5}${font Material:size=24}${if_running spotify} ${font Helvetica Neue:size=20}${execi 1 sh ./scripts/spotify/title.sh}${else} ${endif}${font Google Sans:bold:size=2}


# --- Drawing backgrounds and Icons --- #
${image ~/.config/conky/Regulus/Box1.png -s 190x190 -p 680,20}
${image ~/.config/conky/Regulus/Box.png -s 190x190 -p 680,230}
${image ~/.config/conky/Regulus/Box.png -s 190x190 -p 680,440}

${image ~/.cache/weather-icon.png -p 690,250 -s 65x65 -f 100}

# --- Drwaing Current Playing Music HUD --- #
${image ./icons/spotify-512.png -p 635,965 -s 30x30}
${image ./current/current.jpg -p 690,940 -s 185x185 -f 5}

${if_running rhythmbox}${image ./icons/headphones-3-512.png -p 635,965 -s 30x30}${else} ${endif}
${if_running rhythmbox}${image ./icons/headphones-3-512.png -p 690,940 -s 185x185 -f 1}${else} ${endif}

]]

How the theme looks like when it's working correctly:

How the theme looks when working properly

P.S. I was trying to make is so that this theme also works with Rhythmbox but I don't know how to use nested if else statements in Conky. So I've been unable to make it work. Also due to the fact that there is no way to print text vertically to an absolute position.


The scripts all seem to use dbus-send to communicate with the spotify process to retrieve the album title and so on. If this fails, you would get empty strings returned and the effect you observe. dbus-send needs to know how to connect to the dbus. Usually, this is provided in an environment variable DBUS_SESSION_BUS_ADDRESS which is set to a string such as unix:path=/run/user/1000/bus.

It may be that when you login, conky is started from an environment where this variable does not exist or has not yet been set. But when you restart conky, perhaps it is run from an environment where the variable has been set.

You could test this by displaying the variable from the .conkyrc file, e.g. with ${execi 1 echo bus is $DBUS_SESSION_BUS_ADDRESS}. A temporary fix would be to set the variable to the expected typical value before starting conky.


I managed to fix the issue, as it turned out the mistake I made was that I used relative pathing when calling the external scripts for spotify and draw calls for the images, mistakenly assuming the current working directory was the one where the main conky startup script is stored but that was not the case. The conky start up script was being executed from ~ instead of ~/.config/conky/regulus/ so it made the relative paths invalid.