diff --git a/__sketchybar/app_icons.lua b/__sketchybar/app_icons.lua new file mode 100644 index 0000000..3487782 --- /dev/null +++ b/__sketchybar/app_icons.lua @@ -0,0 +1,210 @@ +return { + ["Typora"] = ":text:", + ["Orion"] = ":orion:", + ["Orion RC"] = ":orion:", + ["Grammarly Editor"] = ":grammarly:", + ["kitty"] = ":kitty:", + ["ClickUp"] = ":click_up:", + ["Iris"] = ":iris:", + ["PomoDone App"] = ":pomodone:", + ["qutebrowser"] = ":qute_browser:", + ["Raindrop.io"] = ":raindrop_io:", + ["Airmail"] = ":airmail:", + ["Affinity Publisher 2"] = ":affinity_publisher_2:", + ["Calendar"] = ":calendar:", + ["日历"] = ":calendar:", + ["Fantastical"] = ":calendar:", + ["Cron"] = ":calendar:", + ["Amie"] = ":calendar:", + ["Figma"] = ":figma:", + ["Element"] = ":element:", + ["Signal"] = ":signal:", + ["Mattermost"] = ":mattermost:", + ["Caprine"] = ":caprine:", + ["Microsoft To Do"] = ":things:", + ["Things"] = ":things:", + ["Godot"] = ":godot:", + ["Android Messages"] = ":android_messages:", + ["Zed"] = ":zed:", + ["Anytype"] = ":anytype:", + ["TeamSpeak 3"] = ":team_speak:", + ["LibreWolf"] = ":libre_wolf:", + ["neovide"] = ":neovide:", + ["Spotlight"] = ":spotlight:", + ["微信"] = ":wechat:", + ["Dropbox"] = ":dropbox:", + ["Transmit"] = ":transmit:", + ["TickTick"] = ":tick_tick:", + ["Parallels Desktop"] = ":parallels:", + ["Audacity"] = ":audacity:", + ["Rider"] = ":rider:", + ["JetBrains Rider"] = ":rider:", + ["DEVONthink 3"] = ":devonthink3:", + ["Docker"] = ":docker:", + ["Docker Desktop"] = ":docker:", + ["Matlab"] = ":matlab:", + ["VLC"] = ":vlc:", + ["Alacritty"] = ":alacritty:", + ["Pages"] = ":pages:", + ["Pages 文稿"] = ":pages:", + ["Bear"] = ":bear:", + ["Pine"] = ":pine:", + ["Affinity Designer 2"] = ":affinity_designer_2:", + ["Keyboard Maestro"] = ":keyboard_maestro:", + ["Joplin"] = ":joplin:", + ["mpv"] = ":mpv:", + ["zoom.us"] = ":zoom:", + ["Affinity Photo 2"] = ":affinity_photo_2:", + ["Music"] = ":music:", + ["音乐"] = ":music:", + ["League of Legends"] = ":league_of_legends:", + ["Tor Browser"] = ":tor_browser:", + ["Hyper"] = ":hyper:", + ["‎WhatsApp"] = ":whats_app:", + ["카카오톡"] = ":kakaotalk:", + ["Discord"] = ":discord:", + ["Discord Canary"] = ":discord:", + ["Discord PTB"] = ":discord:", + ["Neovide"] = ":vim:", + ["MacVim"] = ":vim:", + ["Vim"] = ":vim:", + ["VimR"] = ":vim:", + ["Keynote"] = ":keynote:", + ["Keynote 讲演"] = ":keynote:", + ["iTerm"] = ":iterm:", + ["IntelliJ IDEA"] = ":idea:", + ["Finder"] = ":finder:", + ["访达"] = ":finder:", + ["Xcode"] = ":xcode:", + ["GoLand"] = ":goland:", + ["Android Studio"] = ":android_studio:", + ["MoneyMoney"] = ":bank:", + ["Spotify"] = ":spotify:", + ["KeePassXC"] = ":kee_pass_x_c:", + ["Alfred"] = ":alfred:", + ["Color Picker"] = ":color_picker:", + ["数码测色计"] = ":color_picker:", + ["Microsoft Word"] = ":microsoft_word:", + ["Microsoft PowerPoint"] = ":microsoft_power_point:", + ["Notes"] = ":notes:", + ["备忘录"] = ":notes:", + ["Microsoft Edge"] = ":microsoft_edge:", + ["Sublime Text"] = ":sublime_text:", + ["Sequel Ace"] = ":sequel_ace:", + ["Folx"] = ":folx:", + ["DingTalk"] = ":dingtalk:", + ["钉钉"] = ":dingtalk:", + ["阿里钉"] = ":dingtalk:", + ["WebStorm"] = ":web_storm:", + ["Sequel Pro"] = ":sequel_pro:", + ["Skype"] = ":skype:", + ["网易云音乐"] = ":netease_music:", + ["PyCharm"] = ":pycharm:", + ["Canary Mail"] = ":mail:", + ["HEY"] = ":mail:", + ["Mail"] = ":mail:", + ["Mailspring"] = ":mail:", + ["MailMate"] = ":mail:", + ["邮件"] = ":mail:", + ["Default"] = ":default:", + ["App Store"] = ":app_store:", + ["Calibre"] = ":book:", + ["Todoist"] = ":todoist:", + ["Emacs"] = ":emacs:", + ["Messenger"] = ":messenger:", + ["Tower"] = ":tower:", + ["VSCodium"] = ":vscodium:", + ["Drafts"] = ":drafts:", + ["Cypress"] = ":cypress:", + ["GitHub Desktop"] = ":git_hub:", + ["Telegram"] = ":telegram:", + ["Firefox Developer Edition"] = ":firefox_developer_edition:", + ["Firefox Nightly"] = ":firefox_developer_edition:", + ["Min"] = ":min_browser:", + ["Sketch"] = ":sketch:", + ["Affinity Photo"] = ":affinity_photo:", + ["MAMP"] = ":mamp:", + ["MAMP PRO"] = ":mamp:", + ["Insomnia"] = ":insomnia:", + ["Bitwarden"] = ":bit_warden:", + ["Warp"] = ":warp:", + ["System Preferences"] = ":gear:", + ["System Settings"] = ":gear:", + ["系统设置"] = ":gear:", + ["Affinity Designer"] = ":affinity_designer:", + ["Live"] = ":ableton:", + ["Arc"] = ":arc:", + ["Chromium"] = ":google_chrome:", + ["Google Chrome"] = ":google_chrome:", + ["Google Chrome Canary"] = ":google_chrome:", + ["Jellyfin Media Player"] = ":jellyfin:", + ["Zulip"] = ":zulip:", + ["1Password"] = ":one_password:", + ["FaceTime"] = ":face_time:", + ["FaceTime 通话"] = ":face_time:", + ["Citrix Workspace"] = ":citrix:", + ["Citrix Viewer"] = ":citrix:", + ["Logseq"] = ":logseq:", + ["Reeder"] = ":reeder5:", + ["Code"] = ":code:", + ["Code - Insiders"] = ":code:", + ["Notion"] = ":notion:", + ["Final Cut Pro"] = ":final_cut_pro:", + ["Zotero"] = ":zotero:", + ["Safari"] = ":safari:", + ["Safari浏览器"] = ":safari:", + ["Safari Technology Preview"] = ":safari:", + ["Blender"] = ":blender:", + ["Affinity Publisher"] = ":affinity_publisher:", + ["Spark Desktop"] = ":spark:", + ["Zeplin"] = ":zeplin:", + ["Replit"] = ":replit:", + ["Podcasts"] = ":podcasts:", + ["播客"] = ":podcasts:", + ["NordVPN"] = ":nord_vpn:", + ["Notability"] = ":notability:", + ["Numbers"] = ":numbers:", + ["Numbers 表格"] = ":numbers:", + ["Nova"] = ":nova:", + ["Microsoft Excel"] = ":microsoft_excel:", + ["Trello"] = ":trello:", + ["Pi-hole Remote"] = ":pihole:", + ["Linear"] = ":linear:", + ["CleanMyMac X"] = ":desktop:", + ["GrandTotal"] = ":dollar:", + ["Receipts"] = ":dollar:", + ["Evernote Legacy"] = ":evernote_legacy:", + ["OmniFocus"] = ":omni_focus:", + ["Terminal"] = ":terminal:", + ["终端"] = ":terminal:", + ["Atom"] = ":atom:", + ["Kakoune"] = ":kakoune:", + ["Reminders"] = ":reminders:", + ["提醒事项"] = ":reminders:", + ["Tana"] = ":tana:", + ["OBS"] = ":obsstudio:", + ["VMware Fusion"] = ":vmware_fusion:", + ["Tweetbot"] = ":twitter:", + ["Twitter"] = ":twitter:", + ["Microsoft Teams"] = ":microsoft_teams:", + ["Yuque"] = ":yuque:", + ["语雀"] = ":yuque:", + ["Slack"] = ":slack:", + ["Vivaldi"] = ":vivaldi:", + ["Setapp"] = ":setapp:", + ["TIDAL"] = ":tidal:", + ["Miro"] = ":miro:", + ["Messages"] = ":messages:", + ["信息"] = ":messages:", + ["Nachrichten"] = ":messages:", + ["Brave Browser"] = ":brave_browser:", + ["Preview"] = ":pdf:", + ["预览"] = ":pdf:", + ["Skim"] = ":pdf:", + ["zathura"] = ":pdf:", + ["Obsidian"] = ":obsidian:", + ["Thunderbird"] = ":thunderbird:", + ["Firefox"] = ":firefox:", + ["WezTerm"] = ":wezterm:", + ["default"] = ":default:", +} diff --git a/__sketchybar/bar.lua b/__sketchybar/bar.lua new file mode 100644 index 0000000..6672647 --- /dev/null +++ b/__sketchybar/bar.lua @@ -0,0 +1,9 @@ +local colors = require("colors") + +sbar.bar({ + topmost = "window", + height = 30, + color = colors.bar.bg, + padding_right = 2, + padding_left = 2, +}) diff --git a/__sketchybar/colors.lua b/__sketchybar/colors.lua new file mode 100644 index 0000000..c9e043c --- /dev/null +++ b/__sketchybar/colors.lua @@ -0,0 +1,30 @@ +return { + black = 0xff181819, + white = 0xffe2e2e3, + red = 0xfffc5d7c, + green = 0xff9ed072, + blue = 0xff76cce0, + yellow = 0xffe7c664, + orange = 0xfff39660, + magenta = 0xffb39df3, + grey = 0xff7f8490, + transparent = 0x00000000, + + bar = { + bg = 0xf02c2e34, + border = 0xff2c2e34, + }, + popup = { + bg = 0xc02c2e34, + border = 0xff7f8490, + }, + bg1 = 0xff363944, + bg2 = 0xff414550, + + with_alpha = function(color, alpha) + if alpha > 1.0 or alpha < 0.0 then + return color + end + return (color & 0x00ffffff) | (math.floor(alpha * 255.0) << 24) + end, +} diff --git a/__sketchybar/default.lua b/__sketchybar/default.lua new file mode 100644 index 0000000..d919def --- /dev/null +++ b/__sketchybar/default.lua @@ -0,0 +1,52 @@ +local settings = require("settings") +local colors = require("colors") + +-- Equivalent to the --default domain +sbar.default({ + updates = "when_shown", + icon = { + font = { + family = settings.font.text, + style = settings.font.style_map["Bold"], + size = 14.0, + }, + color = colors.white, + padding_left = settings.paddings, + padding_right = settings.paddings, + background = { image = { corner_radius = 9 } }, + }, + label = { + font = { + family = settings.font.text, + style = settings.font.style_map["Semibold"], + size = 13.0, + }, + color = colors.white, + padding_left = settings.paddings, + padding_right = settings.paddings, + }, + background = { + height = 21, + corner_radius = 9, + border_width = 2, + border_color = colors.bg2, + image = { + corner_radius = 9, + border_color = colors.grey, + border_width = 1, + }, + }, + popup = { + background = { + border_width = 2, + corner_radius = 9, + border_color = colors.popup.border, + color = colors.popup.bg, + shadow = { drawing = true }, + }, + blur_radius = 50, + }, + padding_left = 5, + padding_right = 5, + scroll_texts = true, +}) diff --git a/__sketchybar/helpers/init.lua b/__sketchybar/helpers/init.lua new file mode 100644 index 0000000..2b466d3 --- /dev/null +++ b/__sketchybar/helpers/init.lua @@ -0,0 +1,4 @@ +-- Add the sketchybar module to the package cpath +package.cpath = package.cpath .. ";/Users/" .. os.getenv("USER") .. "/.local/share/sketchybar_lua/?.so" + +-- os.execute("(cd helpers && make)") diff --git a/__sketchybar/helpers/makefile b/__sketchybar/helpers/makefile new file mode 100644 index 0000000..fd0bf44 --- /dev/null +++ b/__sketchybar/helpers/makefile @@ -0,0 +1,3 @@ +all: + ($(MAKE)) >/dev/null + ($(MAKE)) >/dev/null diff --git a/__sketchybar/icons.lua b/__sketchybar/icons.lua new file mode 100644 index 0000000..c1ece24 --- /dev/null +++ b/__sketchybar/icons.lua @@ -0,0 +1,14 @@ +local icons = { + nerdfont = { + battery = { + _100 = "", + _75 = "", + _50 = "", + _25 = "", + _0 = "", + charging = "", + }, + }, +} + +return icons.nerdfont diff --git a/__sketchybar/init.lua b/__sketchybar/init.lua new file mode 100644 index 0000000..72b8c21 --- /dev/null +++ b/__sketchybar/init.lua @@ -0,0 +1,9 @@ +sbar = require("sketchybar") + +sbar.begin_config() +require("bar") +require("default") +require("items") +sbar.end_config() + +sbar.event_loop() diff --git a/__sketchybar/items/battery.lua b/__sketchybar/items/battery.lua new file mode 100644 index 0000000..457437e --- /dev/null +++ b/__sketchybar/items/battery.lua @@ -0,0 +1,72 @@ +local icons = require("icons") +local colors = require("colors") +local settings = require("settings") + +local battery = sbar.add("item", "widgets.battery", { + position = "right", + icon = { + font = { + style = settings.font.style_map["Regular"], + size = 14.0, + }, + }, + label = { font = { family = settings.font.numbers } }, + update_freq = 180, + popup = { align = "center" }, +}) + +battery:subscribe({ "routine", "power_source_change", "system_woke" }, function() + sbar.exec("pmset -g batt", function(batt_info) + local icon = "!" + local label = "?" + + local found, _, charge = batt_info:find("(%d+)%%") + if found then + charge = tonumber(charge) + label = charge .. "%" + end + + local color = colors.green + local charging, _, _ = batt_info:find("AC Power") + + if charging then + icon = icons.battery.charging + else + if found and charge > 80 then + icon = icons.battery._100 + elseif found and charge > 60 then + icon = icons.battery._75 + elseif found and charge > 40 then + icon = icons.battery._50 + elseif found and charge > 20 then + icon = icons.battery._25 + color = colors.orange + else + icon = icons.battery._0 + color = colors.red + end + end + + local lead = "" + if found and charge < 10 then + lead = "0" + end + + battery:set({ + icon = { + string = icon, + color = color, + }, + label = { string = lead .. label }, + }) + end) +end) + +sbar.add("bracket", "widgets.battery.bracket", { battery.name }, { + background = { color = colors.bg1 }, +}) + +sbar.add("item", "widgets.battery.padding", { + position = "right", + width = settings.group_paddings, +}) diff --git a/__sketchybar/items/calendar.lua b/__sketchybar/items/calendar.lua new file mode 100644 index 0000000..6532ad9 --- /dev/null +++ b/__sketchybar/items/calendar.lua @@ -0,0 +1,35 @@ +local settings = require("settings") +local colors = require("colors") + +sbar.add("item", { position = "right", width = settings.group_paddings }) + +local cal = sbar.add("item", { + icon = { + color = colors.white, + padding_left = 8, + font = { + style = settings.font.style_map["Black"], + size = 12.0, + }, + }, + label = { + color = colors.white, + padding_right = 8, + width = 49, + align = "right", + font = { family = settings.font.numbers }, + }, + position = "right", + update_freq = 30, + padding_left = 1, + padding_right = 1, + background = { + color = colors.bg1, + }, +}) + +sbar.add("item", { position = "right", width = settings.group_paddings }) + +cal:subscribe({ "forced", "routine", "system_woke" }, function(env) + cal:set({ icon = os.date("%a %d %b"), label = os.date("%H:%M") }) +end) diff --git a/__sketchybar/items/front_app.lua b/__sketchybar/items/front_app.lua new file mode 100644 index 0000000..df1bcc4 --- /dev/null +++ b/__sketchybar/items/front_app.lua @@ -0,0 +1,21 @@ +local settings = require("settings") + +local front_app = sbar.add("item", "front_app", { + display = "active", + icon = { drawing = false }, + label = { + font = { + style = settings.font.style_map["Bold"], + size = 13.0, + }, + }, + updates = true, +}) + +front_app:subscribe("front_app_switched", function(env) + front_app:set({ label = { string = env.INFO } }) +end) + +front_app:subscribe("mouse.clicked", function(env) + sbar.trigger("swap_menus_and_spaces") +end) diff --git a/__sketchybar/items/init.lua b/__sketchybar/items/init.lua new file mode 100644 index 0000000..933e287 --- /dev/null +++ b/__sketchybar/items/init.lua @@ -0,0 +1,4 @@ +require("items.spaces") +require("items.front_app") +require("items.calendar") +require("items.battery") diff --git a/__sketchybar/items/spaces.lua b/__sketchybar/items/spaces.lua new file mode 100644 index 0000000..aedb663 --- /dev/null +++ b/__sketchybar/items/spaces.lua @@ -0,0 +1,103 @@ +local colors = require("colors") +local settings = require("settings") +local app_icons = require("app_icons") + +local spaces = {} + +for i = 1, 10, 1 do + local space = sbar.add("space", "space." .. i, { + space = i, + icon = { + font = { family = settings.font.numbers }, + string = i, + padding_left = 15, + padding_right = 8, + color = colors.white, + highlight_color = colors.red, + }, + label = { + padding_right = 20, + color = colors.grey, + highlight_color = colors.white, + font = "sketchybar-app-font:Regular:15.0", + y_offset = -1, + }, + padding_right = 1, + padding_left = 1, + background = { + color = colors.bg1, + border_width = 1, + height = 21, + border_color = colors.black, + }, + popup = { background = { border_width = 5, border_color = colors.black } }, + }) + + spaces[i] = space + + -- Single item bracket for space items to achieve double border on highlight + local space_bracket = sbar.add("bracket", { space.name }, { + background = { + color = colors.transparent, + border_color = colors.bg2, + height = 24, + border_width = 3, + }, + }) + + -- Padding space + sbar.add("space", "space.padding." .. i, { + space = i, + script = "", + width = settings.group_paddings, + }) + + --[[ local space_popup = sbar.add("item", { + position = "popup." .. space.name, + padding_left = 5, + padding_right = 0, + background = { + drawing = true, + image = { + corner_radius = 9, + scale = 0.2, + }, + }, + }) ]] + + space:subscribe("space_change", function(env) + local selected = env.SELECTED == "true" + -- local color = selected and colors.grey or colors.bg2 + space:set({ + icon = { highlight = selected }, + label = { highlight = selected }, + background = { border_color = selected and colors.black or colors.bg2 }, + }) + space_bracket:set({ + background = { border_color = selected and colors.grey or colors.bg2 }, + }) + end) +end + +local space_window_observer = sbar.add("item", { + drawing = false, + updates = true, +}) + +space_window_observer:subscribe("space_windows_change", function(env) + local icon_line = "" + local no_app = true + for app, _ in pairs(env.INFO.apps) do + no_app = false + local lookup = app_icons[app] + local icon = ((lookup == nil) and app_icons["default"] or lookup) + icon_line = icon_line .. " " .. icon + end + + if no_app then + icon_line = " —" + end + sbar.animate("tanh", 10, function() + spaces[env.INFO.space]:set({ label = icon_line }) + end) +end) diff --git a/__sketchybar/settings.lua b/__sketchybar/settings.lua new file mode 100644 index 0000000..e0778c0 --- /dev/null +++ b/__sketchybar/settings.lua @@ -0,0 +1,19 @@ +return { + paddings = 3, + group_paddings = 5, + + icons = "NerdFont", + + font = { + text = "MesloLGS Nerd Font Mono", + numbers = "MesloLGS Nerd Font Mono", + + style_map = { + ["Regular"] = "Regular", + ["Semibold"] = "Semibold", + ["Bold"] = "Bold", + ["Heavy"] = "Heavy", + ["Black"] = "Black", + }, + }, +} diff --git a/__sketchybar/sketchybarrc b/__sketchybar/sketchybarrc new file mode 100755 index 0000000..cdce05b --- /dev/null +++ b/__sketchybar/sketchybarrc @@ -0,0 +1,4 @@ +#!/usr/bin/env lua + +require("helpers") +require("init") diff --git a/sketchybar/items/battery.sh b/sketchybar/items/battery.sh new file mode 100644 index 0000000..b31f0b0 --- /dev/null +++ b/sketchybar/items/battery.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +COLOR="$BLUE" + +sketchybar --add item battery right \ + --set battery \ + update_freq=60 \ + icon.color="$COLOR" \ + icon.padding_left=10 \ + label.padding_right=10 \ + label.color="$COLOR" \ + background.height=21 \ + background.corner_radius="$CORNER_RADIUS" \ + background.padding_right=5 \ + background.border_width="$BORDER_WIDTH" \ + background.border_color="$COLOR" \ + background.color="$BAR_COLOR" \ + background.drawing=on \ + script="$PLUGIN_DIR/power.sh" \ + --subscribe battery power_source_change diff --git a/sketchybar/items/calendar.sh b/sketchybar/items/calendar.sh new file mode 100644 index 0000000..7ec9afb --- /dev/null +++ b/sketchybar/items/calendar.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +COLOR="$BLUE" + +sketchybar --add item calendar center\ + --set calendar update_freq=15 \ + icon.color="$COLOR" \ + icon.padding_left=10 \ + label.color="$COLOR" \ + label.padding_right=10 \ + background.height=21 \ + background.corner_radius="$CORNER_RADIUS" \ + background.padding_right=5 \ + background.border_width="$BORDER_WIDTH" \ + background.border_color="$COLOR" \ + background.color="$BAR_COLOR" \ + background.drawing=on \ + script="$PLUGIN_DIR/calendar.sh" diff --git a/sketchybar/items/clock.sh b/sketchybar/items/clock.sh new file mode 100644 index 0000000..6dd350d --- /dev/null +++ b/sketchybar/items/clock.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +COLOR="$BLUE" + +sketchybar --add item clock right \ + --set clock update_freq=1 \ + icon.padding_left=10 \ + icon.color="$COLOR" \ + icon="" \ + label.color="$COLOR" \ + label.width=54 \ + label.padding_right=5 \ + align=center \ + background.height=21 \ + background.corner_radius="$CORNER_RADIUS" \ + background.padding_right=2 \ + background.border_width="$BORDER_WIDTH" \ + background.border_color="$COLOR" \ + background.color="$BAR_COLOR" \ + background.drawing=on \ + script="$PLUGIN_DIR/clock.sh" diff --git a/sketchybar/items/front_app.sh b/sketchybar/items/front_app.sh new file mode 100644 index 0000000..85a5145 --- /dev/null +++ b/sketchybar/items/front_app.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +COLOR="$WHITE" + +sketchybar \ + --add item front_app left \ + --set front_app script="$PLUGIN_DIR/front_app.sh" \ + icon.drawing=off \ + background.height=21 \ + background.padding_left=0 \ + background.padding_right=10 \ + background.border_width="$BORDER_WIDTH" \ + background.border_color="$COLOR" \ + background.corner_radius="$CORNER_RADIUS" \ + background.color="$BAR_COLOR" \ + label.color="$COLOR" \ + label.padding_left=10 \ + label.padding_right=10 \ + associated_display=active \ + --subscribe front_app front_app_switched diff --git a/sketchybar/items/spaces.sh b/sketchybar/items/spaces.sh new file mode 100644 index 0000000..1462329 --- /dev/null +++ b/sketchybar/items/spaces.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +source "$HOME/.config/sketchybar/variables.sh" + +sketchybar --add item spacer.1 left \ + --set spacer.1 background.drawing=off \ + label.drawing=off \ + icon.drawing=off \ + width=10 + +for i in "${!SPACE_ICONS[@]}"; do + sid=$((i + 1)) + sketchybar --add space space.$sid left \ + --set space.$sid associated_space=$sid \ + label.drawing=off \ + icon.padding_left=10 \ + icon.padding_right=10 \ + background.padding_left=-5 \ + background.padding_right=-5 \ + script="$PLUGIN_DIR/space.sh" +done + +sketchybar --add item spacer.2 left \ + --set spacer.2 background.drawing=off \ + label.drawing=off \ + icon.drawing=off \ + width=5 + +sketchybar --add bracket spaces '/space.*/' \ + --set spaces background.border_width="$BORDER_WIDTH" \ + background.border_color="$BLUE" \ + background.corner_radius="$CORNER_RADIUS" \ + background.color="$BAR_COLOR" \ + background.height=21 \ + background.drawing=on + +sketchybar --add item separator left \ + icon.font="$FONT:Regular:16.0" \ + background.padding_left=26 \ + background.padding_right=15 \ + label.drawing=off \ + associated_display=active \ + icon.color="$YELLOW" diff --git a/sketchybar/plugins/calendar.sh b/sketchybar/plugins/calendar.sh new file mode 100755 index 0000000..32986e4 --- /dev/null +++ b/sketchybar/plugins/calendar.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +sketchybar --set "$NAME" icon="󰸗" label="$(date '+%a, %d %b')" diff --git a/sketchybar/plugins/clock.sh b/sketchybar/plugins/clock.sh new file mode 100755 index 0000000..397dd9c --- /dev/null +++ b/sketchybar/plugins/clock.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +LABEL=$(date '+%H:%M') +sketchybar --set "$NAME" label="$LABEL" diff --git a/sketchybar/plugins/front_app.sh b/sketchybar/plugins/front_app.sh new file mode 100755 index 0000000..8f446a3 --- /dev/null +++ b/sketchybar/plugins/front_app.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +case "$SENDER" in +"front_app_switched") + sketchybar --set "$NAME" label="$INFO" + ;; +esac diff --git a/sketchybar/plugins/power.sh b/sketchybar/plugins/power.sh new file mode 100755 index 0000000..f6dca36 --- /dev/null +++ b/sketchybar/plugins/power.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +PERCENTAGE=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1) +CHARGING=$(pmset -g batt | grep 'AC Power') + +if [ "$PERCENTAGE" = "" ]; then + exit 0 +fi + +case ${PERCENTAGE} in +9[0-9] | 100) + ICON="" + ;; +[6-8][0-9]) + ICON="" + ;; +[3-5][0-9]) + ICON="" + ;; +[1-2][0-9]) + ICON="" + ;; +*) ICON="" ;; +esac + +if [ "$CHARGING" != "" ]; then + ICON="" +fi + +sketchybar --set "$NAME" icon="$ICON" label="${PERCENTAGE}% " diff --git a/sketchybar/plugins/space.sh b/sketchybar/plugins/space.sh new file mode 100755 index 0000000..152f892 --- /dev/null +++ b/sketchybar/plugins/space.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +source "$HOME/.config/sketchybar/variables.sh" # Loads all defined colors + +SPACE_CLICK_SCRIPT="yabai -m space --focus $SID 2>/dev/null" + +if [ "$SELECTED" = "true" ]; then + sketchybar --animate tanh 5 --set "$NAME" \ + icon.color="$BLUE" \ + icon="${SPACE_ICONS[$SID - 1]}" \ + click_script="$SPACE_CLICK_SCRIPT" +else + sketchybar --animate tanh 5 --set "$NAME" \ + icon.color="$COMMENT" \ + icon="${SPACE_ICONS[$SID - 1]}" \ + click_script="$SPACE_CLICK_SCRIPT" +fi diff --git a/sketchybar/sketchybarrc b/sketchybar/sketchybarrc new file mode 100755 index 0000000..ed20c96 --- /dev/null +++ b/sketchybar/sketchybarrc @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +source "$HOME/.config/sketchybar/variables.sh" + +sketchybar --bar height=27 \ + color="$TRANSPARENT" \ + shadow="$SHADOW" \ + position=top \ + y_offset=0 \ + padding_right=11 \ + padding_left=10 \ + blur_radius=0 \ + --default updates=when_shown \ + icon.font="$FONT:Bold:13.5" \ + icon.color="$ICON_COLOR" \ + icon.padding_left="$PADDINGS" \ + icon.padding_right="$PADDINGS" \ + label.font="$FONT:Bold:13.0" \ + label.color="$LABEL_COLOR" \ + label.padding_left="$PADDINGS" \ + label.padding_right="$PADDINGS" \ + background.padding_right="$PADDINGS" \ + background.padding_left="$PADDINGS" \ + # corner_radius="$CORNER_RADIUS" \ + # sticky=on \ + # margin=5 \ + +source "$ITEM_DIR/spaces.sh" +source "$ITEM_DIR/front_app.sh" + +source "$ITEM_DIR/calendar.sh" + +source "$ITEM_DIR/clock.sh" +source "$ITEM_DIR/battery.sh" + +sketchybar --hotload true + +sketchybar --update + +echo "sketchybar configuration loaded.." diff --git a/sketchybar/variables.sh b/sketchybar/variables.sh new file mode 100644 index 0000000..4994057 --- /dev/null +++ b/sketchybar/variables.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env sh + +# Color Palette +# Tokyonight Night +# BLACK=0xff24283b +# WHITE=0xffa9b1d6 +# MAGENTA=0xffbb9af7 +# BLUE=0xff7aa2f7 +# CYAN=0xff7dcfff +# GREEN=0xff9ece6a +# YELLOW=0xffe0af68 +# ORANGE=0xffff9e64 +# RED=0xfff7768e +# BAR_COLOR=0xff1a1b26 +# COMMENT=0xff565f89 + +# Oxocarbon Theme +BLACK=0xff161616 +WHITE=0xfff2f4f8 +MAGENTA=0xffbe95ff +BLUE=0xff82cfff +CYAN=0xff3ddbd9 +GREEN=0xff42be65 +YELLOW=0xffffe97b +ORANGE=0xffff7eb6 +RED=0xff3ddbd9 +BAR_COLOR=0xff161616 +COMMENT=0xff525252 + +# TRANSPARENT=0x110000cc +TRANSPARENT=0x00ffffff + +ICON_COLOR=$WHITE +LABEL_COLOR=$WHITE + +ITEM_DIR="$HOME/.config/sketchybar/items" +PLUGIN_DIR="$HOME/.config/sketchybar/plugins" + +FONT="MesloLGS Nerd Font Mono" + +PADDINGS=3 + +POPUP_BORDER_WIDTH=2 +POPUP_CORNER_RADIUS=11 +POPUP_BACKGROUND_COLOR=$BLACK +POPUP_BORDER_COLOR=$COMMENT + +CORNER_RADIUS=15 +BORDER_WIDTH=1 + +SHADOW=on + +SPACE_ICONS=("一" "二" "三" "四" "五" "六" "七" "八" "九" "十") diff --git a/skhd/skhdrc b/skhd/skhdrc index cf11d35..30c7302 100755 --- a/skhd/skhdrc +++ b/skhd/skhdrc @@ -42,7 +42,7 @@ cmd + alt - 3 : yabai -m space --focus 3 # shift + cmd - z : yabai -m window --space next; yabai -m space --focus next shift + cmd - 1 : yabai -m window --space 1; yabai -m space --focus 1 shift + cmd - 2 : yabai -m window --space 2; yabai -m space --focus 2 -shift + cmd - 3 : yabai -m window --space 3; yabai -m space --focus 3 +# shift + cmd - 3 : yabai -m window --space 3; yabai -m space --focus 3 # move floating window # shift + ctrl - a : yabai -m window --move rel:-20:0 @@ -50,6 +50,7 @@ shift + cmd - 3 : yabai -m window --space 3; yabai -m space --focus 3 # increase window size shift + alt - a : yabai -m window --resize left:-20:0 +# cmd + alt - a : yabai -m window --resize left:-20:0 shift + alt - w : yabai -m window --resize top:0:-20 # decrease window size diff --git a/starship.toml b/starship.toml index f480b30..e9bc07f 100644 --- a/starship.toml +++ b/starship.toml @@ -31,10 +31,10 @@ error_symbol = "[✗](bold red)" disabled = true [directory] -home_symbol= " " +home_symbol= "󰊠" truncation_length = 3 truncate_to_repo = true -truncation_symbol = " " +truncation_symbol = "󰊠 " style = "bold blue" [docker_context] diff --git a/wezterm/wezterm.lua b/wezterm/wezterm.lua index a0a5404..8b1f1c0 100644 --- a/wezterm/wezterm.lua +++ b/wezterm/wezterm.lua @@ -8,14 +8,14 @@ local config = { font_size = 14.0, -- color_scheme = "Catppuccin Mocha", color_scheme = "Carbon Fox", - window_background_opacity = 0.8, + window_background_opacity = 0.85, window_padding = { - left = 0, - right = 0, - top = 0, - bottom = 0, + left = 2, + right = 2, + top = 2, + bottom = 2, }, - -- window_background_image = "documents/wallpapers/slcdn6avjgn71.png", + macos_window_background_blur = 10, } config.leader = { key = "d", mods = "CTRL", timeout_milliseconds = 1000 } diff --git a/yabai/yabairc b/yabai/yabairc index c03771f..62bcf81 100755 --- a/yabai/yabairc +++ b/yabai/yabairc @@ -5,7 +5,7 @@ sudo yabai --load-sa # global settings yabai -m config \ - external_bar off:30:0 \ + external_bar all:30:0 \ menubar_opacity 1.0 \ mouse_follows_focus off \ focus_follows_mouse off \ @@ -45,12 +45,12 @@ yabai -m rule --add app="^System Settings$" manage=off yabai -m rule --add app="^Calculator$" manage=off yabai -m rule --add app="^Finder$" manage=off yabai -m rule --add app="^Spotify$" manage=off -yabai -m rule --add app="^Safari$" manage=off +# yabai -m rule --add app="^Safari$" manage=off yabai -m rule --add app="^App Store$" manage=off yabai -m rule --add app="^Activity Monitor$" manage=off yabai -m rule --add label="Software Update" title="Software Update" manage=off yabai -m rule --add app="System Information" manage=off -borders active_color=0xffe1e3e4 inactive_color=0xff494d64 width=4.0 & +borders active_color=0xff82cfff inactive_color=0xff494d64 width=5.0 & echo "yabai configuration loaded.."