Soft reset of dotfiles specific to Asahi, Sway and Neovim.
This commit is contained in:
venomade committed 2026-02-11 11:42:58 +00:00
1 parent 8d688d1107
commit 0bd1501855
84 files changed
+3192 -1973

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
widget = {
plugin = 'alsa',
cb = function(t)
local symbol = '󰖀'
if t.mute then
return { full_text = ' 󰝟 ', color = '#ed8796' }
else
local percent = (t.vol.cur - t.vol.min) / (t.vol.max - t.vol.min) * 100
if percent <= 30 then
symbol = '󰕿'
elseif percent >= 70 then
symbol = '󰕾'
end
return { full_text = string.format('%s%3d%%', symbol, math.floor(0.5 + percent)), color = '#b7bdf8' }
end
end,
event = [[
local t = ...
if t.button == 1 then
os.execute('pactl set-sink-mute @DEFAULT_SINK@ toggle &')
end
]],
}
+57
View File
@@ -0,0 +1,57 @@
local function read(path)
local f = io.open(path)
if not f then return nil end
local v = tonumber(f:read('*l'))
f:close()
return v
end
widget = {
plugin = 'timer',
opts = { period = 2 },
cb = function()
local base = '/sys/class/power_supply/macsmc-battery/'
local energy_now = read(base .. 'energy_now')
local energy_full = read(base .. 'energy_full')
local status_f = io.open(base .. 'status')
if not energy_now or not energy_full or not status_f then
return { { full_text = 'bat ?' } }
end
local status = status_f:read('*l')
status_f:close()
local capacity = math.floor(energy_now / energy_full * 100 + 0.5)
local text_color = '#ffffff'
local battery_symbol = ' '
if capacity < 30 then
text_color = '#ed8796'
battery_symbol = '󰁼'
elseif capacity > 70 then
text_color = '#a6da95'
battery_symbol = '󰂁'
else
text_color = '#eed49f'
battery_symbol = '󰁾'
end
local symbol = ({
Charging = '󱐋',
Discharging = battery_symbol,
})[status] or ' '
return {
{ full_text = string.format('%s %2d%%', symbol, capacity), color = text_color }
}
end,
event = [[
local t = ...
if t.button == 1 then
os.execute('~/.local/bin/rofi-ppd &')
end
]],
}
+43
View File
@@ -0,0 +1,43 @@
local player = 'jellyfin-tui'
widget = {
plugin = 'timer',
opts = { period = 2 },
cb = function()
local handle = io.popen('playerctl -p ' .. player .. ' status')
local playerctl_status = string.sub(handle:read("*a"), 1, -2)
handle:close()
local symbol = '󰏤'
if (playerctl_status == 'Playing') or (playerctl_status == 'Paused') then
local handle = io.popen('playerctl -p ' .. player ..' metadata title')
local playerctl_title = string.sub(handle:read("*a"), 1, -2)
handle:close()
local handle = io.popen('playerctl -p ' .. player .. ' metadata artist')
local playerctl_artist = string.sub(handle:read("*a"), 1, -2)
handle:close()
if playerctl_status == 'Playing' then
symbol = '󰐊'
end
return {
{ full_text = string.format('%s - %s %s', playerctl_artist, playerctl_title, symbol), color = "#f2cdcd" }
}
end
return {
{ full_text = " "}
}
end,
-- TODO: Figure out if this can stop being hardcoded
event = [[
local t = ...
if t.button == 1 then
os.execute('playerctl -p jellyfin-tui play-pause')
end
]],
}
+6
View File
@@ -0,0 +1,6 @@
widget = {
plugin = 'fs',
cb = function()
return { full_text = "|", color = "#333333" }
end,
}
+13
View File
@@ -0,0 +1,13 @@
local months = {'Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Sep', 'Out', 'Nov', 'Dez'}
local days = {'Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', ''}
widget = {
plugin = 'timer',
cb = function()
local d = os.date('*t')
return {
{full_text = string.format('%s %d %s', days[d.wday] , d.day, months[d.month])},
{full_text = string.format('%02d:%02d ', d.hour, d.min)},
}
end,
}
+70
View File
@@ -0,0 +1,70 @@
local MIN_DBM, MAX_DBM = -90, -20
local COLOR_DIM = '#709080'
local function clamp(x, lo, hi)
if x < lo then return lo end
if x > hi then return hi end
return x
end
local function make_wifi_level(dbm)
dbm = clamp(dbm, MIN_DBM, MAX_DBM)
-- Normalize to [0, 1]
local t = (dbm - MIN_DBM) / (MAX_DBM - MIN_DBM)
local level
if t < 0.25 then
level = '󰢿'
elseif t < 0.50 then
level = '󰢼'
elseif t < 0.75 then
level = '󰢽'
else
level = '󰢾'
end
return {
full_text = level,
color = COLOR_DIM,
}
end
widget = {
plugin = 'network-linux',
opts = {
wireless = true,
timeout = 10,
},
cb = function(t)
if not t then
return nil
end
local r = {}
for iface, params in pairs(t) do
if params.wireless then
if params.wireless.ssid then
r[#r + 1] = {
full_text = params.wireless.ssid,
color = COLOR_DIM,
}
end
if params.wireless.signal_dbm then
r[#r + 1] = make_wifi_level(params.wireless.signal_dbm)
end
elseif iface ~= 'lo' and (params.ipv4 or params.ipv6) then
r[#r + 1] = {
full_text = string.format('[%s]', iface),
color = COLOR_DIM,
}
end
end
return r
end,
event = [[
local t = ...
if t.button == 1 then
os.execute('~/.local/bin/rofi-wifimenu &')
end
]],
}