Add revelation

Update and add bling task_preview, tag_preview and window_switcher
Add catppuccin-macchiato
Use my weather key
Update keybindings
Update autorun
Fix sliders
This commit is contained in:
Hydroxycarbamide 2023-03-20 09:51:48 +01:00
parent 4f850f7173
commit 2401cfcee2
56 changed files with 2040 additions and 858 deletions

View file

@ -7,6 +7,7 @@ local beautiful = require("beautiful")
local dpi = beautiful.xresources.apply_dpi
local filesystem = gears.filesystem
local icon_dir = filesystem.get_configuration_dir() .. "themes/icons/weather/"
local naughty = require("naughty")
-- # Libs :
-- ~~~~~~~~
@ -85,7 +86,7 @@ local current_weather_widget = wibox.widget({
font = "Roboto Medium 10",
widget = wibox.widget.textbox,
},
spacing = dpi(-6),
spacing = dpi( -6),
layout = wibox.layout.fixed.vertical,
},
widget = wibox.container.place,
@ -132,8 +133,9 @@ local hourly_widget = function()
local time = widget:get_children_by_id("time")[1]
local icon = widget:get_children_by_id("icon")[1]
local temp = widget:get_children_by_id("tempareture")[1]
temp:set_markup(math.floor(result.temp) .. "<sup><span>°</span></sup>")
time:set_text(os.date("%I%p", tonumber(result.dt)))
temp:set_markup(math.floor(result.main.temp) .. "<sup><span>°</span></sup>")
time:set_text(os.date("%H", tonumber(result.dt)))
icon.image = icon_dir .. icon_map[result.weather[1].icon] .. ".svg"
icon:emit_signal("widget::redraw_needed")
end
@ -169,27 +171,19 @@ local weather_widget = wibox.widget({
layout = wibox.layout.fixed.vertical,
})
local api_key = ""
local coordinates = {"", ""}
local show_hourly_forecast = true
local show_daily_forecast = true
local api_key = "7641c17cda8ed75684ed55704226c565"
local city_id = "2972315"
local units = "metric"
local url = (
"https://api.openweathermap.org/data/2.5/onecall"
.. "?lat="
.. coordinates[1]
.. "&lon="
.. coordinates[2]
.. "&appid="
.. api_key
.. "&units="
.. units
.. "&exclude=minutely"
.. (show_hourly_forecast == false and ",hourly" or "")
.. (show_daily_forecast == false and ",daily" or "")
)
"https://api.openweathermap.org/data/2.5/forecast"
.. "?appid="
.. api_key
.. "&id="
.. city_id
.. "&units="
.. units
)
awful.widget.watch(string.format(GET_FORECAST_CMD, url), 600, function(_, stdout, stderr)
if stderr == "" then
@ -200,19 +194,27 @@ awful.widget.watch(string.format(GET_FORECAST_CMD, url), 600, function(_, stdout
local humidity = current_weather_widget:get_children_by_id("humidity")[1]
local temp_current = current_weather_widget:get_children_by_id("tempareture_current")[1]
local feels_like = current_weather_widget:get_children_by_id("feels_like")[1]
icon.image = icon_dir .. icon_map[result.current.weather[1].icon] .. ".svg"
local current = result.list[1]
icon.image = icon_dir .. icon_map[current.weather[1].icon] .. ".svg"
icon:emit_signal("widget::redraw_needed")
description:set_text(result.current.weather[1].description:gsub("^%l", string.upper))
humidity:set_text("Humidity: " .. result.current.humidity .. "%")
temp_current:set_markup(math.floor(result.current.temp) .. "<sup><span>°</span></sup>")
feels_like:set_markup("Feels like: " .. math.floor(result.current.feels_like) .. "<sup><span>°</span></sup>")
description:set_text(current.weather[1].description:gsub("^%l", string.upper))
humidity:set_text("Humidity: " .. current.main.humidity .. "%")
temp_current:set_markup(math.floor(current.main.temp) .. "<sup><span>°</span></sup>")
feels_like:set_markup("Feels like: " .. math.floor(current.main.feels_like) .. "<sup><span>°</span></sup>")
-- Hourly widget setup
hourly_widget_1.update(result.hourly[1])
hourly_widget_2.update(result.hourly[2])
hourly_widget_3.update(result.hourly[3])
hourly_widget_4.update(result.hourly[4])
hourly_widget_5.update(result.hourly[5])
hourly_widget_6.update(result.hourly[6])
hourly_widget_1.update(result.list[1])
hourly_widget_2.update(result.list[2])
hourly_widget_3.update(result.list[3])
hourly_widget_4.update(result.list[4])
hourly_widget_5.update(result.list[5])
hourly_widget_6.update(result.list[6])
else
naughty.notify({
title = "Weather error",
text = stderr
})
end
end)