This commit is contained in:
streetturtle 2018-04-14 19:25:16 -04:00
commit 0a1aaef424
4 changed files with 27 additions and 29 deletions

View File

@ -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.

View File

@ -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

View File

@ -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`.

View File

@ -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 })