From 8f71fac972b4fe5a98459148d9b33d1748deaa7f Mon Sep 17 00:00:00 2001 From: Ryan Schanzenbacher Date: Mon, 6 Jul 2026 22:50:11 -0400 Subject: initial simple-bar config --- hosts/RyanMac/configuration.nix | 18 +- modules/darwin/random-wallpaper.nix | 45 ----- users/ryan/home.nix | 3 + users/ryan/modules/simple-bar/default.nix | 35 ++++ users/ryan/modules/simple-bar/server.nix | 34 ++++ users/ryan/modules/simple-bar/simplebarrc | 289 ++++++++++++++++++++++++++++++ 6 files changed, 378 insertions(+), 46 deletions(-) delete mode 100644 modules/darwin/random-wallpaper.nix create mode 100644 users/ryan/modules/simple-bar/default.nix create mode 100644 users/ryan/modules/simple-bar/server.nix create mode 100644 users/ryan/modules/simple-bar/simplebarrc diff --git a/hosts/RyanMac/configuration.nix b/hosts/RyanMac/configuration.nix index bb6bafc..1327c91 100644 --- a/hosts/RyanMac/configuration.nix +++ b/hosts/RyanMac/configuration.nix @@ -1,4 +1,4 @@ -{ pkgs, inputs, lib, ... }: +{ config, pkgs, inputs, lib, ... }: let username = "ryan"; @@ -86,6 +86,21 @@ in { }; extraConfig = '' yabai -m rule --add app='System Settings' manage=off + '' + # Add simple-bar signals if enabled + + lib.optionalString config.home-manager.users.${username}.ryan.simple-bar.enable '' + yabai -m signal --add event=window_focused action="curl http://localhost:7776/yabai/spaces/refresh && curl http://localhost:7776/yabai/windows/refresh" label="Refresh simple-bar spaces & windows when focused application changes" + yabai -m signal --add event=window_resized action="curl http://localhost:7776/yabai/spaces/refresh && curl http://localhost:7776/yabai/windows/refresh" label="Refresh simple-bar spaces & windows when a window is resized" + yabai -m signal --add event=window_destroyed action="curl http://localhost:7776/yabai/spaces/refresh && curl http://localhost:7776/yabai/windows/refresh" label="Refresh simple-ba spaces & windows when an application window is closed" + yabai -m signal --add event=space_changed action="curl http://localhost:7776/yabai/spaces/refresh && curl http://localhost:7776/yabai/windows/refresh" label="Refresh simple-bar spaces & windows on space change" + yabai -m signal --add event=display_changed action="curl http://localhost:7776/yabai/spaces/refresh && curl http://localhost:7776/yabai/windows/refresh" label="Refresh simple-bar spaces & windows on display focus change" + yabai -m signal --add event=window_title_changed action="curl http://localhost:7776/yabai/spaces/refresh && curl http://localhost:7776/yabai/windows/refresh" label="Refresh simple-bar spaces & windows when current window title changes" + yabai -m signal --add event=space_destroyed action="curl http://localhost:7776/yabai/spaces/refresh && curl http://localhost:7776/yabai/windows/refresh" label="Refresh simple-bar spaces & windows on space removal" + yabai -m signal --add event=space_created action="curl http://localhost:7776/yabai/spaces/refresh && curl http://localhost:7776/yabai/windows/refresh" label="Refresh simple-bar spaces & windows on space creation" + yabai -m signal --add event=application_activated action="curl http://localhost:7776/yabai/spaces/refresh && curl http://localhost:7776/yabai/windows/refresh" label="Refresh simple-bar spaces & windows when application is activated" + yabai -m signal --add event=display_added action="curl http://localhost:7776/yabai/displays/refresh" label="Refresh simple-bar displays when a new dispay is added" + yabai -m signal --add event=display_removed action="curl http://localhost:7776/yabai/displays/refresh" label="Refresh simple-bar displays when a dispay is removed" + yabai -m signal --add event=display_moved action="curl http://localhost:7776/yabai/displays/refresh" label="Refresh simple-bar displays when a dispay is moved" ''; }; @@ -157,6 +172,7 @@ in { "ungoogled-chromium" "tailscale-app" "netbird-ui" + "ubersicht" ]; }; diff --git a/modules/darwin/random-wallpaper.nix b/modules/darwin/random-wallpaper.nix deleted file mode 100644 index 793096f..0000000 --- a/modules/darwin/random-wallpaper.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ config, lib, pkgs, ... }: -let - cfg = config.local.randomWallpaper; - script = pkgs.writeShellApplication { - name = "set-random-wallpaper"; - runtimeInputs = [ pkgs.coreutils pkgs.findutils ]; - text = '' - set -euo pipefail - img=$(find "${cfg.directory}" \ - -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' \) \ - | shuf -n1) - [ -n "$img" ] || exit 0 - #/usr/bin/osascript -e "tell application \"System Events\" to tell every desktop to set picture to \"$img\"" - #desktoppr "$img" - URL="file://$img" - PLIST="${config.users.users.${config.system.primaryUser}.home}/Library/Application Support/com.apple.wallpaper/Store/Index.plist" - /usr/libexec/PlistBuddy -c "set AllSpacesAndDisplays:Desktop:Content:Choices:0:Files:0:relative $URL" "$PLIST" - /usr/bin/killall WallpaperAgent 2>/dev/null || true - ''; - }; -in -{ - options.local.randomWallpaper = { - enable = lib.mkEnableOption "Random Rotating Wallpaper"; - directory = lib.mkOption { - type = lib.types.str; - description = "Folder containing images"; - }; - interval = lib.mkOption { - type = lib.types.int; - default = 1800; - description = "Seconds between wallpaper changes"; - }; - }; - - config = lib.mkIf cfg.enable { - launchd.user.agents.random-wallpaper.serviceConfig = { - Label = "org.rschanz.wallpaperDaemon"; - ProgramArguments = [ "${script}/bin/set-random-wallpaper" ]; - StartInterval = cfg.interval; - RunAtLoad = true; - ProcessType = "Background"; - }; - }; -} diff --git a/users/ryan/home.nix b/users/ryan/home.nix index 5542baa..de34c60 100644 --- a/users/ryan/home.nix +++ b/users/ryan/home.nix @@ -15,6 +15,7 @@ # My own modules ryan.neovim.enable = true; + ryan.simple-bar.enable = pkgs.stdenv.isDarwin; programs.starship = { enable = true; @@ -88,6 +89,8 @@ }; }; + + services.gpg-agent = { enable = pkgs.stdenv.isLinux; enableSshSupport = true; diff --git a/users/ryan/modules/simple-bar/default.nix b/users/ryan/modules/simple-bar/default.nix new file mode 100644 index 0000000..116216f --- /dev/null +++ b/users/ryan/modules/simple-bar/default.nix @@ -0,0 +1,35 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.ryan.simple-bar; + # Fetch the git repo at a specific rev + "simple-bar-upstream" = builtins.fetchGit { + url = "https://github.com/Jean-Tinland/simple-bar"; + rev = "fb5cada548a05bd01f727772c0a18fd8c7f65b42"; + shallow = true; + }; +in +{ + options.ryan.simple-bar.enable = mkEnableOption "simple-bar"; + + config = mkIf cfg.enable { + home.file."Library/Application Support/Übersicht/widgets/simple-bar" = { + source = simple-bar-upstream; + recursive = false; + }; + home.file.".simplebarrc".source = ./simplebarrc; + + # Install the LaunchD services + launchd.agents.simple-bar-server = import ./server.nix { inherit config lib pkgs; }; + + launchd.agents.ubersicht = { + enable = true; + config = { + ProgramArguments = [ "/usr/bin/open" "-a" "Übersicht" ]; + RunAtLoad = true; + }; + }; + }; +} diff --git a/users/ryan/modules/simple-bar/server.nix b/users/ryan/modules/simple-bar/server.nix new file mode 100644 index 0000000..f9b636c --- /dev/null +++ b/users/ryan/modules/simple-bar/server.nix @@ -0,0 +1,34 @@ +{ pkgs, lib, ... }: +let + src = builtins.fetchGit { + url = "https://github.com/Jean-Tinland/simple-bar-server.git"; + rev = "0c99921d023b459e44bbba8cca6d8947262359b6"; + shallow = true; + }; + + simple-bar-server = pkgs.buildNpmPackage { + pname = "simple-bar-server"; + version = "0-unstable"; + inherit src; + + npmDepsHash = "sha256-JKUiOqAAoE/TJriErvaaT03uKtX8t1gFh+JzG4GcriI="; + dontNpmBuild = true; # no build script, it's just a server + + installPhase = '' + runHook preInstall + mkdir -p $out/lib/simple-bar-server + cp -r . $out/lib/simple-bar-server/ + runHook postInstall + ''; + }; +in +{ + enable = true; + config = { + ProgramArguments = [ "${pkgs.nodejs}/bin/node" "${simple-bar-server}/lib/simple-bar-server/index.js" ]; + KeepAlive = true; + RunAtLoad = true; + StandardOutPath = "/tmp/simple-bar-server.out.log"; + StandardErrorPath = "/tmp/simple-bar-server.err.log"; + }; +} diff --git a/users/ryan/modules/simple-bar/simplebarrc b/users/ryan/modules/simple-bar/simplebarrc new file mode 100644 index 0000000..8c32fb1 --- /dev/null +++ b/users/ryan/modules/simple-bar/simplebarrc @@ -0,0 +1,289 @@ +{ + "$schema": "https://raw.githubusercontent.com/Jean-Tinland/simple-bar/refs/heads/master/lib/schemas/config.json", + "global": { + "theme": "auto", + "compactMode": false, + "floatingBar": false, + "noBarBg": false, + "noColorInData": true, + "bottomBar": false, + "sideDecoration": false, + "inlineSpacesOptions": false, + "disableAnimations": false, + "spacesBackgroundColorAsForeground": false, + "widgetsBackgroundColorAsForeground": false, + "widgetMaxWidth": "160px", + "slidingAnimationPace": 4, + "font": "JetBrains Mono, Monaco, Menlo, monospace", + "fontSize": "11px", + "yabaiPath": "$(which yabai)", + "aerospacePath": "$(which aerospace)", + "windowManager": "yabai", + "shell": "sh", + "terminal": "Terminal", + "disableNotifications": false, + "enableMissives": false, + "enableServer": true, + "serverSocketPort": 7777, + "yabaiServerRefresh": true, + "aerospaceServerRefresh": false + }, + "themes": { + "lightTheme": "NightShiftLight", + "darkTheme": "NightShiftDark", + "colorMain": "", + "colorMainAlt": "", + "colorMinor": "", + "colorAccent": "", + "colorRed": "", + "colorGreen": "", + "colorYellow": "", + "colorOrange": "", + "colorBlue": "", + "colorMagenta": "", + "colorCyan": "", + "colorBlack": "", + "colorWhite": "", + "colorForeground": "", + "colorBackground": "" + }, + "process": { + "showOnDisplay": "", + "displayForFocusedSpace": false, + "displayOnlyCurrent": false, + "centered": false, + "showCurrentSpaceMode": false, + "hideWindowTitle": false, + "displayOnlyIcon": true, + "expandAllProcesses": false, + "displaySkhdMode": false, + "displayStackIndex": true, + "displayOnlyCurrentStack": false + }, + "spacesDisplay": { + "showOnDisplay": "", + "exclusions": "", + "titleExclusions": "", + "spacesExclusions": "", + "exclusionsAsRegex": false, + "displayAllSpacesOnAllScreens": false, + "hideDuplicateAppsInSpaces": false, + "displayStickyWindowsSeparately": false, + "hideCreateSpaceButton": false, + "hideEmptySpaces": false, + "showOptionsOnHover": true, + "switchSpacesWithoutYabai": false, + "customAeroSpaceDisplayIndexes": {} + }, + "widgets": { + "processWidget": true, + "githubWidget": false, + "weatherWidget": true, + "netstatsWidget": false, + "cpuWidget": false, + "gpuWidget": false, + "memoryWidget": true, + "batteryWidget": true, + "wifiWidget": true, + "vpnWidget": false, + "zoomWidget": false, + "soundWidget": true, + "micWidget": false, + "dateWidget": true, + "timeWidget": true, + "keyboardWidget": false, + "spotifyWidget": false, + "cryptoWidget": false, + "stockWidget": false, + "youtubeMusicWidget": false, + "musicWidget": true, + "mpdWidget": false, + "browserTrackWidget": false, + "notificationsWidget": false, + "nextMeetingWidget": false + }, + "githubWidgetOptions": { + "refreshFrequency": 600000, + "showOnDisplay": "", + "showIcon": true, + "hideWhenNoNotification": false, + "notificationUrl": "https://github.com/notifications", + "ghBinaryPath": "/opt/homebrew/bin/gh" + }, + "weatherWidgetOptions": { + "refreshFrequency": 1800000, + "showOnDisplay": "", + "showIcon": true, + "unit": "F", + "hideLocation": false, + "hideGradient": false, + "customLocation": "" + }, + "netstatsWidgetOptions": { + "refreshFrequency": 2000, + "showOnDisplay": "", + "showIcon": true, + "displayAsGraph": true, + "netstatsThreshold": 0 + }, + "cpuWidgetOptions": { + "refreshFrequency": 2000, + "showOnDisplay": "", + "showIcon": true, + "displayAsGraph": false, + "cpuUsageThreshold": 0, + "cpuMonitorApp": "Activity Monitor" + }, + "gpuWidgetOptions": { + "refreshFrequency": 3000, + "showOnDisplay": "", + "showIcon": true, + "displayAsGraph": false, + "gpuMacmonBinaryPath": "/opt/homebrew/bin/macmon" + }, + "memoryWidgetOptions": { + "refreshFrequency": 8000, + "showOnDisplay": "", + "showIcon": true, + "memoryUsageThreshold": 0, + "memoryMonitorApp": "Activity Monitor" + }, + "batteryWidgetOptions": { + "refreshFrequency": 10000, + "showOnDisplay": "", + "showIcon": true, + "toggleCaffeinateOnClick": true, + "disableCaffeinateInvertedBackground": false, + "caffeinateOption": "" + }, + "networkWidgetOptions": { + "refreshFrequency": 60000, + "showOnDisplay": "", + "showIcon": true, + "networkDevice": "en0", + "hideWifiIfDisabled": false, + "toggleWifiOnClick": false, + "hideNetworkName": true + }, + "vpnWidgetOptions": { + "refreshFrequency": 8000, + "showOnDisplay": "", + "showIcon": true, + "vpnConnectionName": "", + "vpnShowConnectionName": false + }, + "zoomWidgetOptions": { + "refreshFrequency": 5000, + "showOnDisplay": "", + "showVideo": true, + "showMic": true + }, + "soundWidgetOptions": { + "refreshFrequency": 20000, + "showOnDisplay": "", + "showIcon": true + }, + "micWidgetOptions": { + "refreshFrequency": 20000, + "showOnDisplay": "", + "showIcon": true + }, + "dateWidgetOptions": { + "refreshFrequency": 30000, + "showOnDisplay": "", + "showIcon": true, + "shortDateFormat": true, + "locale": "en-UK", + "calendarApp": "" + }, + "timeWidgetOptions": { + "refreshFrequency": 1000, + "showOnDisplay": "", + "showIcon": true, + "hour12": false, + "dayProgress": false, + "showSeconds": true + }, + "keyboardWidgetOptions": { + "refreshFrequency": 20000, + "showOnDisplay": "", + "showIcon": true, + "keyboardMaxLength": 0 + }, + "cryptoWidgetOptions": { + "refreshFrequency": 300000, + "showOnDisplay": "", + "showIcon": true, + "denomination": "usd", + "identifiers": "bitcoin,ethereum,celo", + "precision": 5 + }, + "stockWidgetOptions": { + "refreshFrequency": 900000, + "showOnDisplay": "", + "showIcon": true, + "yahooFinanceApiKey": "YOUR_API_KEY", + "symbols": "AAPL,TSLA", + "showSymbol": true, + "showCurrency": true, + "showMarketPrice": true, + "showMarketChange": false, + "showMarketPercent": true, + "showColor": true + }, + "spotifyWidgetOptions": { + "refreshFrequency": 10000, + "showOnDisplay": "", + "showIcon": true, + "showSpecter": true, + "showSpotifyMetadata": true + }, + "youtubeMusicWidgetOptions": { + "refreshFrequency": 10000, + "showOnDisplay": "", + "showIcon": true, + "showSpecter": true, + "youtubeMusicPort": 26538 + }, + "musicWidgetOptions": { + "refreshFrequency": 10000, + "showOnDisplay": "", + "showIcon": true, + "showSpecter": true + }, + "mpdWidgetOptions": { + "refreshFrequency": 10000, + "showOnDisplay": "", + "showIcon": true, + "showSpecter": true, + "mpdBinaryPath": "/opt/homebrew/bin/mpc", + "mpdPort": "6600", + "mpdHost": "127.0.0.1", + "mpdFormatString": "%title%[ - %artist%]|[%file%]" + }, + "browserTrackWidgetOptions": { + "refreshFrequency": 10000, + "showOnDisplay": "", + "showIcon": true, + "showSpecter": true + }, + "notificationsWidgetOptions": { + "refreshFrequency": 10000, + "showOnDisplay": "", + "excludedApps": "" + }, + "nextMeetingWidgetOptions": { + "refreshFrequency": 60000, + "showOnDisplay": "", + "showJoinButton": true, + "showTimeOnly": false, + "icalBuddyPath": "", + "lookAheadHours": 12 + }, + "userWidgets": { + "userWidgetsList": {} + }, + "customStyles": { + "styles": "/* your custom css styles here */" + } +} -- cgit v1.3