💄 feat: Ventoy theme; working Awesome config

This commit is contained in:
punkfairie 2024-02-18 14:31:14 -08:00
parent a85e55c3c7
commit 1dc84aa836
35 changed files with 828 additions and 7 deletions

View file

@ -13,4 +13,23 @@ M.apps = {
M.apps.start_editor = M.apps.terminal .. "-e" .. M.apps.editor
M.widget = {}
M.widget.weather = {
api_key = "",
coordinates = { lat = "", lon = "" },
}
M.widget.github = {
username = "punkfairie",
}
M.widget.mic = {
name = "alsa_input...",
}
M.widget.disk = {
name = "/dev/sdb3",
}
return M

View file

@ -1,5 +1,7 @@
local gshape = require("gears.shape")
local capi = { mouse = mouse }
local _ui = {}
function _ui.rrect(radius)
@ -8,4 +10,24 @@ function _ui.rrect(radius)
end
end
function _ui.add_hover_cursor(w, hover_cursor)
local original_cursor = "left_ptr"
w:connect_signal("mouse::enter", function()
local widget = capi.mouse.current_wibox
if widget then
widget.cursor = hover_cursor
end
end)
w:connect_signal("mouse::leave", function()
local widget = capi.mouse.current_wibox
if widget then
widget.cursor = original_cursor
end
end)
end
return _ui

@ -0,0 +1 @@
Subproject commit 1af8166d2afdf0622d0a3d38d7b40d3958ab138d

View file

@ -0,0 +1 @@
Subproject commit 8a3737b7af4c9dc40c53d700118333d36541d4d3

View file

@ -1,5 +1,5 @@
local awful = require("awful")
screen.connect_signal("request::desktop_decoration", function(s)
awful.tag({ "", "", "", "", "", "" }, s, awful.layout.layouts[1])
awful.tag({ "", "", "", "", "", "󰍹" }, s, awful.layout.layouts[1])
end)

View file

@ -7,7 +7,7 @@ local beautiful = require("beautiful")
require("awful.autofocus")
-- Theme --
beautiful.init(gears.filesystem.get_configuration_dir() .. "themes/catppuccin/theme.lua")
beautiful.init(gears.filesystem.get_configuration_dir() .. "themes/catppuccin-macchiato/theme.lua")
-- Main/Configuration --
require("main")
@ -23,3 +23,4 @@ require("ui")
-- Autostart --
awful.spawn.with_shell("picom --experimental-backends")
awful.spawn("copyq")

View file

@ -0,0 +1,22 @@
local awful = require("awful")
local gears = require("gears")
local function get_cpu()
local script = [[
echo $[100-$(vmstat 1 2|tail -1|awk '{print $15}')]
]]
awful.spawn.easy_async_with_shell(script, function(cpu_perc)
cpu_perc = cpu_perc:match("%d+")
awesome.emit_signal("signal::cpu", cpu_perc)
end)
end
gears.timer({
timeout = 1,
call_now = true,
autostart = true,
callback = function()
get_cpu()
end,
})

View file

@ -0,0 +1,4 @@
require("signals.volume")
require("signals.mic")
require("signals.cpu")
require("signals.mem")

View file

@ -0,0 +1,22 @@
local awful = require("awful")
local gears = require("gears")
local function get_mem()
local script = [[
free | grep Mem | awk '{print $3/$2 * 100.0}' | cut -f 1 -d "."
]]
awful.spawn.easy_async_with_shell(script, function(mem_perc)
mem_perc = mem_perc:match("%d+")
awesome.emit_signal("signal::mem", mem_perc)
end)
end
gears.timer({
timeout = 4,
call_now = true,
autostart = true,
callback = function()
get_mem()
end,
})

View file

@ -0,0 +1,28 @@
local awful = require("awful")
local microphone = require("config").widget.mic.name
local vol_sc = "pamixer --source " .. microphone .. " --get-volume"
local mute_sc = "pamixer --source " .. microphone .. " --get-mute"
local function get_vol()
awful.spawn.easy_async_with_shell(vol_sc, function(vol)
awful.spawn.easy_async_with_shell(mute_sc, function(mute)
local muted
if mute:match("false") then
muted = false
else
muted = true
end
awesome.emit_signal("signal::mic", vol, muted)
end)
end)
end
awesome.connect_signal("widget::update_mic", function()
get_vol()
end)
get_vol()

View file

@ -0,0 +1,26 @@
local awful = require("awful")
local vol_sc = "pamixer --get-volume"
local mute_sc = "pamixer --get-mute"
local function get_vol()
awful.spawn.easy_async_with_shell(vol_sc, function(vol)
awful.spawn.easy_async_with_shell(mute_sc, function(mute)
local muted
if mute:match("false") then
muted = false
else
muted = true
end
awesome.emit_signal("signal::volume", vol, muted)
end)
end)
end
awesome.connect_signal("widget::update_vol", function()
get_vol()
end)
get_vol()

View file

@ -1,4 +1,4 @@
local palette = require("catppuccin.mocha")
local palette = require("lib.catppuccin.catppuccin.macchiato")
local filesystem = require("gears.filesystem")
local dpi = require("beautiful.xresources").apply_dpi
local theme_assets = require("beautiful.theme_assets")
@ -11,8 +11,42 @@ local theme = {}
-- Transparent Color
theme.transparent = "#00000000"
-- Theme colors
theme.color = {
base = palette.base.hex,
mantle = palette.mantle.hex,
crust = palette.crust.hex,
surface0 = palette.surface0.hex,
surface1 = palette.surface1.hex,
surface2 = palette.surface2.hex,
text = palette.text.hex,
subtext0 = palette.subtext0.hex,
subtext1 = palette.subtext1.hex,
overlay0 = palette.overlay0.hex,
overlay1 = palette.overlay1.hex,
overlay2 = palette.overlay2.hex,
rosewater = palette.rosewater.hex,
flamingo = palette.flamingo.hex,
pink = palette.pink.hex,
mauve = palette.mauve.hex,
red = palette.red.hex,
maroon = palette.maroon.hex,
peach = palette.peach.hex,
yellow = palette.yellow.hex,
green = palette.green.hex,
teal = palette.teal.hex,
sky = palette.sky.hex,
sapphire = palette.sapphire.hex,
blue = palette.blue.hex,
lavender = palette.lavender.hex,
}
-- Font
theme.font_name = "FiraCode Nerd Font "
theme.font_name = "FiraCode Nerd Font Propo" .. " "
theme.font = theme.font_name .. "10"
-- Assets

View file

@ -2,5 +2,5 @@ require("ui.menu")
-- ui.popups
-- ui.notif-panel
-- ui.info-panel
-- ui.top-panel
require("ui.top-panel")
-- ui.titlebar

View file

@ -1,4 +1,3 @@
local apps = require("main.apps")
local gears = require("gears")
local awful = require("awful")
local hotkeys_popup = require("awful.hotkeys_popup")
@ -6,6 +5,7 @@ local beautiful = require("beautiful")
local wibox = require("wibox")
local helpers = require("helpers")
local apps = require("config").apps
local menu = {}

View file

@ -0,0 +1,112 @@
local beautiful = require("beautiful")
local wibox = require("wibox")
local awful = require("awful")
local widgets = require("ui.top-panel.widgets")
local dpi = beautiful.xresources.apply_dpi
local function create_icon(i, c)
local widget = {
{
font = beautiful.font_name .. "12.5",
text = " " .. i,
widget = wibox.widget.textbox,
},
fg = c,
widget = wibox.container.background,
}
return widget
end
-- Create icons with color.
local calendar_icon = create_icon("", beautiful.color.teal)
local clock_icon = create_icon("", beautiful.color.pink)
screen.connect_signal("request::desktop_decoration", function(s)
local clockdate = wibox.widget({
layout = wibox.layout.fixed.horizontal,
calendar_icon,
widgets.date,
clock_icon,
widgets.clock,
})
local tasklist = wibox.widget({
{
layout = wibox.layout.fixed.horizontal,
s.tasklist,
},
forced_width = 300,
layout = wibox.layout.fixed.horizontal,
})
-- Create the wibox.
s.wibox = awful.wibar({
position = "top",
screen = s,
margins = {
top = dpi(10),
left = dpi(20),
right = dpi(20),
},
border_width = dpi(2),
border_color = beautiful.color.surface0,
widget = {
layout = wibox.layout.align.horizontal,
expand = "none",
{
{ -- left widgets
layout = wibox.layout.fixed.horizontal,
widgets.menu,
widgets.seperator,
s.taglist,
widgets.seperator,
tasklist,
},
left = 5,
right = 0,
top = 2,
bottom = 2,
layout = wibox.container.margin,
},
{
{
layout = wibox.layout.align.horizontal,
clockdate,
},
left = 0,
right = 0,
top = 1,
bottom = 1,
layout = wibox.container.margin,
},
{ -- right widgets
{
layout = wibox.layout.fixed.horizontal,
widgets.systray,
widgets.seperator,
widgets.audio,
widgets.mem,
widgets.cpu,
widgets.disk,
widgets.layoutbox,
},
left = 0,
right = 2,
top = 1,
bottom = 1,
layout = wibox.container.margin,
},
},
})
-- s.border2 = awful.wibar({
-- position = "top",
-- screen = s,
-- bg = beautiful.color.surface0,
-- height = dpi(2),
-- })
end)

View file

@ -0,0 +1,81 @@
local wibox = require("wibox")
local beautiful = require("beautiful")
local gears = require("gears")
local awful = require("awful")
local helpers = require("helpers")
local dpi = beautiful.xresources.apply_dpi
-- Icon --
local icon = wibox.widget.textbox()
icon.font = beautiful.font_name .. "12.5"
icon.align = "center"
icon.markup = "<span foreground='" .. beautiful.color.blue .. "'>󰕾</span>"
-- Uptime --
local audio = wibox.widget.textbox()
audio.font = beautiful.font_name .. "10"
audio.align = "center"
local function get_val()
awesome.connect_signal("signal::volume", function(vol, muted)
if muted then
audio.markup = "muted"
icon.markup = "<span foreground='" .. beautiful.color.blue .. "'>󰖁</span>"
else
audio.markup = tonumber(vol) .. "%"
icon.markup = "<span foreground='" .. beautiful.color.blue .. "'>󰕾</span>"
end
end)
end
get_val()
local full = wibox.widget({
{
{
icon,
audio,
spacing = dpi(8),
layout = wibox.layout.fixed.horizontal,
},
left = dpi(5),
right = 8,
layout = wibox.container.margin,
},
forced_width = 73,
layout = wibox.layout.fixed.horizontal,
})
full:buttons(gears.table.join(awful.button({}, 1, function()
awesome.emit_signal("action::toggle")
end)))
local update_volume = function()
awful.spawn.easy_async_with_shell("pamixer --get-volume", function(stdout)
audio.markup = tonumber(stdout:match("%d+")) .. "%"
if tonumber(stdout:match("%d+")) < 10 then
icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰕿</span>"
elseif tonumber(stdout:match("%d+")) < 50 then
icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰖀</span>"
elseif tonumber(stdout:match("%d+")) < 100 then
icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰕾</span>"
end
end)
end
update_volume()
awesome.connect_signal("widget::update_vol", function()
update_volume()
end)
awesome.connect_signal("widget::update_vol_pulse", function()
update_volume()
end)
helpers.ui.add_hover_cursor(full, "hand2")
return full

View file

@ -0,0 +1,17 @@
local wibox = require("wibox")
local beautiful = require("beautiful")
local gears = require("gears")
local clock = wibox.widget.textbox()
clock.font = beautiful.font_name .. "11"
gears.timer({
timeout = 60,
autostart = true,
call_now = true,
callback = function()
clock.markup = os.date("%I:%M %p")
end,
})
return clock

View file

@ -0,0 +1,41 @@
local wibox = require("wibox")
local beautiful = require("beautiful")
local dpi = beautiful.xresources.apply_dpi
-- Icon --
local icon = wibox.widget.textbox()
icon.font = beautiful.font_name .. "12.5"
icon.align = "center"
icon.markup = "<span foreground='" .. beautiful.color.maroon .. "'></span>"
-- Uptime --
local cpu = wibox.widget.textbox()
cpu.font = beautiful.font_name .. "10"
cpu.align = "center"
local function get_val()
awesome.connect_signal("signal::cpu", function(cpu_perc)
cpu.markup = tonumber(cpu_perc) .. "%"
end)
end
get_val()
local full = wibox.widget({
{
{
icon,
cpu,
spacing = dpi(8),
layout = wibox.layout.fixed.horizontal,
},
left = 1,
right = 0,
layout = wibox.container.margin,
},
forced_width = 73,
layout = wibox.layout.fixed.horizontal,
})
return full

View file

@ -0,0 +1,17 @@
local wibox = require("wibox")
local beautiful = require("beautiful")
local gears = require("gears")
local date = wibox.widget.textbox()
date.font = beautiful.font_name .. "11"
gears.timer({
timeout = 60,
autostart = true,
call_now = true,
callback = function()
date.markup = os.date(" %a %b %d")
end,
})
return date

View file

@ -0,0 +1,37 @@
local wibox = require("wibox")
local beautiful = require("beautiful")
local dpi = beautiful.xresources.apply_dpi
-- Icon --
local icon = wibox.widget.textbox()
icon.font = beautiful.font_name .. "12.5"
icon.align = "center"
icon.markup = "<span foreground='" .. beautiful.color.yellow .. "'></span>"
-- Uptime --
local disk = wibox.widget.textbox()
disk.font = beautiful.font_name .. "10"
disk.align = "center"
local function get_val()
awesome.connect_signal("signal::disk", function(disk_perc)
disk.markup = tonumber(disk_perc) .. "%"
end)
end
get_val()
local full = wibox.widget({
{
icon,
disk,
spacing = dpi(8),
layout = wibox.layout.fixed.horizontal,
},
left = 1,
right = 8,
layout = wibox.container.margin,
})
return full

View file

@ -0,0 +1,16 @@
return {
audio = require("ui.top-panel.widgets.audio"),
clock = require("ui.top-panel.widgets.clock"),
cpu = require("ui.top-panel.widgets.cpu"),
date = require("ui.top-panel.widgets.date"),
disk = require("ui.top-panel.widgets.disk"),
layoutbox = require("ui.top-panel.widgets.layoutbox"),
mem = require("ui.top-panel.widgets.mem"),
menu = require("ui.top-panel.widgets.menu"),
power = require("ui.top-panel.widgets.power"),
promptbox = require("ui.top-panel.widgets.promptbox"),
seperator = require("ui.top-panel.widgets.seperator"),
systray = require("ui.top-panel.widgets.systray"),
taglist = require("ui.top-panel.widgets.taglist"),
tasklist = require("ui.top-panel.widgets.tasklist"),
}

View file

@ -0,0 +1,8 @@
local awful = require("awful")
local beautiful = require("beautiful")
local mainmenu = require("ui.menu").mainmenu
local launcher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mainmenu })
return launcher

