diff options
-rw-r--r-- | battery-widget/README.md | 2 | ||||
-rw-r--r-- | batteryarc-widget/README.md | 1 | ||||
-rw-r--r-- | spotify-shell/README.md | 4 | ||||
-rw-r--r-- | weather-widget/weather.lua | 49 |
4 files changed, 27 insertions, 29 deletions
diff --git a/battery-widget/README.md b/battery-widget/README.md index 7826430..57f7c3f 100644 --- a/battery-widget/README.md +++ b/battery-widget/README.md @@ -10,7 +10,7 @@ This widget consists of: ![Battery Widget](./bat-wid-2.png) Alternatively you can use a tooltip (check the code): ![Battery Widget](./bat-wid-22.png) - - a pop-up warning message which appears on bottom right corner when battery level is less that 15%: + - a pop-up warning message which appears on bottom right corner when battery level is less that 15% (you can get the image [here](https://vk.com/images/stickers/1933/512.png)): ![Battery Widget](./bat-wid-3.png) Note that widget uses the Arc icon theme, so it should be [installed](https://github.com/horst3180/arc-icon-theme#installation) first under **/usr/share/icons/Arc/** folder. diff --git a/batteryarc-widget/README.md b/batteryarc-widget/README.md index 7ba4162..6a451d1 100644 --- a/batteryarc-widget/README.md +++ b/batteryarc-widget/README.md @@ -38,6 +38,7 @@ s.mytasklist, -- Middle widget batteryarc_widget, ... ``` +You can get the icon for warning popup [here](https://vk.com/images/stickers/1933/512.png) ## Troubleshooting diff --git a/spotify-shell/README.md b/spotify-shell/README.md index 9987f68..4bc9af7 100644 --- a/spotify-shell/README.md +++ b/spotify-shell/README.md @@ -48,8 +48,8 @@ Keyboard navigation (copied from [`awful.prompt`](https://awesomewm.org/doc/api/ 1. Install [sp](https://gist.github.com/streetturtle/fa6258f3ff7b17747ee3) - CLI client for [Spotify for Linux](https://www.spotify.com/ca-en/download/linux/): ```bash - $ sudo git clone https://gist.github.com/fa6258f3ff7b17747ee3.git /opt/ - $ sudo ln -s /opt/sp /usr/local/bin/ + $ sudo git clone https://gist.github.com/fa6258f3ff7b17747ee3.git ~/dev/ + $ sudo ln -s ~/dev/sp /usr/local/bin/ ``` Check if it works by running `sp help`. diff --git a/weather-widget/weather.lua b/weather-widget/weather.lua index a279d99..08883b9 100644 --- a/weather-widget/weather.lua +++ b/weather-widget/weather.lua @@ -61,39 +61,36 @@ local icon_map = { } -- handy function to convert temperature from Kelvin to Celcius -local function to_celcius(kelvin) +function to_celcius(kelvin) return math.floor(tonumber(kelvin) - 273.15) end -- Return wind direction as a string. -local function to_direction(degrees) - local directions = { - { "N", 348.75, 360 }, - { "N", 0, 11.25 }, - { "NNE", 11.25, 33.75 }, - { "NE", 33.75, 56.25 }, - { "ENE", 56.25, 78.75 }, - { "E", 78.75, 101.25 }, - { "ESE", 101.25, 123.75 }, - { "SE", 123.75, 146.25 }, - { "SSE", 146.25, 168.75 }, - { "S", 168.75, 191.25 }, - { "SSW", 191.25, 213.75 }, - { "SW", 213.75, 236.25 }, - { "WSW", 236.25, 258.75 }, - { "W", 258.75, 281.25 }, - { "WNW", 281.25, 303.75 }, - { "NW", 303.75, 326.25 }, - { "NNW", 326.25, 348.75 }, - } +function to_direction(degrees) + -- Ref: https://www.campbellsci.eu/blog/convert-wind-directions if degrees == nil then return "Unknown dir" end - for i, dir in ipairs(directions) do - if degrees > dir[2] and degrees < dir[3] then - return dir[1] - end - end + local directions = { + "N", + "NNE", + "NE", + "ENE", + "E", + "ESE", + "SE", + "SSE", + "S", + "SSW", + "SW", + "WSW", + "W", + "WNW", + "NW", + "NNW", + "N", + } + return directions[math.floor((degrees % 360) / 22.5) + 1] end local weather_timer = timer({ timeout = 60 }) |