nix/config/sketchybar/items/init.lua

33 lines
980 B
Lua

local function file_exists(path)
local f = io.open(path, 'r')
if f then
f:close()
return true
end
return false
end
local function load_module_if_program_exists(module_name, binary_path)
if file_exists(binary_path) then
print('Loading ' .. module_name .. ' (found at ' .. binary_path .. ')')
local ok, err = pcall(require, module_name)
if not ok then
print('ERROR loading ' .. module_name .. ' module: ' .. tostring(err))
else
print('Successfully loaded ' .. module_name)
end
else
print('Skipping ' .. module_name .. ' (binary not found at ' .. binary_path .. ')')
end
end
require 'items.apple'
load_module_if_program_exists('items.aerospace', '/opt/homebrew/bin/aerospace')
load_module_if_program_exists('items.yabai', '/etc/profiles/per-user/rayandrew/bin/yabai')
require 'items.front_app'
require 'items.menu'
require 'items.battery'
require 'items.cal'
require 'items.volume'
require 'items.cpu'
require 'items.wifi'