From c5181829f518abffb789d7c83c84569c096fe115 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Tue, 27 Mar 2018 18:46:58 +0200 Subject: Reimplement wind direction detection properly Fixes #39 Ref: https://www.campbellsci.eu/blog/convert-wind-directions --- weather-widget/weather.lua | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/weather-widget/weather.lua b/weather-widget/weather.lua index 43ce974..08883b9 100644 --- a/weather-widget/weather.lua +++ b/weather-widget/weather.lua @@ -67,33 +67,30 @@ end -- Return wind direction as a string. 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 }, - } + -- 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 }) -- cgit v1.2.3 From 00b79b9bf2e4e553e6f3da7676d6caa3da6350ac Mon Sep 17 00:00:00 2001 From: streetturtle Date: Sun, 1 Apr 2018 18:08:32 -0400 Subject: Update README.md --- spotify-shell/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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`. -- cgit v1.2.3 From f9c008dc841524efe12647475082c3ec77842121 Mon Sep 17 00:00:00 2001 From: streetturtle Date: Sun, 1 Apr 2018 18:12:59 -0400 Subject: Update README.md --- battery-widget/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. -- cgit v1.2.3 From fe0bd2af0811bd1d10b60cb92505c9c3154e31a9 Mon Sep 17 00:00:00 2001 From: streetturtle Date: Sun, 1 Apr 2018 18:15:13 -0400 Subject: Update README.md --- batteryarc-widget/README.md | 1 + 1 file changed, 1 insertion(+) 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 -- cgit v1.2.3