View file

@ -0,0 +1,23 @@
local awful = require("awful")
local layoutbox = awful.widget.layoutbox({
buttons = {
awful.button({}, 1, function()
awful.layout.inc(1)
end),
awful.button({}, 3, function()
awful.layout.inc(-1)
end),
awful.button({}, 4, function()
awful.layout.inc(-1)
end),
awful.button({}, 5, function()
awful.layout.inc(1)
end),
},
})
return layoutbox

View file

@ -0,0 +1,41 @@
local wibox = require("wibox")
local beautiful = require("beautiful")
local dpi = beautiful.xresources.apply_dpi
-- Icon --
local icon = wibox.widget.textbox()
icon.font = beautiful.font_name .. "12.5"
icon.align = "center"
icon.markup = "<span foreground='" .. beautiful.color.green .. "'>󰍛</span>"
-- Uptime --
local mem = wibox.widget.textbox()
mem.font = beautiful.font_name .. "10"
mem.align = "center"
local function get_val()
awesome.connect_signal("signal::mem", function(mem_perc)
mem.markup = tonumber(mem_perc) .. "%"
end)
end
get_val()
local full = wibox.widget({
{
{
icon,
mem,
spacing = dpi(8),
layout = wibox.layout.fixed.horizontal,
},
left = 1,
right = 0,
layout = wibox.container.margin,
},
forced_width = 73,
layout = wibox.layout.fixed.horizontal,
})
return full

