nixos-config/modules/programs/waybar.nix

220 lines
6.2 KiB
Nix
Raw Normal View History

2022-09-17 16:50:50 +02:00
#
# Bar
#
{ config, lib, user, pkgs, ...}:
2022-09-17 16:50:50 +02:00
{
environment.systemPackages = with pkgs; [
waybar
];
nixpkgs.overlays = [ # Waybar needs to be compiled with the experimental flag for wlr/workspaces to work
(self: super: {
waybar = super.waybar.overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
});
})
];
home-manager.users.${user} = { # Home-manager waybar config
2022-09-17 16:50:50 +02:00
programs.waybar = {
enable = true;
2022-10-16 22:21:18 +02:00
#systemd = {
# enable = true;
# target = "sway-session.target"; # Needed for waybar to start automatically
#};
2022-09-17 16:50:50 +02:00
style = ''
* {
border: none;
font-family: FiraCode Nerd Font Mono;
2022-10-16 22:21:18 +02:00
font-size: 13px;
min-height: 0;
2022-09-17 16:50:50 +02:00
}
window#waybar {
2022-10-16 22:21:18 +02:00
background-color: rgba(43,48,59,0.3);
border-bottom: 3px solid transparent;
color: white;
2022-09-17 16:50:50 +02:00
}
workspace,
2022-10-16 22:21:18 +02:00
idle_inhibitor,
mode,
clock,
pulseaudio,
network,
mpd,
memory,
network,
window,
cpu,
disk,
2022-10-16 22:21:18 +02:00
battery {
margin: 15px;
padding: 5px;
2022-09-17 16:50:50 +02:00
}
workspaces button {
2022-09-17 16:50:50 +02:00
padding: 0 5px;
2022-10-16 22:21:18 +02:00
margin: 0 3px;
color: white;
border-bottom: 3px solid transparent;
2022-09-17 16:50:50 +02:00
}
workspaces button:hover {
2022-10-16 22:21:18 +02:00
background-color: rgba(100,100,100,0.8);
color: #808080;
2022-09-17 16:50:50 +02:00
}
workspaces button.focused {
2022-10-16 22:21:18 +02:00
background: rgba(100, 114, 125, 0.2);
border-bottom: 2px solid gray;
2022-09-17 16:50:50 +02:00
}
battery.critical {
2022-09-17 16:50:50 +02:00
color: #ff200c;
}
battery.charging {
2022-09-17 16:50:50 +02:00
color: #9ece6a;
}
2022-10-16 22:21:18 +02:00
battery.warning:not(.charging) {
background: #f53c3c;
color: white;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
pulseaudio.muted {
border-bottom: 2px solid red;
}
2022-09-17 16:50:50 +02:00
'';
settings = [{
layer = "top";
position = "top";
2022-10-16 22:21:18 +02:00
height = 22;
spacing = 10;
2022-09-17 16:50:50 +02:00
tray = { spacing = 10; };
2022-09-29 21:21:05 +02:00
modules-center = [ "clock" ];
2022-10-16 22:21:18 +02:00
#modules-left = [ "wlr/mode" "wlr/workspaces" "wlr/window" ];
modules-left = [ "wlr/workspaces" ];
modules-right = [ "idle_inhibitor" "pulseaudio" "network" "cpu" "memory" "temperature" "battery" "tray" ];
2022-09-29 21:21:05 +02:00
#modules-right = [ "cpu" "memory" "pulseaudio" "clock" "tray" ];
2022-09-17 16:50:50 +02:00
"sway/workspaces" = {
2022-10-16 22:21:18 +02:00
format = "<span font='14'>{icon}</span>";
2022-09-17 16:50:50 +02:00
format-icons = {
"1"="";
"2"="";
"3"="";
"4"="";
"5"="";
};
2022-10-16 22:21:18 +02:00
all-outputs = false;
2022-09-17 16:50:50 +02:00
persistent_workspaces = {
"1" = [];
"2" = [];
"3" = [];
"4" = [];
"5" = [];
};
};
"wlr/workspaces" = {
2022-10-16 22:21:18 +02:00
format = "{icon}";
color = "white";
2022-09-17 16:50:50 +02:00
format-icons = {
"1"="";
"2"="";
"3"="";
"4"="";
"5"="";
};
all-outputs = true;
2022-10-16 22:21:18 +02:00
active-only = true;
2022-09-17 16:50:50 +02:00
on-click = "activate";
};
clock = {
format = "{:%b %d %H:%M}";
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
2022-10-16 22:21:18 +02:00
format-alt = "{:%A, %B %d, %Y}";
};
idle_inhibitor = {
format = "{icon}";
format-icons = {
activated = "";
deactivated = "";
};
2022-09-17 16:50:50 +02:00
};
cpu = {
2022-10-16 22:21:18 +02:00
format = "{usage}%";
2022-09-17 16:50:50 +02:00
tooltip = false;
2022-10-16 22:21:18 +02:00
interval = 2;
2022-09-17 16:50:50 +02:00
};
disk = {
2022-10-16 22:21:18 +02:00
format = "{percentage_used}%";
2022-09-17 16:50:50 +02:00
path = "/";
interval = 30;
};
memory = {
2022-10-16 22:21:18 +02:00
format = "{}%";
interval = 5;
};
temperature = {
states = {
"good" = 50;
"warning" = 70;
"critical" = 80;
};
"thermal-zone" = 2;
"hwmon-path" = "/sys/class/hwmon/hwmon3/temp1_input";
"format" = "{icon}{temperatureC}°C";
"format-icons" = ["" "" "" "" ""];
};
backlight = {
"format" = "{icon}{percent}%";
"format-icons" = ["" ""];
"on-scroll-up" = "light -A +5%";
"on-scroll-down" = "light -U -5%";
2022-09-17 16:50:50 +02:00
};
battery = {
interval = 60;
states = {
2022-10-16 22:21:18 +02:00
good = 95;
warning = 20;
critical = 5;
2022-09-17 16:50:50 +02:00
};
2022-10-16 22:21:18 +02:00
format = "{icon}{capacity}%";
format-charging = "{capacity}%";
format-plugged = "{capacity}%";
format-alt = "{icon}{time}";
2022-09-17 16:50:50 +02:00
format-icons = ["" "" "" "" ""];
};
network = {
2022-10-16 22:21:18 +02:00
format-wifi = "";
format-ethernet = " {ifname}: {ipaddr}/{cidr}";
format-linked = "{ifname} (No IP)";
format-disconnected = "Not connected";
2022-09-17 16:50:50 +02:00
format-alt = "{ifname}: {ipaddr}/{cidr}";
tooltip-format = "{essid} {signalStrength}%";
on-click-right = "${pkgs.alacritty}/bin/alacritty -e nmtui";
};
pulseaudio = {
2022-10-16 22:21:18 +02:00
format = "{icon}{volume}% {format_source}";
format-bluetooth = "{icon}{volume}% {format_source}";
format-bluetooth-muted = "{volume}% {format_source}";
format-muted = "{format_source}";
format-source = "{volume}%";
#format-source = "<span font='14'></span>";
format-source-muted = "";
2022-09-17 16:50:50 +02:00
format-icons = {
default = [ "" "" "" ];
2022-10-16 22:21:18 +02:00
headphones = "";
handsfree = "";
headset = "";
2022-09-17 16:50:50 +02:00
};
tooltip-format = "{desc}, {volume}%";
on-click-right = "${pkgs.pamixer}/bin/pamixer --default-source -t";
2022-10-16 22:21:18 +02:00
on-click = "${pkgs.pavucontrol}/bin/pavucontrol";
2022-09-17 16:50:50 +02:00
};
}];
};
};
}