system/users/jan/ui/polybar/config.nix

138 lines
2.7 KiB
Nix

{ lib, config, pkgs, colors }:
with lib;
let
mkWifi = interface: {
type = "internal/network";
interval = 3;
interface = {
text = interface;
type = "wireless";
};
label.connected = "%essid% %signal%";
format.connected = {
prefix = "| ";
suffix = "%";
};
};
padding = 1;
in
{
"bar/main" = {
monitor = "\${env:MONITOR:DisplayPort-1}";
width = "100%";
height = "20px";
font = [
"Fira Code:size=9:antialias=true"
"Fira Code:bold:size=9:antialias=true"
"FiraCode Nerd Font Mono:size=9:antialias=true"
"FiraCode Nerd Font Mono:size=14:antialias=true"
];
radius = 0;
modules = {
left = "xmonad";
center = "date wifi_home wifi_laptop";
right = "exchangerate volume battery lang time";
};
};
"module/date" = {
type = "internal/date";
interval = 10;
date = "%a %d %b %Y";
label = "%date%";
format = { inherit padding; };
};
"module/time" = {
type = "internal/date";
time = "%H:%M:%S";
label = {
text = "%time%";
font = 2;
foreground = colors.orange;
};
};
"module/lang" = {
type = "internal/xkeyboard";
format = {
inherit padding;
text = "<label-layout>";
};
label.layout.font = 2;
};
"module/volume" = {
type = "custom/script";
exec = "~/scripts/get_volume.sh";
interval = 1;
format = {
inherit padding;
prefix = "%{T4}%{T-} ";
};
};
"module/battery" = {
type = "internal/battery";
full-at = 99;
low-at = 10;
battery = "BAT0";
adapter = "AC0";
format.charging = {
inherit padding;
text = "%{T3}%{T-} <label-charging>";
foreground = colors.green;
};
format.discharging = {
inherit padding;
text = "%{T3}<ramp-capacity>%{T-} <label-discharging>";
foreground = colors.orange;
};
format.full = {
inherit padding;
text = "%{T3}%{T-} <label-full>";
foreground = colors.green;
};
format.low = {
inherit padding;
text = "%{T3}%{T-} <label-low>";
foreground = colors.red;
};
# Only applies if <ramp-capacity> is used
ramp.capacity = [ "" "" "" "" "" ];
};
"module/wifi_home" = mkWifi "wlp11s0f3u2";
"module/wifi_laptop" = mkWifi "wlp2s0";
"module/xmonad" = mkIf config.ui.xmonad.enable {
type = "custom/script";
exec = "${pkgs.xmonad-log}/bin/xmonad-log";
tail = true;
};
"module/exchangerate" = {
type = "custom/script";
exec = "~/scripts/exchangerate.sh";
interval = 60;
format = {
inherit padding;
prefix = "USD: ";
};
};
"global/wm" = {
margin = {
bottom = 0;
top = 0;
};
};
}