diff options
-rw-r--r-- | battery-widget/battery.lua | 2 | ||||
-rw-r--r-- | spotify-widget/spotify.lua | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/battery-widget/battery.lua b/battery-widget/battery.lua index ed44d5c..452d7ef 100644 --- a/battery-widget/battery.lua +++ b/battery-widget/battery.lua @@ -157,7 +157,7 @@ local function worker(user_args) level_widget.text = string.format('%d%%', charge) end - if (charge >= 0 and charge < 15) then + if (charge >= 1 and charge < 15) then batteryType = "battery-empty%s-symbolic" if enable_battery_warning and status ~= 'Charging' and os.difftime(os.time(), last_battery_check) > 300 then -- if 5 minutes have elapsed since the last warning diff --git a/spotify-widget/spotify.lua b/spotify-widget/spotify.lua index 0eb302a..f8df1ea 100644 --- a/spotify-widget/spotify.lua +++ b/spotify-widget/spotify.lua @@ -16,6 +16,10 @@ local GET_SPOTIFY_STATUS_CMD = 'sp status' local GET_CURRENT_SONG_CMD = 'sp current' local function ellipsize(text, length) + -- utf8 only available in Lua 5.3+ + if utf8 == nil then + return text:sub(0, length) + end return (utf8.len(text) > length and length > 0) and text:sub(0, utf8.offset(text, length - 2) - 1) .. '...' or text @@ -154,4 +158,4 @@ end return setmetatable(spotify_widget, { __call = function(_, ...) return worker(...) -end })
\ No newline at end of file +end }) |