diff options
Diffstat (limited to '.config/luastatus')
| -rw-r--r-- | .config/luastatus/alsa.lua | 33 | ||||
| -rw-r--r-- | .config/luastatus/battery.lua | 57 | ||||
| -rw-r--r-- | .config/luastatus/playerctl.lua | 43 | ||||
| -rw-r--r-- | .config/luastatus/separator.lua | 6 | ||||
| -rw-r--r-- | .config/luastatus/time-date.lua | 13 | ||||
| -rw-r--r-- | .config/luastatus/wireless.lua | 70 |
6 files changed, 0 insertions, 222 deletions
diff --git a/.config/luastatus/alsa.lua b/.config/luastatus/alsa.lua deleted file mode 100644 index fc0f13b..0000000 --- a/.config/luastatus/alsa.lua +++ /dev/null @@ -1,33 +0,0 @@ -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 = '' - if percent >= 99.5 then - return { - full_text = string.format('%s %d%%', symbol, math.floor(0.5 + percent)), - color = '#b7bdf8' - } - end - 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 - ]], -} diff --git a/.config/luastatus/battery.lua b/.config/luastatus/battery.lua deleted file mode 100644 index 459599e..0000000 --- a/.config/luastatus/battery.lua +++ /dev/null @@ -1,57 +0,0 @@ -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 - ]], -} diff --git a/.config/luastatus/playerctl.lua b/.config/luastatus/playerctl.lua deleted file mode 100644 index a3e743c..0000000 --- a/.config/luastatus/playerctl.lua +++ /dev/null @@ -1,43 +0,0 @@ -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 - ]], -} diff --git a/.config/luastatus/separator.lua b/.config/luastatus/separator.lua deleted file mode 100644 index 1a3ef01..0000000 --- a/.config/luastatus/separator.lua +++ /dev/null @@ -1,6 +0,0 @@ -widget = { - plugin = 'fs', - cb = function() - return { full_text = "|", color = "#333333" } - end, -} diff --git a/.config/luastatus/time-date.lua b/.config/luastatus/time-date.lua deleted file mode 100644 index 8d5bfe7..0000000 --- a/.config/luastatus/time-date.lua +++ /dev/null @@ -1,13 +0,0 @@ -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, -} diff --git a/.config/luastatus/wireless.lua b/.config/luastatus/wireless.lua deleted file mode 100644 index e3d53d7..0000000 --- a/.config/luastatus/wireless.lua +++ /dev/null @@ -1,70 +0,0 @@ -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 - ]], -} |