View file

@ -0,0 +1,24 @@
local wibox = require("wibox")
local beautiful = require("beautiful")
local gears = require("gears")
local awful = require("awful")
local helpers = require("helpers")
local menu = wibox.widget({
{
font = beautiful.font_name .. "16",
markup = "<span foreground='" .. beautiful.color.pink .. "'>󰋒</span>",
widget = wibox.widget.textbox(),
},
bottom = 2,
widget = wibox.container.margin,
})
helpers.ui.add_hover_cursor(menu, "hand2")
menu:buttons(gears.table.join(awful.button({}, 1, function()
awesome.emit_signal("sidebar::toggle")
end)))
return menu

View file

@ -0,0 +1,14 @@
local wibox = require("wibox")
local beautiful = require("beautiful")
local gears = require("gears")
local awful = require("awful")
local menu = wibox.widget.textbox()
menu.font = beautiful.font_name .. "16"
menu.markup = "<span foreground='" .. beautiful.color.red .. "'></span>"
menu:buttons(gears.table.join(awful.button({}, 1, function()
awesome.emit_signal("module::exit_screen:show")
end)))
return menu

View file

@ -0,0 +1,5 @@
local awful = require("awful")
local promptbox = awful.widget.prompt()
return promptbox

View file

@ -0,0 +1,8 @@
local wibox = require("wibox")
local beautiful = require("beautiful")
local seperator = wibox.widget.textbox()
seperator.font = beautiful.font_name .. "14"
seperator.markup = "<span foreground='" .. beautiful.color.subtext1 .. "'>|</span>"
return seperator

