From 8be78d4fddfc2c88352b25f5d8d89c6dc14df37c Mon Sep 17 00:00:00 2001 From: streetturtle Date: Wed, 2 Dec 2020 09:18:16 -0500 Subject: fix few issues --- weather-widget/weather.lua | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'weather-widget') diff --git a/weather-widget/weather.lua b/weather-widget/weather.lua index 0317746..681e122 100644 --- a/weather-widget/weather.lua +++ b/weather-widget/weather.lua @@ -27,7 +27,6 @@ end local weather_widget = {} local warning_shown = false -local notification local tooltip = awful.tooltip { mode = 'outside', preferred_positions = {'bottom'} @@ -115,9 +114,9 @@ local function uvi_index_color(uvi) return '' .. uvi .. '' end -local function worker(args) +local function worker(user_args) - local args = args or {} + local args = user_args or {} --- Validate required parameters if args.coordinates == nil or args.api_key == nil then @@ -384,7 +383,7 @@ local function worker(args) hourly_forecast_negative_graph:set_max_value(math.abs(min_temp)) hourly_forecast_negative_graph:set_min_value(max_temp < 0 and math.abs(max_temp) * 0.7 or 0) - for i, value in ipairs(values) do + for _, value in ipairs(values) do if value >= 0 then hourly_forecast_graph:add_value(value) hourly_forecast_negative_graph:add_value(0) @@ -470,12 +469,9 @@ local function worker(args) local function update_widget(widget, stdout, stderr) if stderr ~= '' then if not warning_shown then - if ( - stderr ~= 'curl: (52) Empty reply from server' and - stderr ~= 'curl: (28) Failed to connect to api.openweathermap.org port 443: Connection timed out' and - stderr:find( - '^curl: %(18%) transfer closed with %d+ bytes remaining to read$' - ) ~= nil + if (stderr ~= 'curl: (52) Empty reply from server' + and stderr ~= 'curl: (28) Failed to connect to api.openweathermap.org port 443: Connection timed out' + and stderr:find('^curl: %(18%) transfer closed with %d+ bytes remaining to read$') ~= nil ) then show_warning(stderr) end -- cgit v1.2.3 From d9eb3885eea90e06b79ff8fc4b2d1c1b8f5e4cfd Mon Sep 17 00:00:00 2001 From: streetturtle Date: Wed, 2 Dec 2020 09:24:05 -0500 Subject: trigger build action on a branch --- bitbucket-widget/bitbucket.lua | 44 ++++++++++++++++++---------------- cpu-widget/cpu-widget.lua | 13 ++++++---- jira-widget/jira.lua | 12 +++++----- run-shell-3/run-shell.lua | 2 +- spotify-widget/spotify.lua | 7 +++--- stackoverflow-widget/stackoverflow.lua | 14 ++++++----- todo-widget/todo.lua | 10 ++++---- translate-widget/translate.lua | 13 ++++++---- volume-widget/volume.lua | 18 +++++++++----- volumearc-widget/volumearc.lua | 6 ++--- volumebar-widget/volumebar.lua | 6 ++--- weather-widget/weather.lua | 18 ++++++++------ 12 files changed, 92 insertions(+), 71 deletions(-) (limited to 'weather-widget') diff --git a/bitbucket-widget/bitbucket.lua b/bitbucket-widget/bitbucket.lua index 8d47f2f..b85e653 100644 --- a/bitbucket-widget/bitbucket.lua +++ b/bitbucket-widget/bitbucket.lua @@ -21,7 +21,12 @@ local gfs = require("gears.filesystem") local HOME_DIR = os.getenv("HOME") local WIDGET_DIR = HOME_DIR .. '/.config/awesome/awesome-wm-widgets/bitbucket-widget/' -local GET_PRS_CMD= [[bash -c "curl -s --show-error -n '%s/2.0/repositories/%s/%s/pullrequests?fields=values.participants.approved,values.title,values.links.html,values.author.display_name,values.author.uuid,values.author.links.avatar,values.source.branch,values.destination.branch,values.comment_count,values.created_on&q=reviewers.uuid+%%3D+%%22%s%%22+AND+state+%%3D+%%22OPEN%%22' | jq '.[] '"]] +local GET_PRS_CMD= [[bash -c "curl -s --show-error -n ]] + .. [['%s/2.0/repositories/%s/%s/pullrequests]] + .. [[?fields=values.participants.approved,values.title,values.links.html,values.author.display_name,]] + .. [[values.author.uuid,values.author.links.avatar,values.source.branch,values.destination.branch,]] + .. [[values.comment_count,values.created_on&q=reviewers.uuid+%%3D+%%22%s%%22+AND+state+%%3D+%%22OPEN%%22']] + .. [[ | jq '.[] '"]] local DOWNLOAD_AVATAR_CMD = [[bash -c "curl -L -n --create-dirs -o %s/.cache/awmw/bitbucket-widget/avatars/%s %s"]] local bitbucket_widget = wibox.widget { @@ -71,7 +76,7 @@ local popup = awful.popup{ --- Converts string representation of date (2020-06-02T11:25:27Z) to date local function parse_date(date_str) local pattern = "(%d+)%-(%d+)%-(%d+)T(%d+):(%d+):(%d+)%Z" - local y, m, d, h, min, sec, mil = date_str:match(pattern) + local y, m, d, h, min, sec, _ = date_str:match(pattern) return os.time{year = y, month = m, day = d, hour = h, min = min, sec = sec} end @@ -111,9 +116,9 @@ local function count_approves(participants) return res end -local function worker(args) +local function worker(user_args) - local args = args or {} + local args = user_args or {} local icon = args.icon or WIDGET_DIR .. '/bitbucket-icon-gradient-blue.svg' local host = args.host or show_warning('Bitbucket host is not set') @@ -279,11 +284,8 @@ local function worker(args) } if not gfs.file_readable(path_to_avatar) then - spawn.easy_async(string.format( - DOWNLOAD_AVATAR_CMD, - HOME_DIR, - pr.author.uuid, - pr.author.links.avatar.href), function() row:get_children_by_id('avatar')[1]:set_image(path_to_avatar) end) + local cmd = string.format(DOWNLOAD_AVATAR_CMD, HOME_DIR, pr.author.uuid, pr.author.links.avatar.href) + spawn.easy_async(cmd, function() row:get_children_by_id('avatar')[1]:set_image(path_to_avatar) end) end @@ -299,34 +301,36 @@ local function worker(args) ) ) row:get_children_by_id('avatar')[1]:buttons( - awful.util.table.join( - awful.button({}, 1, function() - spawn.with_shell(string.format('xdg-open "https://bitbucket.org/%s/%s/pull-requests?state=OPEN&author=%s"', workspace, repo_slug, pr.author.uuid)) - popup.visible = false - end) - ) + awful.util.table.join( + awful.button({}, 1, function() + spawn.with_shell( + string.format('xdg-open "https://bitbucket.org/%s/%s/pull-requests?state=OPEN&author=%s"', + workspace, repo_slug, pr.author.uuid) + ) + popup.visible = false + end) + ) ) local old_cursor, old_wibox - row:get_children_by_id('title')[1]:connect_signal("mouse::enter", function(c) + row:get_children_by_id('title')[1]:connect_signal("mouse::enter", function() local wb = mouse.current_wibox old_cursor, old_wibox = wb.cursor, wb wb.cursor = "hand1" end) - row:get_children_by_id('title')[1]:connect_signal("mouse::leave", function(c) + row:get_children_by_id('title')[1]:connect_signal("mouse::leave", function() if old_wibox then old_wibox.cursor = old_cursor old_wibox = nil end end) - local old_cursor, old_wibox - row:get_children_by_id('avatar')[1]:connect_signal("mouse::enter", function(c) + row:get_children_by_id('avatar')[1]:connect_signal("mouse::enter", function() local wb = mouse.current_wibox old_cursor, old_wibox = wb.cursor, wb wb.cursor = "hand1" end) - row:get_children_by_id('avatar')[1]:connect_signal("mouse::leave", function(c) + row:get_children_by_id('avatar')[1]:connect_signal("mouse::leave", function() if old_wibox then old_wibox.cursor = old_cursor old_wibox = nil diff --git a/cpu-widget/cpu-widget.lua b/cpu-widget/cpu-widget.lua index 54547ae..f58f960 100644 --- a/cpu-widget/cpu-widget.lua +++ b/cpu-widget/cpu-widget.lua @@ -14,6 +14,9 @@ local wibox = require("wibox") local beautiful = require("beautiful") local gears = require("gears") +local CMD = [[sh -c "grep '^cpu.' /proc/stat; ps -eo '%p|%c|%C|' -o "%mem" -o '|%a' --sort=-%cpu ]] + .. [[| head -11 | tail -n +2"]] + local HOME_DIR = os.getenv("HOME") local WIDGET_DIR = HOME_DIR .. '/.config/awesome/awesome-wm-widgets/cpu-widget' @@ -86,9 +89,9 @@ local function create_kill_process_button() } end -local function worker(args) +local function worker(user_args) - local args = args or {} + local args = user_args or {} local width = args.width or 50 local step_width = args.step_width or 2 @@ -120,8 +123,8 @@ local function worker(args) } -- Do not update process rows when mouse cursor is over the widget - popup:connect_signal("mouse::enter", function(c) is_update = false end) - popup:connect_signal("mouse::leave", function(c) is_update = true end) + popup:connect_signal("mouse::enter", function() is_update = false end) + popup:connect_signal("mouse::leave", function() is_update = true end) cpugraph_widget:buttons( awful.util.table.join( @@ -139,7 +142,7 @@ local function worker(args) local cpu_widget = wibox.container.margin(wibox.container.mirror(cpugraph_widget, { horizontal = true }), 0, 0, 0, 2) local cpus = {} - watch([[sh -c "grep '^cpu.' /proc/stat; ps -eo '%p|%c|%C|' -o "%mem" -o '|%a' --sort=-%cpu | head -11 | tail -n +2"]], timeout, + watch(CMD, timeout, function(widget, stdout) local i = 1 local j = 1 diff --git a/jira-widget/jira.lua b/jira-widget/jira.lua index 7f0ceb6..9a89a0d 100644 --- a/jira-widget/jira.lua +++ b/jira-widget/jira.lua @@ -17,12 +17,12 @@ local naughty = require("naughty") local gears = require("gears") local beautiful = require("beautiful") local gfs = require("gears.filesystem") -local gs = require("gears.string") local color = require("gears.color") local HOME_DIR = os.getenv("HOME") -local GET_ISSUES_CMD = [[bash -c "curl -s --show-error -X GET -n '%s/rest/api/2/search?%s&fields=id,assignee,summary,status'"]] +local GET_ISSUES_CMD = + [[bash -c "curl -s --show-error -X GET -n '%s/rest/api/2/search?%s&fields=id,assignee,summary,status'"]] local DOWNLOAD_AVATAR_CMD = [[bash -c "curl -n --create-dirs -o %s/.cache/awmw/jira-widget/avatars/%s %s"]] local function show_warning(message) @@ -41,7 +41,7 @@ local jira_widget = wibox.widget { }, { id = 'd', - draw = function(self, context, cr, width, height) + draw = function(_, _, cr, _, height) cr:set_source(color(beautiful.fg_urgent)) cr:arc(height/4, height/4, height/4, 0, math.pi*2) cr:fill() @@ -100,9 +100,9 @@ local tooltip = awful.tooltip { preferred_positions = {'bottom'}, } -local function worker(args) +local function worker(user_args) - local args = args or {} + local args = user_args or {} local icon = args.icon or HOME_DIR .. '/.config/awesome/awesome-wm-widgets/jira-widget/jira-mark-gradient-blue.svg' local host = args.host or show_warning('Jira host is unknown') @@ -149,7 +149,7 @@ local function worker(args) for i = 0, #rows do rows[i]=nil end for _, issue in ipairs(result.issues) do - local path_to_avatar = os.getenv("HOME") ..'/.cache/awmw/jira-widget/avatars/' .. issue.fields.assignee.accountId + local path_to_avatar = HOME_DIR ..'/.cache/awmw/jira-widget/avatars/' .. issue.fields.assignee.accountId if not gfs.file_readable(path_to_avatar) then spawn.easy_async(string.format( diff --git a/run-shell-3/run-shell.lua b/run-shell-3/run-shell.lua index 9bd575b..51feaf4 100644 --- a/run-shell-3/run-shell.lua +++ b/run-shell-3/run-shell.lua @@ -89,7 +89,7 @@ function widget.new() local w = self._cached_wiboxes[s][1] local rnd = math.random() awful.spawn.with_line_callback(string.format(self._cmd_blur, tostring(awful.screen.focused().geometry.x), rnd), { - stdout = function(line) + stdout = function() w.visible = true w.bgimage = '/tmp/i3lock-' .. rnd ..'.png' awful.placement.top(w, { margins = { top = 20 }, parent = awful.screen.focused() }) diff --git a/spotify-widget/spotify.lua b/spotify-widget/spotify.lua index fb903e8..bd2309f 100644 --- a/spotify-widget/spotify.lua +++ b/spotify-widget/spotify.lua @@ -11,7 +11,6 @@ local awful = require("awful") local wibox = require("wibox") local watch = require("awful.widget.watch") -local naughty = require("naughty") local GET_SPOTIFY_STATUS_CMD = 'sp status' local GET_CURRENT_SONG_CMD = 'sp current' @@ -24,9 +23,9 @@ end local spotify_widget = {} -local function worker(args) +local function worker(user_args) - local args = args or {} + local args = user_args or {} local play_icon = args.play_icon or '/usr/share/icons/Arc/actions/24/player_play.png' local pause_icon = args.pause_icon or '/usr/share/icons/Arc/actions/24/player_pause.png' @@ -100,7 +99,7 @@ local function worker(args) end local escaped = string.gsub(stdout, "&", '&') - local album, album_artist, artist, title = + local album, _, artist, title = string.match(escaped, 'Album%s*(.*)\nAlbumArtist%s*(.*)\nArtist%s*(.*)\nTitle%s*(.*)\n') if album ~= nil and title ~=nil and artist ~= nil then diff --git a/stackoverflow-widget/stackoverflow.lua b/stackoverflow-widget/stackoverflow.lua index af89105..15d2837 100644 --- a/stackoverflow-widget/stackoverflow.lua +++ b/stackoverflow-widget/stackoverflow.lua @@ -18,13 +18,15 @@ local beautiful = require("beautiful") local HOME_DIR = os.getenv("HOME") -local GET_QUESTIONS_CMD = [[bash -c "curl --compressed -s -X GET 'http://api.stackexchange.com/2.2/questions/no-answers?page=1&pagesize=%s&order=desc&sort=activity&tagged=%s&site=stackoverflow'"]] +local GET_QUESTIONS_CMD = [[bash -c "curl --compressed -s -X GET]] + .. [[ 'http://api.stackexchange.com/2.2/questions/no-answers]] + .. [[?page=1&pagesize=%s&order=desc&sort=activity&tagged=%s&site=stackoverflow'"]] local stackoverflow_widget = {} -local function worker(args) +local function worker(user_args) - local args = args or {} + local args = user_args or {} local icon = args.icon or HOME_DIR .. '/.config/awesome/awesome-wm-widgets/stackoverflow-widget/so-icon.svg' local limit = args.limit or 5 @@ -43,7 +45,7 @@ local function worker(args) border_width = 1, border_color = beautiful.bg_focus, maximum_width = 400, - preferred_positions = top, + preferred_positions = 'top', offset = { y = 5 }, widget = {} } @@ -63,7 +65,7 @@ local function worker(args) end, } - local update_widget = function(widget, stdout, stderr, _, _) + local update_widget = function(_, stdout, _, _, _) local result = json.decode(stdout) @@ -91,7 +93,7 @@ local function worker(args) widget = wibox.container.background } - row:connect_signal("button::release", function(_, _, _, button) + row:connect_signal("button::release", function() spawn.with_shell("xdg-open " .. item.link) popup.visible = false end) diff --git a/todo-widget/todo.lua b/todo-widget/todo.lua index ecbb464..14e3dc2 100644 --- a/todo-widget/todo.lua +++ b/todo-widget/todo.lua @@ -11,7 +11,6 @@ local awful = require("awful") local wibox = require("wibox") local json = require("json") local spawn = require("awful.spawn") -local naughty = require("naughty") local gears = require("gears") local beautiful = require("beautiful") local gfs = require("gears.filesystem") @@ -126,9 +125,9 @@ end) add_button:connect_signal("mouse::enter", function(c) c:set_bg(beautiful.bg_focus) end) add_button:connect_signal("mouse::leave", function(c) c:set_bg(beautiful.bg_normal) end) -local function worker(args) +local function worker(user_args) - local args = args or {} + local args = user_args or {} local icon = args.icon or WIDGET_DIR .. '/checkbox-checked-symbolic.svg' @@ -229,7 +228,7 @@ local function worker(args) widget = wibox.widget.imagebox } - move_down:connect_signal("button::press", function(c) + move_down:connect_signal("button::press", function() local temp = result.todo_items[i] result.todo_items[i] = result.todo_items[i+1] result.todo_items[i+1] = temp @@ -322,7 +321,8 @@ local function worker(args) end if not gfs.file_readable(STORAGE) then - spawn.easy_async(string.format([[bash -c "dirname %s | xargs mkdir -p && echo '{\"todo_items\":{}}' > %s"]], STORAGE, STORAGE)) + spawn.easy_async(string.format([[bash -c "dirname %s | xargs mkdir -p && echo '{\"todo_items\":{}}' > %s"]], + STORAGE, STORAGE)) end return setmetatable(todo_widget, { __call = function(_, ...) return worker(...) end }) diff --git a/translate-widget/translate.lua b/translate-widget/translate.lua index 811e136..1499333 100644 --- a/translate-widget/translate.lua +++ b/translate-widget/translate.lua @@ -16,7 +16,8 @@ local wibox = require("wibox") local gears = require("gears") local gfs = require("gears.filesystem") -local TRANSLATE_CMD = [[bash -c 'curl -s -u "apikey:%s" -H "Content-Type: application/json" -d '\''{"text": ["%s"], "model_id":"%s"}'\'' "%s/v3/translate?version=2018-05-01"']] +local TRANSLATE_CMD = [[bash -c 'curl -s -u "apikey:%s" -H "Content-Type: application/json"]] + ..[[ -d '\''{"text": ["%s"], "model_id":"%s"}'\'' "%s/v3/translate?version=2018-05-01"']] local ICON = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/translate-widget/gnome-translate.svg' --- Returns two values - string to translate and direction: @@ -82,12 +83,14 @@ local function translate(to_translate, lang, api_key, url) { { id = 'src', - markup = '' .. lang:sub(1,2) .. ': ' .. to_translate .. '', + markup = '' .. lang:sub(1,2) .. ': ' + .. to_translate .. '', widget = wibox.widget.textbox }, { id = 'res', - markup = '' .. lang:sub(4) .. ': ' .. resp.translations[1].translation .. '', + markup = '' .. lang:sub(4) .. ': ' + .. resp.translations[1].translation .. '', widget = wibox.widget.textbox }, id = 'text', @@ -110,11 +113,11 @@ local function translate(to_translate, lang, api_key, url) w:buttons( awful.util.table.join( awful.button({}, 1, function() - awful.spawn.with_shell("echo '" .. resp.translations[1].translation .. "' | xclip -selection clipboard") + spawn.with_shell("echo '" .. resp.translations[1].translation .. "' | xclip -selection clipboard") w.visible = false end), awful.button({}, 3, function() - awful.spawn.with_shell("echo '" .. to_translate .."' | xclip -selection clipboard") + spawn.with_shell("echo '" .. to_translate .."' | xclip -selection clipboard") w.visible = false end) ) diff --git a/volume-widget/volume.lua b/volume-widget/volume.lua index 86d2e4c..cb8c21d 100644 --- a/volume-widget/volume.lua +++ b/volume-widget/volume.lua @@ -9,7 +9,6 @@ ------------------------------------------------- local wibox = require("wibox") -local watch = require("awful.widget.watch") local spawn = require("awful.spawn") local naughty = require("naughty") local gfs = require("gears.filesystem") @@ -19,7 +18,13 @@ local PATH_TO_ICONS = "/usr/share/icons/Arc/status/symbolic/" local volume_icon_name="audio-volume-high-symbolic" local GET_VOLUME_CMD = 'amixer sget Master' -local volume = {device = '', display_notification = false, display_notification_onClick = true, notification = nil, delta = 5} +local volume = { + device = '', + display_notification = false, + display_notification_onClick = true, + notification = nil, + delta = 5 +} function volume:toggle() volume:_cmd('amixer ' .. volume.device .. ' sset Master toggle') @@ -88,9 +93,9 @@ end --}}} -local function worker(args) +local function worker(user_args) --{{{ Args - local args = args or {} + local args = user_args or {} local volume_audio_controller = args.volume_audio_controller or 'pulse' volume.display_notification = args.display_notification or false @@ -120,7 +125,8 @@ local function worker(args) resize = false, widget = wibox.widget.imagebox, }, - layout = wibox.container.margin(_, _, _, 3), + margins = 3, + layout = wibox.container.margin, set_image = function(self, path) self.icon.image = path end @@ -136,7 +142,7 @@ local function worker(args) local function show() spawn.easy_async(GET_VOLUME_CMD, function(stdout, _, _, _) - txt = parse_output(stdout) + local txt = parse_output(stdout) notif(txt, true) end ) diff --git a/volumearc-widget/volumearc.lua b/volumearc-widget/volumearc.lua index 91ae763..323a750 100644 --- a/volumearc-widget/volumearc.lua +++ b/volumearc-widget/volumearc.lua @@ -23,9 +23,9 @@ local PATH_TO_ICON = "/usr/share/icons/Arc/status/symbolic/audio-volume-muted-sy local widget = {} -local function worker(args) +local function worker(user_args) - local args = args or {} + local args = user_args or {} local main_color = args.main_color or beautiful.fg_color local bg_color = args.bg_color or '#ffffff11' @@ -59,7 +59,7 @@ local function worker(args) widget = wibox.container.arcchart } - local update_graphic = function(widget, stdout, _, _, _) + local update_graphic = function(_, stdout, _, _, _) local mute = string.match(stdout, "%[(o%D%D?)%]") -- \[(o\D\D?)\] - [on] or [off] local volume = string.match(stdout, "(%d?%d?%d)%%") -- (\d?\d?\d)\%) volume = tonumber(string.format("% 3d", volume)) diff --git a/volumebar-widget/volumebar.lua b/volumebar-widget/volumebar.lua index 19238de..e7ee64d 100644 --- a/volumebar-widget/volumebar.lua +++ b/volumebar-widget/volumebar.lua @@ -22,9 +22,9 @@ local TOG_VOLUME_CMD = 'amixer -D pulse sset Master toggle' local widget = {} -local function worker(args) +local function worker(user_args) - local args = args or {} + local args = user_args or {} local main_color = args.main_color or beautiful.fg_normal local mute_color = args.mute_color or beautiful.fg_urgent @@ -52,7 +52,7 @@ local function worker(args) widget = wibox.widget.progressbar } - local update_graphic = function(widget, stdout, _, _, _) + local update_graphic = function(_, stdout, _, _, _) local mute = string.match(stdout, "%[(o%D%D?)%]") -- \[(o\D\D?)\] - [on] or [off] local volume = string.match(stdout, "(%d?%d?%d)%%") -- (\d?\d?\d)\%) volume = tonumber(string.format("% 3d", volume)) diff --git a/weather-widget/weather.lua b/weather-widget/weather.lua index 681e122..e58efb1 100644 --- a/weather-widget/weather.lua +++ b/weather-widget/weather.lua @@ -138,6 +138,7 @@ local function worker(user_args) local icons_extension = args.icons_extension or '.png' local timeout = args.timeout or 120 + local ICONS_DIR = WIDGET_DIR .. '/icons/' .. icon_pack_name .. '/' local owm_one_cal_api = ('https://api.openweathermap.org/data/2.5/onecall' .. '?lat=' .. coordinates[1] .. '&lon=' .. coordinates[2] .. '&appid=' .. api_key .. @@ -240,11 +241,14 @@ local function worker(user_args) forced_width = 300, layout = wibox.layout.flex.horizontal, update = function(self, weather) - self:get_children_by_id('icon')[1]:set_image(WIDGET_DIR .. '/icons/' .. icon_pack_name .. '/' .. icon_map[weather.weather[1].icon] .. icons_extension) + self:get_children_by_id('icon')[1]:set_image( + ICONS_DIR .. icon_map[weather.weather[1].icon] .. icons_extension) self:get_children_by_id('temp')[1]:set_text(gen_temperature_str(weather.temp, '%.0f', false, units)) - self:get_children_by_id('feels_like_temp')[1]:set_text('Feels like ' .. gen_temperature_str(weather.feels_like, '%.0f', false, units)) + self:get_children_by_id('feels_like_temp')[1]:set_text( + 'Feels like ' .. gen_temperature_str(weather.feels_like, '%.0f', false, units)) self:get_children_by_id('description')[1]:set_text(weather.weather[1].description) - self:get_children_by_id('wind')[1]:set_markup('Wind: ' .. weather.wind_speed .. 'm/s (' .. to_direction(weather.wind_deg) .. ')') + self:get_children_by_id('wind')[1]:set_markup( + 'Wind: ' .. weather.wind_speed .. 'm/s (' .. to_direction(weather.wind_deg) .. ')') self:get_children_by_id('humidity')[1]:set_markup('Humidity: ' .. weather.humidity .. '%') self:get_children_by_id('uv')[1]:set_markup('UV: ' .. uvi_index_color(weather.uvi)) end @@ -269,7 +273,7 @@ local function worker(user_args) { { { - image = WIDGET_DIR .. '/icons/' .. icon_pack_name .. '/' .. icon_map[day.weather[1].icon] .. icons_extension, + image = ICONS_DIR .. icon_map[day.weather[1].icon] .. icons_extension, resize = true, forced_width = 48, forced_height = 48, @@ -470,8 +474,8 @@ local function worker(user_args) if stderr ~= '' then if not warning_shown then if (stderr ~= 'curl: (52) Empty reply from server' - and stderr ~= 'curl: (28) Failed to connect to api.openweathermap.org port 443: Connection timed out' - and stderr:find('^curl: %(18%) transfer closed with %d+ bytes remaining to read$') ~= nil + and stderr ~= 'curl: (28) Failed to connect to api.openweathermap.org port 443: Connection timed out' + and stderr:find('^curl: %(18%) transfer closed with %d+ bytes remaining to read$') ~= nil ) then show_warning(stderr) end @@ -490,7 +494,7 @@ local function worker(user_args) local result = json.decode(stdout) - widget:set_image(WIDGET_DIR .. '/icons/' .. icon_pack_name .. '/' .. icon_map[result.current.weather[1].icon] .. icons_extension) + widget:set_image(ICONS_DIR .. icon_map[result.current.weather[1].icon] .. icons_extension) widget:set_text(gen_temperature_str(result.current.temp, '%.0f', both_units_widget, units)) current_weather_widget:update(result.current) -- cgit v1.2.3