2022-08-29 15:40:41 +03:00
|
|
|
{ lib, config, pkgs, ... }:
|
2022-08-24 23:54:30 +03:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
2022-08-28 23:35:11 +03:00
|
|
|
cfg = config.ui.polybar;
|
2022-08-25 10:24:46 +03:00
|
|
|
pcfg = config.services.polybar;
|
2022-08-24 23:54:30 +03:00
|
|
|
|
2022-08-25 10:54:11 +03:00
|
|
|
# TODO: create a theme
|
2022-08-24 23:54:30 +03:00
|
|
|
colors = {
|
|
|
|
orange = "#ee9a00";
|
2022-10-02 21:17:34 +03:00
|
|
|
red = "#ff5555";
|
|
|
|
green = "#50fa7b";
|
2022-08-24 23:54:30 +03:00
|
|
|
};
|
2022-08-25 10:54:11 +03:00
|
|
|
|
|
|
|
polybarConfig = import ./config.nix { inherit lib config pkgs colors; };
|
2022-08-24 23:54:30 +03:00
|
|
|
in
|
|
|
|
{
|
2022-08-28 23:35:11 +03:00
|
|
|
options.ui.polybar = {
|
2022-08-24 23:54:30 +03:00
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Enable polybar status bar";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2022-08-25 10:24:46 +03:00
|
|
|
systemd.user.services.polybar = {
|
|
|
|
# Add additional /usr/bin to run custom scripts
|
2022-08-27 23:41:37 +03:00
|
|
|
Service.Environment = mkForce "PATH=${pcfg.package}/bin:/run/current-system/sw/bin";
|
2022-08-25 10:24:46 +03:00
|
|
|
};
|
|
|
|
|
2022-08-24 23:54:30 +03:00
|
|
|
services.polybar = {
|
|
|
|
enable = true;
|
2022-09-26 00:52:49 +03:00
|
|
|
script = "MONITOR=$(xrandr | grep \"connected primary\" | awk '{print $1;}') polybar &";
|
2022-08-25 10:54:11 +03:00
|
|
|
settings = polybarConfig;
|
2022-08-24 23:54:30 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|