View file

@ -0,0 +1,67 @@
local beautiful = require("beautiful")
local wibox = require("wibox")
local rubato = require("lib.rubato")
local gears = require("gears")
local awful = require("awful")
local dpi = beautiful.xresources.apply_dpi
local arrow = wibox.widget.textbox()
arrow.font = beautiful.font_name .. "13"
arrow.markup = "»"
local systray = wibox.widget.systray()
systray.visible = true
beautiful.systray_icon_spacing = dpi(4)
local widget = wibox.widget({
widget = wibox.container.constraint,
strategy = "max",
width = dpi(0),
{
widget = wibox.container.margin,
margins = dpi(2),
systray,
},
})
widget.visible = true
local slide = rubato.timed({
duration = 0.9,
awestore_compat = true,
subscribed = function(pos)
widget.width = pos
end,
})
local value = true
arrow.toggle = function()
if value == false then
arrow.markup = "»"
value = true
slide:set(2)
else
arrow.markup = "«"
slide:set(500)
value = false
end
end
awesome.connect_signal("arrow::toggle", function()
arrow.toggle()
end)
arrow:buttons(gears.table.join(awful.button({}, 1, function()
awesome.emit_signal("arrow::toggle")
end)))
local sys = wibox.widget({
layout = wibox.layout.fixed.horizontal,
arrow,
widget,
spacing = dpi(2),
})
return sys

