39 lines
864 B
Nix
39 lines
864 B
Nix
{ lib, config, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.ui.polybar;
|
|
pcfg = config.services.polybar;
|
|
|
|
# TODO: create a theme
|
|
colors = {
|
|
orange = "#ee9a00";
|
|
red = "#ff5555";
|
|
green = "#50fa7b";
|
|
};
|
|
|
|
polybarConfig = import ./config.nix { inherit lib config pkgs colors; };
|
|
in
|
|
{
|
|
options.ui.polybar = {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = "Enable polybar status bar";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
systemd.user.services.polybar = {
|
|
# Add additional /usr/bin to run custom scripts
|
|
Service.Environment = mkForce "PATH=${pcfg.package}/bin:/run/current-system/sw/bin";
|
|
};
|
|
|
|
services.polybar = {
|
|
enable = true;
|
|
script = "MONITOR=$(xrandr | grep \"connected primary\" | awk '{print $1;}') polybar &";
|
|
settings = polybarConfig;
|
|
};
|
|
};
|
|
}
|