{ config, pkgs, lib, ... }: let mypolybar = pkgs.polybar.override { alsaSupport = true; githubSupport = true; mpdSupport = true; pulseSupport = true; }; colors = { background = "#0d0d0d"; foreground = "#ffffff"; theme = "#89adfa"; }; bluetoothScript = pkgs.callPackage ./scripts/bluetooth.nix {}; bctl = '' [module/bluetooth] type = custom/script interval = 10 exec = ${bluetoothScript}/bin/bluetooth-ctl label-foreground = ${colors.foreground} format-foreground = ${colors.theme} ''; ip = "/run/current-system/sw/bin/ip"; grep = "/run/current-system/sw/bin/grep"; awk = "/run/current-system/sw/bin/awk"; # networkingDevice = builtins.exec "ip route | grep default | awk '{print $5}'"; # networkingDevice = pkgs.runCommand "get-network-device" {} '' # ${ip} route | ${grep} default | ${awk} '{print $5}' > $out # ''; internets = '' [module/network] type = internal/network interface = wlp4s0 interval = 4.0 udspeed-minwidth = 5 accumulate-stats = true unknown-as-up = true format-connected = 直 format-connected-foreground = ${colors.theme} label-connected = %downspeed% [%essid%] label-connected-foreground = ${colors.foreground} format-disconnected = 睊 format-disconnected-foreground = ${colors.theme} label-disconnected = disconnected label-disconnected-foreground = ${colors.foreground} ''; in { services.polybar = { enable = true; package = mypolybar; config = ./config.ini; extraConfig = bctl + internets; # my savior: https://www.reddit.com/r/NixOS/comments/v8ikwq/polybar_doesnt_start_at_launch/ script = '' # echo "none" polybar mybar 2> /dev/null & disown ''; }; # home.activation.polybarStartup = lib.hm.dag.entryAfter ["writeBoundary"] '' # exec /etc/profiles/per-user/synchronous/bin/polybar -c /home/synchronous/.config/polybar/config.ini mybar & disown # ''; home.activation.polybarRestart = lib.hm.dag.entryAfter ["writeBoundary"] '' /etc/profiles/per-user/synchronous/bin/systemctl --user restart polybar ''; systemd.user.services.polybar = { Install.WantedBy = ["graphical-session.target"]; }; # home.activation.copyPolybarScriptsDir = lib.mkAfter '' # mkdir -p ~/.config/polybar/scripts # cp -r ${./scripts}/* ~/.config/polybar/scripts # chmod -R +x ~/.config/polybar/scripts # ''; }