View file

@ -0,0 +1,111 @@
local beautiful = require("beautiful")
local awful = require("awful")
local wibox = require("wibox")
local bling = require("lib.bling")
local keys = require("config").keys
local dpi = beautiful.xresources.apply_dpi
awful.screen.connect_for_each_screen(function(s)
s.taglist = awful.widget.taglist({
screen = s,
filter = awful.widget.taglist.filter.all,
widget_template = {
{
{
{
id = "text_role",
widget = wibox.widget.textbox,
},
layout = wibox.layout.fixed.horizontal,
},
left = 4,
right = 4,
widget = wibox.container.margin,
},
id = "background_role",
widget = wibox.container.background,
-- Hover colors & an index label.
create_callback = function(self, c3, index)
self:get_children_by_id("text_role")[1].markup = "<b> " .. index .. " </b>"
self:connect_signal("mouse::enter", function()
-- BLING: Only show widget when there are clients in the tag.
if #c3:clients() > 0 then
-- BLING: Update the widget with the new tag.
awesome.emit_signal("bling::tag_preview::update", c3)
-- BLING: Show the widget.
awesome.emit_signal("bling::tag_preview::visibility", s, true)
end
end)
self:connect_signal("mouse::leave", function()
-- BLING: Turn the widget off.
awesome.emit_signal("bling::tag_preview::visibility", s, false)
if self.has_backup then
self.bg = self.backup
end
end)
end,
update_callback = function(self, _, index)
self:get_children_by_id("text_role")[1].markup = "<b> " .. index .. " </b>"
end,
},
buttons = {
awful.button({}, 1, function(t)
t:view_only()
end),
awful.button({ keys.mod }, 1, function(t)
if client.focus then
client.focus:move_to_tag(t)
end
end),
awful.button({}, 3, awful.tag.viewtoggle),
awful.button({ keys.mod }, 3, function(t)
if client.focus then
client.focus:toggle_tag(t)
end
end),
awful.button({}, 4, function(t)
awful.tag.viewprev(t.screen)
end),
awful.button({}, 5, function(t)
awful.tag.viewnext(t.screen)
end),
},
})
bling.widget.tag_preview.enable({
show_client_content = true,
x = 0, -- x-coord of popup
y = 0, -- y-coord of popup
scale = 0.2, -- scale of preview compared to screen
honor_padding = true, -- honor padding when creating widget size
honor_workarea = true, --honor work area when creating widget size
placement_fn = function(c) -- place widget using awful.placement
awful.placement.top_left(c, {
margins = {
top = 31,
left = 0,
},
})
end,
background_widget = wibox.widget({ -- set bg image for the widget
image = beautiful.wallpaper,
horizontal_fit_policy = "fit",
vertical_fit_policy = "fit",
widget = wibox.widget.imagebox,
}),
})
end)

