212 lines
6 KiB
Nix
212 lines
6 KiB
Nix
{lib, config, pkgs, ...}:
|
|
with lib;
|
|
let
|
|
cfg = config.modules.desktop.sway;
|
|
in
|
|
{
|
|
config = mkIf cfg.enable {
|
|
programs.waybar = {
|
|
enable = true;
|
|
systemd = {
|
|
enable = true;
|
|
target = "sway-session.target";
|
|
};
|
|
settings = {
|
|
mainbar = {
|
|
layer = "top";
|
|
spacing = 6;
|
|
disable-toolptips = true;
|
|
modules-center = [
|
|
"custom/screenrecord"
|
|
];
|
|
modules-left = [
|
|
"sway/workspaces"
|
|
"sway/mode"
|
|
];
|
|
modules-right = [
|
|
"network"
|
|
"custom/sep"
|
|
] ++ (
|
|
if cfg.waybar.laptop then [
|
|
"backlight"
|
|
"battery"
|
|
"custom/sep"
|
|
]
|
|
else [
|
|
]
|
|
) ++
|
|
[
|
|
|
|
"memory"
|
|
"cpu"
|
|
"temperature"
|
|
"custom/sep"
|
|
] ++ (
|
|
if cfg.waybar.gpuThermal.enable then [
|
|
"temperature#gpu"
|
|
"custom/sep"
|
|
]
|
|
else [
|
|
]
|
|
) ++
|
|
[
|
|
"pulseaudio#input"
|
|
"pulseaudio#output"
|
|
"custom/sep"
|
|
"clock"
|
|
"custom/sep"
|
|
"privacy"
|
|
"tray"
|
|
];
|
|
"clock" = {
|
|
"format-alt" = "{:%Y-%m-%d}";
|
|
"timezone" = "Europe/Paris";
|
|
"tooltip" = false;
|
|
};
|
|
"cpu" = {
|
|
"format" = "{usage}% {icon}";
|
|
"format-icons" = [ "" ];
|
|
"states" = {
|
|
"critical" = 90;
|
|
"warning" = 70;
|
|
};
|
|
"tooltip" = false;
|
|
};
|
|
"custom/sep" = {
|
|
"format" = "|";
|
|
"tooltip" = false;
|
|
};
|
|
"custom/screenrecord" = {
|
|
"format" = " [rec.] ";
|
|
"interval" = 1;
|
|
"exec" = "echo '{\"class\": \"recording\"}'";
|
|
"exec-if" = "${pkgs.procps}/bin/pgrep wl-screenrec";
|
|
"on-click" = "exec ${pkgs.coreutils}/bin/kill -s SIGINT $(${pkgs.procps}/bin/pgrep wl-screenrec)";
|
|
"tooltype" = false;
|
|
};
|
|
"idle_inhibitor" = {
|
|
"format" = "{icon}";
|
|
"format-icons" = {
|
|
"activated" = "";
|
|
"deactivated" = "";
|
|
};
|
|
};
|
|
"memory" = {
|
|
"format" = "{used:0.0f}/{total:0.0f}G ";
|
|
"interval" = 30;
|
|
"states" = {
|
|
"critical" = 90;
|
|
"warning" = 70;
|
|
};
|
|
};
|
|
"network" = {
|
|
"format-alt" = "{ifname}: {essid} {ipaddr}/{cidr} ";
|
|
"format-disconnected" = "Disconnected ⚠ ";
|
|
"format-ethernet" = "{ifname} ";
|
|
"format-linked" = "{ifname} (No IP) ";
|
|
"format-wifi" = "{signalStrength}% ";
|
|
"tooltip" = false;
|
|
};
|
|
"privacy"= {
|
|
"icon-spacing" = 6;
|
|
"icon-size" = 11;
|
|
"transition-duration" = 250;
|
|
"modules"= [
|
|
{
|
|
"type" = "screenshare";
|
|
"tooltip" = false;
|
|
}
|
|
{
|
|
"type" = "audio-out";
|
|
"tooltip" = false;
|
|
}
|
|
{
|
|
"type" = "audio-in";
|
|
"tooltip" = false;
|
|
}
|
|
];
|
|
"ignore-monitor" = true;
|
|
};
|
|
"pulseaudio#output" = {
|
|
"format" = "{volume}% {icon} ";
|
|
"format-bluetooth" = "{volume}% {icon}";
|
|
"format-icons" = {
|
|
"car" = "";
|
|
"default" = "";
|
|
"hands-free" = "";
|
|
"headphone" = "";
|
|
"headset" = "";
|
|
"phone" = "";
|
|
"portable" = "";
|
|
};
|
|
"format-muted" = " ";
|
|
"tooltip" = false;
|
|
};
|
|
"pulseaudio#input" = {
|
|
"format" = "{format_source} ";
|
|
"format-source" = "{volume}% ";
|
|
"format-source-muted" = " ";
|
|
"tooltip" = false;
|
|
};
|
|
"sway/mode" = {
|
|
"format" = "<span style=\"italic\">{}</span>";
|
|
};
|
|
"sway/workspace" = {
|
|
"disable-scroll" = true;
|
|
};
|
|
"temperature" = {
|
|
"critical-threshold" = 80;
|
|
"format" = " {temperatureC}°C ";
|
|
"thermal-zone" = mkIf ( cfg.waybar.cpuThermal.thermalZone != "" )
|
|
"${cfg.waybar.cpuThermal.thermalZone}";
|
|
"hwmon-path-abs" = mkIf ( cfg.waybar.cpuThermal.hwmonPathAbs != "" )
|
|
"${cfg.waybar.cpuThermal.hwmonPathAbs}";
|
|
"input-filename" = mkIf ( cfg.waybar.cpuThermal.inputFilename != "" )
|
|
"${cfg.waybar.cpuThermal.inputFilename}";
|
|
};
|
|
"temperature#gpu" = {
|
|
"critical-threshold" = 80;
|
|
"format" = "GPU: {temperatureC}°C ";
|
|
"hwmon-path" = "${cfg.waybar.gpuThermal.hmonPath}";
|
|
};
|
|
"backlight" = {
|
|
"format" = "{percent}% {icon}";
|
|
"format-icons" = [
|
|
""
|
|
""
|
|
""
|
|
""
|
|
""
|
|
""
|
|
""
|
|
""
|
|
""
|
|
""
|
|
""
|
|
];
|
|
};
|
|
"battery" = {
|
|
"tooltip" = false;
|
|
"states" = {
|
|
"full" = 100;
|
|
"warning" = 30;
|
|
"critical" = 15;
|
|
};
|
|
"format" = "{capacity}% {icon}";
|
|
"format-charging" = "{capacity}% ";
|
|
"format-plugged" = "{capacity}% ";
|
|
"format-alt" = "{time} {icon}";
|
|
"format-icons" = [
|
|
" "
|
|
" "
|
|
" "
|
|
" "
|
|
" "
|
|
];
|
|
};
|
|
};
|
|
};
|
|
style = builtins.readFile ./files/waybar-style.css;
|
|
};
|
|
};
|
|
}
|