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

@ -109,8 +109,9 @@ sidebar : setup {
local slide = rubato.timed {
pos = helpers.screen.geometry.height,
rate = 60,
intro = 0.2,
duration = 0.4,
intro = 0.05,
duration = 0.2,
easing = rubato.quadratic,
subscribed = function(pos)
sidebar.y = helpers.screen.geometry.y + pos
end
@ -146,8 +147,8 @@ awful.placement.top_right(sidebar, {honor_workarea = true, margins = beautiful.u
--})
-- Get signal to execute the function (if that makes sense)
awesome.connect_signal("sidebar::toggle", function(s)
sidebar.toggle(s)
awesome.connect_signal("sidebar::toggle", function()
sidebar.toggle()
end)
return sidebar

View file

@ -6,7 +6,7 @@
local awful = require("awful")
local gears = require("gears")
local wibox = require("wibox")
local beautiful = require ("beautiful")
local beautiful = require("beautiful")
local dpi = beautiful.xresources.apply_dpi
@ -20,18 +20,18 @@ local playerctl = require("libs.bling").signal.playerctl.lib()
-- widgets
----------
-- gradientee music album art
-- - - - - - - - - - - - - -
-- - - - - - - - - - - - - -
local music_art_filter = wibox.widget({
{
bg = {
type = "linear",
from = { 0, 30 },
to = { 0, 200},
stops = {
{ 0, colors.transparent},
{ 1, colors.container }
},
type = "linear",
from = { 0, 30 },
to = { 0, 200 },
stops = {
{ 0, colors.transparent },
{ 1, colors.container }
},
},
forced_height = dpi(85),
forced_width = dpi(85),
widget = wibox.container.background,
@ -43,42 +43,42 @@ local music_art_filter = wibox.widget({
-- the different music elements
-- - - - - - - - - - - - - - -
-- - - - - - - - - - - - - - -
-- album art
local album_art = wibox.widget{
widget = wibox.widget.imagebox,
clip_shape = helpers.rrect(theme.rounded),
forced_height = dpi(85),
forced_width = dpi(85),
image = theme.album_art
local album_art = wibox.widget {
widget = wibox.widget.imagebox,
clip_shape = helpers.rrect(theme.rounded),
forced_height = dpi(85),
forced_width = dpi(85),
image = theme.album_art
}
-- playing yeah?
local playing_or = wibox.widget{
widget = wibox.widget.textbox,
markup = helpers.colorize_text("Now playing", colors.white),
font = theme.font,
align = "left",
valign = "center"
local playing_or = wibox.widget {
widget = wibox.widget.textbox,
markup = helpers.colorize_text("Now playing", colors.white),
font = theme.font,
align = "left",
valign = "center"
}
-- song artist
local song_artist = wibox.widget{
widget = wibox.widget.textbox,
markup = helpers.colorize_text("Unknown", colors.white),
font = theme.font,
align = "left",
valign = "center"
local song_artist = wibox.widget {
widget = wibox.widget.textbox,
markup = helpers.colorize_text("Unknown", colors.white),
font = theme.font,
align = "left",
valign = "center"
}
-- song name
local song_name = wibox.widget{
widget = wibox.widget.textbox,
markup = helpers.colorize_text("None", colors.white),
font = theme.font,
align = "left",
valign = "center"
local song_name = wibox.widget {
widget = wibox.widget.textbox,
markup = helpers.colorize_text("None", colors.white),
font = theme.font,
align = "left",
valign = "center"
}
---------------------------------------- eo.Widgets
@ -87,30 +87,30 @@ local song_name = wibox.widget{
----------
-- toggle button
local toggle_button = wibox.widget{
widget = wibox.widget.textbox,
markup = helpers.colorize_text("", colors.white),
font = theme.sidebar_font,
align = "right",
valign = "center"
local toggle_button = wibox.widget {
widget = wibox.widget.textbox,
markup = helpers.colorize_text("", colors.white),
font = theme.sidebar_font,
align = "right",
valign = "center"
}
-- next button
local next_button = wibox.widget{
widget = wibox.widget.textbox,
markup = helpers.colorize_text("", colors.white),
font = theme.sidebar_font,
align = "right",
valign = "center"
local next_button = wibox.widget {
widget = wibox.widget.textbox,
markup = helpers.colorize_text("", colors.white),
font = theme.sidebar_font,
align = "right",
valign = "center"
}
-- prev button
local prev_button = wibox.widget{
widget = wibox.widget.textbox,
markup = helpers.colorize_text("", colors.white),
font = theme.sidebar_font,
align = "right",
valign = "center"
local prev_button = wibox.widget {
widget = wibox.widget.textbox,
markup = helpers.colorize_text("", colors.white),
font = theme.sidebar_font,
align = "right",
valign = "center"
}
local music_bar = wibox.widget({
@ -139,13 +139,13 @@ local next_command = function() playerctl:next() end
-- make it functional!
toggle_button:buttons(gears.table.join(
awful.button({}, 1, function() toggle_command() end)))
awful.button({}, 1, function() toggle_command() end)))
next_button:buttons(gears.table.join(
awful.button({}, 1, function() next_command() end)))
awful.button({}, 1, function() next_command() end)))
prev_button:buttons(gears.table.join(
awful.button({}, 1, function() prev_command() end)))
awful.button({}, 1, function() prev_command() end)))
@ -165,77 +165,75 @@ playerctl:connect_signal("metadata", function(_, title, artist, album_path, __,
end
album_art:set_image(gears.surface.load_uncached(album_path))
song_name:set_markup_silently(helpers.colorize_text(title, colors.white))
song_name:set_markup_silently(helpers.colorize_text(title, colors.white))
song_artist:set_markup_silently(helpers.colorize_text(artist, colors.white))
end)
-- playing/paused/{N/A}
playerctl:connect_signal("playback_status", function(_, playing, __)
if playing then
toggle_button.markup = helpers.colorize_text("", colors.white)
toggle_button.markup = helpers.colorize_text("", colors.white)
else
toggle_button.markup = helpers.colorize_text("", colors.white)
toggle_button.markup = helpers.colorize_text("", colors.white)
end
end)
-- time elapsed
playerctl:connect_signal("position", function(_, interval_sec, length_sec)
music_bar.value = (interval_sec / length_sec) * 100
music_length = length_sec
music_bar.value = (interval_sec / length_sec) * 100
music_length = length_sec
end)
-- mainbox
-- too messy
------------
local music_box = wibox.widget {
local music_box = wibox.widget {
{
{
album_art,
music_art_filter,
layout = wibox.layout.stack,
},
{
{
{
album_art,
music_art_filter,
layout = wibox.layout.stack,
},
{
playing_or,
nil,
{
{
playing_or,
nil,
{
{
step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
widget = wibox.container.scroll.horizontal,
forced_width = dpi(250),
speed = 30,
song_name,
},
{
step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
widget = wibox.container.scroll.horizontal,
forced_width = dpi(250),
speed = 30,
song_artist,
},
spacing = dpi(2),
layout = wibox.layout.fixed.vertical,
},
layout = wibox.layout.align.vertical,
expand = "none"
},
layout = wibox.layout.fixed.horizontal,
spacing = dpi(10)
step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
widget = wibox.container.scroll.horizontal,
forced_width = dpi(250),
speed = 30,
song_name,
},
{
step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
widget = wibox.container.scroll.horizontal,
forced_width = dpi(250),
speed = 30,
song_artist,
},
spacing = dpi(2),
layout = wibox.layout.fixed.vertical,
},
widget = wibox.container.margin,
margins = {top = dpi(20), bottom = dpi(20), left = dpi(20), right = dpi(20)},
layout = wibox.layout.align.vertical,
expand = "none"
},
layout = wibox.layout.stack,
},
widget = wibox.container.background,
forced_height = dpi(150),
bg = colors.container,
border_color = colors.container,
shape = helpers.rrect(theme.rounded)
layout = wibox.layout.fixed.horizontal,
spacing = dpi(10)
},
widget = wibox.container.margin,
margins = { top = dpi(20), bottom = dpi(20), left = dpi(20), right = dpi(20) },
},
layout = wibox.layout.stack,
},
widget = wibox.container.background,
forced_height = dpi(150),
bg = colors.container,
border_color = colors.container,
shape = helpers.rrect(theme.rounded)
}
@ -245,26 +243,26 @@ return wibox.widget {
{
music_box,
{
{
music_bar,
direction = "east",
widget = wibox.container.rotate,
forced_width = dpi(2)
},
layout = wibox.layout.fixed.horizontal,
spacing = dpi(20),
{
music_bar,
direction = "east",
widget = wibox.container.rotate,
forced_width = dpi(2)
},
layout = wibox.layout.fixed.horizontal,
spacing = dpi(20),
},
{
{
{
nil,
{
prev_button,
toggle_button,
next_button,
{
prev_button,
toggle_button,
next_button,
layout = wibox.layout.fixed.vertical,
spacing = dpi(22)
},
spacing = dpi(22)
},
layout = wibox.layout.align.vertical,
expand = "none"
},
@ -285,5 +283,3 @@ return wibox.widget {
-- eof
------

View file

@ -113,13 +113,13 @@ local mic = wibox.widget {
}
local update_mic = function()
awful.spawn.easy_async_with_shell("pamixer --source 5891 --get-volume", function(stdout)
awful.spawn.easy_async_with_shell("pactl get-source-volume 0 | awk '{print $5}' | cut -d '%' -f 1", function(stdout)
mic_slider.value = tonumber(stdout:match("%d+"))
end)
end
mic_slider:connect_signal("property::value", function(_, mic_vol)
awful.spawn("pamixer --source 5891 --set-volume ".. mic_vol, false)
awful.spawn("pactl set-source-volume 0 ".. mic_vol .. "%", false)
-- Update textbox widget text
mic_osd_value.text = mic_vol .. "%"
awesome.emit_signal("module::mic_osd_value", mic_vol)

View file

@ -6,48 +6,49 @@
local awful = require("awful")
local gears = require("gears")
local wibox = require("wibox")
local beautiful = require ("beautiful")
local beautiful = require("beautiful")
local naughty = require("naughty")
local dpi = beautiful.xresources.apply_dpi
-- Helper
-----------
local function round_widget(radius)
return function(cr,w,h)
gears.shape.rounded_rect(cr,w,h,radius)
end
return function(cr, w, h)
gears.shape.rounded_rect(cr, w, h, radius)
end
end
local function grouping_widget(w1,w2)
local container = wibox.widget {
w1,
{
nil,
w2,
expand = 'none',
layout = wibox.layout.align.vertical,
},
spacing = dpi(18),
layout = wibox.layout.fixed.horizontal,
}
local function grouping_widget(w1, w2)
local container = wibox.widget {
w1,
{
nil,
w2,
expand = 'none',
layout = wibox.layout.align.vertical,
},
spacing = dpi(18),
layout = wibox.layout.fixed.horizontal,
}
return container
return container
end
local function center_widget(widget)
return wibox.widget {
nil,
{
nil,
widget,
expand = 'none',
layout = wibox.layout.align.horizontal,
},
expand = 'none',
layout = wibox.layout.align.vertical,
}
return wibox.widget {
nil,
{
nil,
widget,
expand = 'none',
layout = wibox.layout.align.horizontal,
},
expand = 'none',
layout = wibox.layout.align.vertical,
}
end
-- Create_widgets
-- Create_widgets
-------------------
-- Disk
@ -57,15 +58,15 @@ d_icon.align = "left"
d_icon.markup = ""
local d_slider = wibox.widget {
forced_width = dpi(220),
forced_height = dpi(10),
color = beautiful.red,
background_color = "#663D3D",
shape = round_widget(12),
bar_shape = round_widget(12),
max_value = 100,
value = 20,
widget = wibox.widget.progressbar,
forced_width = dpi(220),
forced_height = dpi(10),
color = beautiful.red,
background_color = "#663D3D",
shape = round_widget(12),
bar_shape = round_widget(12),
max_value = 100,
value = 20,
widget = wibox.widget.progressbar,
}
local disk = grouping_widget(d_icon, d_slider)
@ -77,14 +78,14 @@ v_icon.align = "left"
v_icon.markup = ""
local v_slider = wibox.widget {
forced_width = dpi(220),
forced_height = dpi(10),
color = beautiful.blue,
background_color = "#3D4B66",
shape = round_widget(12),
bar_shape = round_widget(12),
max_value = 100,
widget = wibox.widget.progressbar,
forced_width = dpi(220),
forced_height = dpi(10),
color = beautiful.blue,
background_color = "#3D4B66",
shape = round_widget(12),
bar_shape = round_widget(12),
max_value = 100,
widget = wibox.widget.progressbar,
}
local volume = grouping_widget(v_icon, v_slider)
@ -96,14 +97,14 @@ b_icon.align = "left"
b_icon.markup = ""
local b_slider = wibox.widget {
forced_width = dpi(220),
forced_height = dpi(10),
color = beautiful.yellow,
background_color = "#66523D",
shape = round_widget(12),
bar_shape = round_widget(12),
max_value = 100,
widget = wibox.widget.progressbar,
forced_width = dpi(220),
forced_height = dpi(10),
color = beautiful.yellow,
background_color = "#66523D",
shape = round_widget(12),
bar_shape = round_widget(12),
max_value = 100,
widget = wibox.widget.progressbar,
}
local brightness = grouping_widget(b_icon, b_slider)
@ -112,28 +113,30 @@ local brightness = grouping_widget(b_icon, b_slider)
------------------------------------
local function get_val()
awesome.connect_signal("signal::volume", function(vol, muted)
if muted then v_slider.value = 0 else
v_slider.color = beautiful.blue
v_slider.value = tonumber(vol)
end
end)
awesome.connect_signal("signal::volume", function(vol, muted)
if muted then
v_slider.value = 0
else
v_slider.color = beautiful.blue
v_slider.value = tonumber(vol)
end
end)
awesome.connect_signal("signal::brightness", function(bri)
b_slider.value = tonumber(bri)
end)
awesome.connect_signal("signal::brightness", function(bri)
b_slider.value = tonumber(bri)
end)
awesome.connect_signal("signal::disk", function(disk_perc)
d_slider.value = tonumber(disk_perc)
end)
awesome.connect_signal("signal::disk", function(disk_perc)
d_slider.value = tonumber(disk_perc)
end)
end
get_val()
return center_widget(wibox.widget {
disk,
volume,
brightness,
spacing = dpi(18),
layout = wibox.layout.fixed.vertical,
disk,
volume,
brightness,
spacing = dpi(18),
layout = wibox.layout.fixed.vertical,
})

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)