Skip to content

Commit

Permalink
sketchybar: use sbarlua
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed Feb 25, 2024
1 parent 7702d40 commit a9f5814
Show file tree
Hide file tree
Showing 24 changed files with 1,685 additions and 1 deletion.
2 changes: 2 additions & 0 deletions modules/darwin/desktop/addons/sketchybar/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ in
gnugrep
gnused
jq
lua5_4
wttrbar
];

# TODO: need to update nixpkg to support complex configurations
Expand Down
2 changes: 1 addition & 1 deletion modules/home/desktop/addons/sketchybar/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ in
xdg.configFile = {
"sketchybar" = {
source = lib.cleanSourceWith {
src = lib.cleanSource ./config/.;
src = lib.cleanSource ./lua-config/.;
};

recursive = true;
Expand Down
20 changes: 20 additions & 0 deletions modules/home/desktop/addons/sketchybar/lua-config/bar.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
local colors = require("colors")

-- Equivalent to the --bar domain
sbar.bar({
blur_radius = 30,
border_color = colors.surface1,
border_width = 2,
color = colors.base,
corner_radius = 9,
height = 40,
margin = 10,
notch_width = 0,
padding_left = 18,
padding_right = 10,
position = "top",
shadow = true,
sticky = true,
topmost = false,
y_offset = 10,
})
40 changes: 40 additions & 0 deletions modules/home/desktop/addons/sketchybar/lua-config/colors.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
local colors = {
base = 0xff24273a,
mantle = 0xff1e2030,
crust = 0xff181926,
text = 0xffcad3f5,
subtext0 = 0xffb8c0e0,
subtext1 = 0xffa5adcb,
surface0 = 0xff363a4f,
surface1 = 0xff494d64,
surface2 = 0xff5b6078,
overlay0 = 0xff6e738d,
overlay1 = 0xff8087a2,
overlay2 = 0xff939ab7,
blue = 0xff8aadf4,
lavender = 0xffb7bdf8,
sapphire = 0xff7dc4e4,
sky = 0xff91d7e3,
teal = 0xff8bd5ca,
green = 0xffa6da95,
yellow = 0xffeed49f,
peach = 0xfff5a97f,
maroon = 0xffee99a0,
red = 0xffed8796,
mauve = 0xffc6a0f6,
pink = 0xfff5bde6,
flamingo = 0xfff0c6c6,
rosewater = 0xfff4dbd6,
}

local random_cat_color = {
colors.blue, colors.lavender, colors.sapphire, colors.sky, colors.teal,
colors.green, colors.yellow, colors.peach, colors.maroon, colors.red,
colors.mauve, colors.pink, colors.flamingo, colors.rosewater,
}

local function getRandomCatColor()
return random_cat_color[math.random(1, #random_cat_color)]
end

return colors
46 changes: 46 additions & 0 deletions modules/home/desktop/addons/sketchybar/lua-config/default.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
local settings = require("settings")
local colors = require("colors")

-- Equivalent to the --default domain
sbar.default({
updates = "when_shown",
icon = {
color = colors.text,
font = {
family = settings.nerd_font,
style = "Bold",
size = 16.0
},
padding_left = settings.paddings,
padding_right = settings.paddings,
},
label = {
color = colors.text,
font = {
family = settings.font,
style = "Semibold",
size = 13.0
},
padding_left = settings.paddings,
padding_right = settings.paddings,
},
background = {
corner_radius = 9,
height = 30,
padding_left = settings.paddings,
padding_right = settings.paddings,
},
popup = {
height = 30,
horizontal = false,
background = {
border_color = colors.blue,
border_width = 2,
color = colors.mantle,
corner_radius = 11,
shadow = {
drawing = true
}
}
}
})
93 changes: 93 additions & 0 deletions modules/home/desktop/addons/sketchybar/lua-config/icons.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
return {
loading = "􀖇",
apple = "􀣺",
preferences = "􀺽",
activity = "􀒓",
lock = "􀒳",
logout = "",
power = "",
reboot = "",
sleep = "",
ical = "􀉉",
volume = {
_100 = "􀊩",
_66 = "􀊧",
_33 = "􀊥",
_10 = "􀊡",
_0 = "􀊣",
},
battery = {
non_charging = {
_100 = "󰁹",
_90 = "󰂂",
_80 = "󰂁",
_70 = "󰂀",
_60 = "󰁿",
_50 = "󰁾",
_40 = "󰁽",
_30 = "󰁼",
_20 = "󰁻",
_10 = "󰁺",
_0 = "󰂃",
},
charging = {
_100 = "󰂅",
_90 = "󰂋",
_80 = "󰂊",
_70 = "󰢞",
_60 = "󰂉",
_50 = "󰢝",
_40 = "󰂈",
_30 = "󰂇",
_20 = "󰂆",
_10 = "󰢜",
_0 = "󰢟",
}
},
stats = {
cpu = "",
disk = "󰋊",
memory = "",
network = "",
network_down = "",
network_up = "",
},
bell = "􀋚",
bell_dot = "􀝗",
bluetooth = "󰂯",
bluetooth_off = "󰂲",
brew = "􀐛",
wifi = "󰖩",
wifi_off = "󰖪",
git = {
issue = "􀍷",
discussion = "􀒤",
pull_request = "􀙡",
commit = "􀡚",
indicator = "",
},
spotify = {
back = "􀊎",
play_pause = "􀊈",
next = "􀊐",
shuffle = "􀊝",
-- repeat = "􀊞",
},
yabai = {
stack = "􀏭",
fullscreen_zoom = "􀏜",
parent_zoom = "􀥃",
float = "􀢌",
grid = "􀧍"
},
spaces = {
_1 = "",
_2 = "",
_3 = "󰆍",
_4 = "",
_5 = "",
_6 = "",
_7 = "",
_8 = ""
}
}
3 changes: 3 additions & 0 deletions modules/home/desktop/addons/sketchybar/lua-config/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
require("bar")
require("default")
require("items")
Loading

0 comments on commit a9f5814

Please sign in to comment.