nixfiles/home/waybar/default.nix
2022-12-17 20:28:07 +01:00

174 lines
4.8 KiB
Nix

{ config, lib, pkgs, nixfiles, ... }:
{
xdg.configFile."waybar/style.css" = { inherit (nixfiles.sassTemplate { name = "waybar-style"; src = ./waybar.sass; }) source; };
#systemd.user.services.waybar.Service.Environment = lib.singleton "NOTMUCH_CONFIG=${config.home.sessionVariables.NOTMUCH_CONFIG}";
programs.waybar = {
enable = true;
systemd.enable = true;
settings = [{
height = 10;
modules-left = [
"sway/workspaces"
"sway/mode"
"sway/window"
];
modules-center = [
];
modules-right = [
"pulseaudio#icon"
"pulseaudio"
"custom/headset-icon"
"custom/headset"
"custom/cpu-icon"
"cpu"
"custom/memory-icon"
"memory"
"temperature#icon"
"temperature"
"battery#icon"
"battery"
"backlight#icon"
"backlight"
"network#icon"
"network"
"idle_inhibitor"
"custom/konawall"
"custom/gpg-status"
"custom/clock"
"tray"
];
modules = {
"sway/workspaces" = {
format = "{icon}";
format-icons = {
"1" = "1:";
"2" = "2:";
"3" = "3:";
};
};
"sway/window" = {
icon = true;
icon-size = 12;
format = "{}";
};
tray = {
icon-size = 12;
spacing = 2;
};
"backlight#icon" = {
format = "{icon}";
format-icons = ["" ""];
};
backlight = {
format = "{percent}%";
};
"custom/gpg-status" = {
format = "{}";
interval = 300;
return-type = "json";
exec = "${pkgs.waybar-gpg}/bin/kat-gpg-status";
};
"custom/headset-icon" = {
format = "";
interval = 60;
exec-if = "${pkgs.headsetcontrol}/bin/headsetcontrol -c";
exec = "echo 'mew'";
};
"custom/headset" = {
format = "{}";
interval = 60;
exec-if = "${pkgs.headsetcontrol}/bin/headsetcontrol -c";
exec = "${pkgs.headsetcontrol}/bin/headsetcontrol -b | ${pkgs.gnugrep}/bin/grep Battery | ${pkgs.coreutils}/bin/cut -d ' ' -f2";
};
"custom/konawall" = {
format = "{}";
interval = "once";
return-type = "json";
exec = "${pkgs.waybar-konawall}/bin/konawall-status";
on-click = "${pkgs.waybar-konawall}/bin/konawall-toggle";
on-click-right = "systemctl --user restart konawall";
signal = 8;
};
"custom/cpu-icon".format = "";
cpu.format = "{usage}%";
"custom/memory-icon".format = "";
memory.format = "{percentage}%";
"temperature#icon" = {
format = "{icon}";
format-icons = ["" "" ""];
critical-threshold = 80;
};
temperature = {
format = "{temperatureC}°C";
critical-threshold = 80;
};
idle_inhibitor = {
format = "{icon}";
format-icons = {
activated = "";
deactivated = "";
};
};
"battery#icon" = {
states = {
good = 90;
warning = 30;
critical = 15;
};
format = "{icon}";
format-charging = "";
format-plugged = "";
format-icons = [ "" "" "" "" "" ];
};
battery = {
states = {
good = 90;
warning = 30;
critical = 15;
};
format = "{capacity}%";
format-charging = "{capacity}%";
format-plugged = "{capacity}%";
format-alt = "{time}";
};
"pulseaudio#icon" = {
format = "{icon}";
format-muted = "";
on-click = "wezterm start pulsemixer";
format-icons = {
default = [
""
""
""
];
};
};
pulseaudio = {
format = "{volume}%";
on-click = "${pkgs.wezterm}/bin/wezterm start ${pkgs.pulsemixer}/bin/pulsemixer";
};
"network#icon" = {
format-wifi = "";
format-ethernet = "";
format-linked = " ";
format-disconnected = "";
};
network = {
format-wifi = "{essid} ({signalStrength}%)";
format-ethernet = "{ipaddr}/{cidr}";
format-linked = "No IP";
format-disconnected = "Disconnected";
format-alt = "{ifname}: {ipaddr}/{cidr}";
};
"custom/clock" = {
exec = ''${pkgs.coreutils}/bin/date +"%a, %F %T %Z"'';
interval = 1;
};
};
}];
};
}