default.nix (2164B)
1 { config, pkgs, lib, ... }: 2 3 with lib; 4 5 { 6 options.polybar = { 7 enable = mkEnableOption "Polybar"; 8 colours = { 9 background = mkOption { 10 type = types.str; 11 default = "#222"; 12 example = "#123456"; 13 description = "The background colour of the bar."; 14 }; 15 background-alt = mkOption { 16 type = types.str; 17 default = "#444"; 18 example = "#123456"; 19 description = "A colour that replaces the background in some modules."; 20 }; 21 foreground = mkOption { 22 type = types.str; 23 default = "#dfdfdf"; 24 example = "#123456"; 25 description = "The foreground (text) colour of the bar."; 26 }; 27 foreground-alt = mkOption { 28 type = types.str; 29 default = "#555"; 30 example = "#123456"; 31 description = "A colour that replaces the foreground in some modules."; 32 }; 33 alert = mkOption { 34 type = types.str; 35 default = "#bd2c40"; 36 example = "#123456"; 37 description = "A colour used when an alert happens (usually wm modules I think)."; 38 }; 39 wm-underline = mkOption { 40 type = types.str; 41 default = "#ffb52a"; 42 example = "#123456"; 43 description = "The colour used for underlining the wm module"; 44 }; 45 date-underline = mkOption { 46 type = types.str; 47 default = "#ffb52a"; 48 example = "#123456"; 49 description = "The colour used for underlining the date module"; 50 }; 51 battery-underline = mkOption { 52 type = types.str; 53 default = "#ffb52a"; 54 example = "#123456"; 55 description = "The colour used for underlining the battery module"; 56 }; 57 }; 58 }; 59 60 config = mkIf config.polybar.enable { 61 services.polybar = { 62 enable = true; 63 64 script = '' 65 # Terminate already running bar instances 66 #killall -q polybar 67 68 # Wait until the processes have been shut down 69 #while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done 70 71 # Launch Polybar 72 polybar -rq bar & 73 ''; 74 75 settings = import ./settings.nix { inherit config; }; 76 }; 77 }; 78 }