<commit_before>local wibox = require("wibox")
local awful = require("awful")

spotify_widget = wibox.widget.textbox()
spotify_widget:set_font('Play 9')

function updateSpotifyWidget(widget)
    awful.spawn.easy_async([[bash -c 'sp current-oneline']],
    function(stdout, stderr, reason, exit_code)
        widget:set_text(stdout)
    end)
end

spotify_timer = timer ({timeout = 10})
spotify_timer:connect_signal ("timeout", function() updateSpotifyWidget(spotify_widget) end) 
spotify_timer:start()

spotify_timer:emit_signal("timeout")
<commit_msg>use widget.watch<commit_after>local wibox = require("wibox")
local awful = require("awful")
local watch = require("awful.widget.watch")

spotify_widget = wibox.widget.textbox()
spotify_widget:set_font('Play 9')

-- optional icon, could be replaced by spotfiy logo (https://developer.spotify.com/design/)
spotify_icon = wibox.widget.imagebox()
spotify_icon:set_image("/usr/share/icons/Arc-Icons/places/symbolic/folder-music-symbolic.svg")

watch(
    "sp current-oneline", 1,
    function(widget, stdout, stderr, exitreason, exitcode)
        spotify_widget:set_text(stdout)
    end
)

{'fraction_non_alphanumeric': 0.13227513227513227, 'fraction_numerical': 0.004409171075837742, 'mean_word_length': 5.878787878787879, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7032808', 'n_tokens_mistral': 397, 'n_tokens_neox': 387, 'n_words': 71}