nix/bar/polybar: move configs to a separate file

This commit is contained in:
Dmitriy Pleshevskiy 2022-08-25 10:54:11 +03:00
parent cb0bca9969
commit ab9468e9d1
Signed by: pleshevskiy
GPG key ID: 1B59187B161C0215
2 changed files with 90 additions and 81 deletions

View file

@ -0,0 +1,86 @@
{ lib, config, pkgs, colors }:
with lib;
{
"bar/main" = {
monitor = "DisplayPort-1";
width = "100%";
height = "20px";
font = [
"Fira Code:size=9:antialias=true"
"Fira Code:bold:size=0:antialias=true"
];
radius = 0;
modules = {
left = "xmonad";
center = "date wifi";
right = "volume 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;
};
label.layout.font = 2;
};
"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;
};
};
}

View file

@ -6,9 +6,12 @@ let
cfg = config.wm.bar.polybar; cfg = config.wm.bar.polybar;
pcfg = config.services.polybar; pcfg = config.services.polybar;
# TODO: create a theme
colors = { colors = {
orange = "#ee9a00"; orange = "#ee9a00";
}; };
polybarConfig = import ./config.nix { inherit lib config pkgs colors; };
in in
{ {
options.wm.bar.polybar = { options.wm.bar.polybar = {
@ -28,87 +31,7 @@ in
services.polybar = { services.polybar = {
enable = true; enable = true;
script = "polybar &"; script = "polybar &";
settings = { settings = polybarConfig;
"bar/main" = {
monitor = "DisplayPort-1";
width = "100%";
height = "20px";
font = [
"Fira Code:size=9:antialias=true"
"Fira Code:bold:size=0:antialias=true"
];
radius = 0;
modules = {
left = "xmonad";
center = "date wifi";
right = "volume 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;
};
label.layout.font = 2;
};
"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;
};
};
};
}; };
}; };
} }