View file

@ -0,0 +1,8 @@
local awful = require("awful")
awful.screen.connect_for_each_screen(function(s)
s.tasklist = awful.widget.tasklist({
screen = s,
filter = awful.widget.tasklist.filter.focused,
})
end)

3
.gitignore vendored
View file

@ -50,6 +50,7 @@ Videos/
*.tmp
# Automatically appended
.mozilla/
.config/dconf/
.config/fish/fish_variables
.local/
.config/autostart/

9
.gitmodules vendored
View file

@ -25,3 +25,12 @@
[submodule "/home/marley/.themes/lazygit/catppuccin"]
path = /home/marley/.themes/lazygit/catppuccin
url = git@github.com:catppuccin/lazygit.git
[submodule "/home/marley/.themes/ventoy/catppuccin"]
path = /home/marley/.themes/ventoy/catppuccin
url = git@github.com:Dooez/ventoy-catppuccin.git
[submodule ".config/awesome/lib/rubato"]
path = .config/awesome/lib/rubato
url = git@github.com:andOrlando/rubato.git
[submodule ".config/awesome/lib/catppuccin"]
path = .config/awesome/lib/catppuccin
url = git@github.com:catppuccin/lua.git

@ -0,0 +1 @@
Subproject commit 5410456039771ae5cfe1464688a8eb2947a71cda