system/nix/wm/bar/polybar/default.nix

110 lines
2.3 KiB
Nix

{ lib, config, pkgs, ...}:
with lib;
let
cfg = config.wm.bar.polybar;
colors = {
orange = "#ee9a00";
};
in
{
options.wm.bar.polybar = {
enable = mkOption {
type = types.bool;
default = false;
description = "Enable polybar status bar";
};
};
config = mkIf cfg.enable {
services.polybar = {
enable = true;
script = "polybar &";
settings = {
"bar/main" = {
monitor = "DisplayPort-1";
width = "100%";
height = "16px";
font = [
"Fira Code:size=9:antialias=true"
"Fira Code:bold:size=0:antialias=true"
];
radius = 0;
modules = {
left = "xmonad";
center = "date wifi";
right = "lang time";
};
};
"module/date" = {
type = "internal/date";
interval = 10;
date = "%a %d %b %Y";
label = "%date%";
format.padding = 1;
};
"module/time" = {
type = "internal/date";
time = "%H:%M:%S";
label = {
text = "%time%";
font = 2;
foreground = colors.orange;
};
};
"module/lang" = {
type = "internal/xkeyboard";
format = {
text = "<label-layout>";
padding = 1;
};
};
# TODO: fix amixer
"module/volume" = {
type = "custom/script";
exec = "~/scripts/get_volume.sh";
interval = 1;
format = {
prefix = "Vol: ";
padding = 1;
};
};
"module/wifi" = {
type = "internal/network";
interval = 3;
interface = {
text = "wlxd03745e1e87b";
type = "wireless";
};
label.connected = "%essid% %signal%";
format.connected = {
prefix = "| ";
suffix = "%";
};
};
"module/xmonad" = mkIf config.wm.xmonad.enable {
type = "custom/script";
exec = "${pkgs.xmonad-log}/bin/xmonad-log";
tail = true;
};
"global/wm" = {
margin = {
bottom = 0;
top = 0;
};
};
};
};
};
}