nix/modules/home-manager/waybar.nix

356 lines
8.6 KiB
Nix
Raw Normal View History

2024-09-12 13:24:57 -05:00
{
pkgs,
style,
...
}: {
2023-10-05 13:43:28 -05:00
programs.waybar = {
enable = true;
settings = {
mainBar = {
"layer" = "top";
"position" = "bottom";
"output" = ["eDP-1" "DP-3"];
2024-09-12 13:24:57 -05:00
"height" = 50;
"modules-left" = [
"idle_inhibitor"
"sway/workspaces"
"sway/window"
];
"modules-center" = [];
2023-10-05 13:43:28 -05:00
"modules-right" = [
"mpris"
2024-09-12 11:58:24 -05:00
"network"
2024-09-12 13:24:57 -05:00
## "disk"
## TODO: will need a custom module for Disk IO
## "wireplumber" # pulseaudio module is more featureful
"pulseaudio"
2023-10-05 13:43:28 -05:00
"cpu"
"memory"
2024-09-12 11:58:24 -05:00
"temperature"
2023-10-05 13:43:28 -05:00
"backlight"
"battery"
2024-09-12 13:24:57 -05:00
"bluetooth"
2023-10-05 13:43:28 -05:00
"tray"
2024-09-12 13:24:57 -05:00
"clock"
2023-10-05 13:43:28 -05:00
];
"bluetooth" = {
"format" = "<span</span>";
2024-09-12 13:24:57 -05:00
"on-click" = "${pkgs.blueman}/bin/blueman-manager";
2023-10-05 13:43:28 -05:00
};
2024-09-12 11:58:24 -05:00
"wireplumber" = {
"format" = "{volume}% {icon}";
"on-click" = "helvum";
};
2023-10-05 13:43:28 -05:00
"sway/workspaces" = {
"disable-scroll" = false;
"persistent_workspaces" = {
};
"all-outputs" = true;
"format" = "{name}";
};
"idle_inhibitor" = {
"format" = "{icon}";
"format-icons" = {
"activated" = "󰈈";
"deactivated" = "󰈉";
};
};
"tray" = {
"icon-size" = 24;
"spacing" = 4;
};
"clock" = {
"interval" = 1;
2024-09-12 13:24:57 -05:00
"format" = "{:%a %b %d\n%H:%M:%S}";
"justify" = "center";
2023-10-05 13:43:28 -05:00
};
"cpu" = {
2024-09-12 13:24:57 -05:00
"format" = "CPU\n{usage}%";
2023-10-05 13:43:28 -05:00
"tooltip" = true;
2024-09-12 13:24:57 -05:00
"interval" = 5;
"justify" = "center";
2023-10-05 13:43:28 -05:00
};
"memory" = {
2024-09-12 13:24:57 -05:00
"format" = "RAM\n{}%";
"tooltip" = true;
"interval" = 5;
"justify" = "center";
2023-10-05 13:43:28 -05:00
};
"temperature" = {
2024-09-12 11:58:24 -05:00
/*
"thermal-zone" = 2;
"hwmon-path" = "/sys/class/hwmon/hwmon2/temp1_input";
"format-critical" = "{temperatureC}°C {icon}";
*/
2023-10-05 13:43:28 -05:00
"critical-threshold" = 80;
2024-09-12 13:24:57 -05:00
"format" = "{temperatureC}\n°C";
"justify" = "center";
2023-10-05 13:43:28 -05:00
};
"backlight" = {
# "device" = "acpi_video1";
"format" = "{percent}% {icon}";
"format-icons" = ["" ""];
};
"battery" = {
"states" = {
# "good" = 95;
"warning" = 30;
"critical" = 1;
};
"format" = "{capacity}% {time} {icon}";
"format-charging" = "{capacity}% {time} 󱐋";
"format-plugged" = "{capacity}% {time} 󰚥";
"format-alt" = "{capacity}% {icon}";
"format-good" = ""; # An empty format will hide the module
2023-10-05 13:43:28 -05:00
"format-full" = "󰁹";
"format-icons" = ["󰂎" "󰁻" "󰁽" "󰁿" "󰂂"];
};
"network" = {
2024-09-12 13:24:57 -05:00
"format-wifi" = "{bandwidthUpBits} up \n{bandwidthDownBits} down";
"format-ethernet" = "{bandwidthUpBits} up \n{bandwidthDownBits} down";
"format-linked" = "{bandwidthUpBits} up \n{bandwidthDownBits} down";
"format-disconnected" = "No Network {icon}";
"format-alt" = "{bandwidthUpBits} up \n{bandwidthDownBits} down";
"interval" = 5;
"justify" = "right";
2023-10-05 13:43:28 -05:00
};
"mpris" = {
2024-09-12 13:24:57 -05:00
"format" = "{title}\nby {artist}";
"justify" = "center";
2023-10-05 13:43:28 -05:00
};
"pulseaudio" = {
2024-09-12 11:58:24 -05:00
/*
"scroll-step" = 1, # %, can be a floa;
"format" = "{volume}% {icon} {format_source}";
"format-bluetooth" = "{volume}% {icon} {format_source}";
"format-bluetooth-muted" = " {icon} {format_source}";
"format-muted" = " {format_source}";
*/
2024-09-12 13:24:57 -05:00
"format" = "{volume}%\n{format_source}";
"format-muted" = "MUTE\n{format_source}";
"format-source" = "HOT";
"format-source-muted" = "OFF";
2023-10-05 13:43:28 -05:00
# TODO: toggle mute?
2024-09-12 13:24:57 -05:00
"on-click" = "${pkgs.pavucontrol}/bin/pavucontrol";
"justify" = "center";
2023-10-05 13:43:28 -05:00
};
};
};
style = let
border-width = "0px";
in
2024-09-12 11:22:43 -05:00
with style.colors.withHashPrefix; ''
2023-10-05 13:43:28 -05:00
* {
border-radius: 0;
2024-09-12 11:22:43 -05:00
font-family: "${style.font.name}", "Symbols Nerd Font Mono", sans-serif;
2023-10-05 13:43:28 -05:00
font-size: 16px;
}
window#waybar {
min-height: 32px;
background-color: ${bg};
color: ${text};
border-top: solid ${blue} ${border-width};
transition: none;
}
window#waybar.hidden {
/* opacity: 0.2; */
}
window#waybar.empty {
/* opacity: 0.2; */
}
#workspaces button {
padding: 0 0.75em;
background-color: transparent;
border-top: solid ${primary} ${border-width};
transition: none;
color: ${fgdim};
background-color: ${bg};
}
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
}
#workspaces button.active {
color: ${text};
background-color: ${bg};
}
#workspaces button.visible {
color: ${fgdim};
background-color: ${bg};
}
/* A workspace that is persistent but has windows in it */
#workspaces button.persistent {
color: ${fgdim};
}
#workspaces button.focused {
color: ${bg};
background-color: ${primary};
}
#workspaces button.urgent {
background-color: ${urgent};
color: ${bg};
border-top: solid ${urgent} ${border-width};
}
#mode {
background-color: transparent;
}
#clock,
#battery,
#cpu,
#memory,
#temperature,
#backlight,
#network,
#pulseaudio,
#custom-media,
#tray,
#mode,
#idle_inhibitor,
#mpris,
#window,
#mpd {
margin-top: 1px;
padding: 0 0.75em;
background-color: inherit;
color: ${text};
}
#clock {}
#battery {
/* background-color: #ffffff; */
/* color: #000000; */
}
#battery.charging {
/* color: #ffffff; */
/* background-color: #26A65B; */
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
#battery.critical:not(.charging) {
background-color: ${red};
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#bluetooth,
#bluetooth.connected-battery,
#bluetooth.connected.battery,
#bluetooth.connected {
color: ${text};
}
label:focus {
/* background-color: #000000; */
}
#cpu {
/* background-color: #2ecc71; */
/* color: #000000; */
}
#memory {
/* background-color: #9b59b6; */
}
#backlight {
/* background-color: #90b1b1; */
}
#network {
/* background-color: #2980b9; */
}
#network.disconnected {
/* background-color: #f53c3c; */
}
#pulseaudio {
color: ${red};
/* background-color: #f1c40f; */
/* color: #000000; */
}
#pulseaudio.source-muted {
/* background-color: #90b1b1; */
color: ${text};
}
#custom-media {
/* background-color: #66cc99; */
/* color: #2a5c45; */
/* min-width: 100px; */
}
#custom-media.custom-spotify {
/* background-color: #66cc99; */
}
#custom-media.custom-vlc {
/* background-color: #ffa000; */
}
#temperature {
/* background-color: #f0932b; */
}
#temperature.critical {
/* background-color: #eb4d4b; */
}
#tray {
/* background-color: #2980b9; */
}
#idle_inhibitor {
/* background-color: #2d3436; */
}
#idle_inhibitor.activated {
/* background-color: #ecf0f1; */
/* color: #2d3436; */
}
#mpd {
/* background-color: #66cc99; */
/* color: #2a5c45; */
}
#mpd.disconnected {
/* background-color: #f53c3c; */
}
#mpd.stopped {
/* background-color: #90b1b1; */
}
#mpd.paused {
/* background-color: #51a37a; */
}
'';
};
}