Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
shajra committed Jan 20, 2024
1 parent 20cdf11 commit 790ca2c
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 52 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
lieer = { url = github:gauteh/lieer; flake = false; };
moneydance = { url = tarball+https://infinitekind.com/stabledl/current/moneydance-linux.tar.gz; flake = false; };
pointless-xcompose = { url = github:leoboiko/pointless-xcompose; flake = false; };
sf-symbols = { url = https://devimages-cdn.apple.com/design/resources/download/SF-Symbols-5.dmg; flake = false; };
sf-symbols = { url = https://devimages-cdn.apple.com/design/resources/download/SF-Symbols-5.1.dmg; flake = false; };
sketchybar-font-dist = { url = https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v1.0.23/sketchybar-app-font.ttf; flake = false; };
sketchybar-font-src = { url = github:kvndrsslr/sketchybar-app-font; flake = false; };
sketchybar-lua = { url = github:FelixKratz/SbarLua; flake = false; };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
return {
unifying = tonumber("@colors_unifying@"),
info = tonumber("@colors_info@"),
warning = tonumber("@colors_warning@"),
urgent = tonumber("@colors_urgent@"),
info = tonumber("@colors_info@"),
warning = tonumber("@colors_warning@"),
urgent = tonumber("@colors_urgent@"),
primary = {
background = tonumber("@colors_primary_bg@"),
foreground = tonumber("@colors_primary_fg@")
Expand Down
26 changes: 14 additions & 12 deletions home/modules/base/gui/darwin/xdg/configFile/sketchybar/icons.lua
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
return {
loading = "􀖇",
apple = "􀣺",
battery = {
_0 = "􀛪",
_25 = "􀛩",
_50 = "􀺶",
_75 = "􀺸",
_100 = "􀛨",
charging = "􀢋" -- unused for now
},
cake = "🍰",
cake = "􁖩",
plug = {charging = "􀡸", not_charging = "􀡷􀊅"},
preferences = "􀺽",
volume = {
_100 = "􀊩",
_66 = "􀊧",
_33 = "􀊥",
_10 = "􀊡",
_0 = "􀊣",
_0 = "􀊣"
},
wifi = {connected = "􀙇", disconnected = "􀙈"},
battery = {
_100 = "􀛨",
_75 = "􀺸",
_50 = "􀺶",
_25 = "􀛩",
_0 = "􀛪",
charging = "􀢋",
},
yabai = {
stack = "􀏭",
fullscreen_zoom = "􀏜",
parent_zoom = "􀥃",
float = "􀢌",
grid = "􀧍",
},
grid = "􀧍" -- unused for now
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,36 @@ local function battery_update()
local handle = assert(io.popen("pmset -g batt"))
local batt_info = assert(handle:read("a"))
handle:close()
local icon = "!"

if (string.find(batt_info, 'AC Power')) then
icon = icons.battery.charging
else
local found, _, charge = batt_info:find("(%d+)%%")
if found then charge = tonumber(charge) end
local plug_icon = ""
if string.find(batt_info, 'AC attached; not charging') then
plug_icon = icons.plug.not_charging
elseif string.find(batt_info, '; charging') then
plug_icon = icons.plug.charging
end

if found and charge > 80 then
local label = ""
local battery_icon = "􁁕"
local charge_found, _, charge = batt_info:find("(%d+)%%")
if charge_found then
label = charge
charge = tonumber(charge)
if charge > 80 then
icon = icons.battery._100
elseif found and charge > 60 then
elseif charge > 60 then
icon = icons.battery._75
elseif found and charge > 40 then
elseif charge > 40 then
icon = icons.battery._50
elseif found and charge > 20 then
elseif charge > 20 then
icon = icons.battery._25
else
icon = icons.battery._0
end
end

battery:set({icon = icon})
battery:set({icon = plug_icon .. battery_icon, label = label})
end

battery:subscribe({"routine", "power_source_change", "system_woke"},
battery_update)

battery:subscribe("mouse.clicked",
function(env) battery:set({label = {drawing = true}}) end)
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,14 @@ local function space_windows_change(env)
if next(app_emojis) ~= nil then
icon_strip = table.concat(app_emojis, " ")
end
sbar.animate("tanh", 10, function()
sbar.set(spaces[space], {label = icon_strip})
end)
sbar.animate("tanh", 10,
function() sbar.set(spaces[space], {label = icon_strip}) end)
end

for i = 1, 10, 1 do
local space = sbar.add("space", {
associated_space = i,
background = {
color = colors.unselected.background,
corner_radius = 6
},
background = {color = colors.unselected.background, corner_radius = 6},
icon = {
string = i,
padding_left = 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,23 @@ local icons = require("icons")
local colors = require("colors")

local yabai = sbar.add("item", {
icon = {
color = colors.info,
font = {style = "Bold"},
width = 0,
},
label = {
color = colors.info,
width = 0,
},
icon = {color = colors.info, font = {style = "Bold"}, width = 0},
label = {color = colors.info, width = 0}
})

yabai:subscribe("window_focus", function(env)
local icon = icons.yabai[env.STATE] or ""
local label = ""
if env.STATE == "stack" then
label = "[" .. env.STACK_INDEX .. "/" .. env.STACK_LAST .. "]"
label = "[" .. env.STACK_INDEX .. "/" .. env.STACK_LAST .. "]"
end
local icon_width, label_width = 0, 0
if icon ~= "" then icon_width = 30 end
if icon ~= "" then icon_width = 30 end
if label ~= "" then label_width = 40 end
sbar.animate("sin", 10, function()
yabai:set({
icon = { string = icon, width = icon_width },
label = { string = label, width = label_width },
icon = {string = icon, width = icon_width},
label = {string = label, width = label_width}
})
end)
end)

0 comments on commit 790ca2c

Please sign in to comment.