/ modules / home / programs / sketchybar / default.nix
default.nix
  1  {
  2    lib,
  3    pkgs,
  4    ...
  5  }:
  6  {
  7    home.file = {
  8      ".config/sketchybar" = {
  9        enable = false;
 10        recursive = true;
 11        source = ./sketchybar;
 12      };
 13  
 14      # "config/sketchybar/.luarc.json" = {
 15      #   enable = true;
 16      #   text = ''
 17      #     {
 18      #         "diagnostics.globals": [
 19      #             "vim",
 20      #             "icons",
 21      #             "colors",
 22      #             "bar",
 23      #             "default",
 24      #             "helpers"
 25      #         ],
 26      #         "runtime.version": "Lua 5.4"
 27      #     }
 28      #     '';
 29      # };
 30  
 31      # ".config/sketchybar/sketchybarrc" = {
 32      #     enable = false;
 33      #     text = ''
 34      #     #!/usr/bin/env lua
 35  
 36      #     -- Load the sketchybar-package and prepare the helper binaries
 37      #     require("helpers")
 38      #     require("init")
 39      #     '';
 40      # };
 41    };
 42  
 43    programs.sketchybar = lib.mkIf pkgs.stdenv.isDarwin {
 44      enable = false;
 45      # configType = "lua";
 46      # luaPackage = pkgs.lua5_4;
 47      # sbarLuaPackage = pkgs.sbarlua;
 48      service.enable = false;
 49      includeSystemPath = false;
 50      extraPackages = with pkgs; [ jq ];
 51  
 52      # config = {
 53      #   source = ./sketchybar;
 54      #   recursive = true;
 55      # };
 56  
 57      # config = ''
 58      # -- init.lua — SketchyBar config (Lua)
 59  
 60      # local COLOR_BLACK = "0xff181926"
 61      # local COLOR_WHITE = "0xffcad3f5"
 62      # local COLOR_GRAY  = "0xff363a4f"
 63      # local COLOR_BLUE  = "0xff8aadf4"
 64      # local COLOR_GREEN = "0xffa6da95"
 65      # local COLOR_YELLOW= "0xffeed49f"
 66      # local COLOR_RED   = "0xffed8796"
 67  
 68      # local WIFI_IFACE = "en0"
 69  
 70      # local function sh(cmd)
 71      #   -- print(cmd) -- uncomment to debug the emitted commands
 72      #   os.execute(cmd)
 73      # end
 74  
 75      # sh(string.format(
 76      #   'sketchybar --bar height=32 position=top topmost=on padding_left=10 padding_right=10 color=%s corner_radius=8 shadow=on',
 77      #   COLOR_BLACK
 78      # ))
 79  
 80      # sh(string.format([[
 81      # sketchybar --default \
 82      #   icon.font="SF Pro:Bold:14.0" \
 83      #   icon.color=%s \
 84      #   label.font="SF Pro:Bold:14.0" \
 85      #   label.color=%s \
 86      #   background.padding_left=5 \
 87      #   background.padding_right=5
 88      # ]], COLOR_WHITE, COLOR_WHITE))
 89  
 90      # -- Apple logo (click to open System Settings)
 91      # sh(string.format([[
 92      # sketchybar --add item apple left \
 93      #   --set apple icon="" icon.color=%s \
 94      #   click_script="open -a 'System Settings'"
 95      # ]], COLOR_RED))
 96  
 97      # -- Space indicator (requires yabai + jq)
 98      # sh([[
 99      # sketchybar --add item space_indicator left \
100      #   --set space_indicator \
101      #     script="yabai -m query --spaces --display | jq -r '.[] | select(.focused==1).label'" \
102      #     update_freq=5 \
103      #     icon=🖥
104      # ]])
105  
106      # sh([[
107      # sketchybar --add item front_app center \
108      #   --set front_app \
109      #     script="osascript -e 'tell application \"System Events\" to get name of (first application process whose frontmost is true)'" \
110      #     update_freq=5
111      # ]])
112  
113      # sh([[
114      # sketchybar --add item clock right \
115      #   --set clock \
116      #     script="date '+%H:%M'" \
117      #     update_freq=10 \
118      #     icon="🕒"
119      # ]])
120  
121      # sh([[
122      # sketchybar --add item battery right \
123      #   --set battery \
124      #     script="pmset -g batt | grep -Eo '[0-9]+%%' | head -1" \
125      #     update_freq=30 \
126      #     icon="🔋"
127      # ]])
128  
129      # sh([[
130      # sketchybar --add item volume right \
131      #   --set volume \
132      #     script="osascript -e 'output volume of (get volume settings)'" \
133      #     update_freq=10 \
134      #     icon="🔊"
135      # ]])
136  
137      # sh(string.format([[
138      # sketchybar --add item wifi right \
139      #   --set wifi \
140      #     script="/usr/sbin/networksetup -getairportnetwork %s | sed 's/^Current Wi-Fi Network: //'" \
141      #     update_freq=30 \
142      #     icon="📶"
143      # ]], WIFI_IFACE))
144  
145      # sh("sketchybar --update")
146      # '';
147    };
148  }