inputs:
{ config, lib, pkgs, ... }:
{
home-manager.users.minijackson = {
programs.waybar = {
enable = true;
settings = [{
layer = "top";
position = "bottom";
height = 25;
gtk-layer-shell = true;
modules-left = [ "sway/workspaces" "sway/mode" ];
modules-center = lib.mkIf config.services.mpd.enable [ "mpd" ];
modules-right = [
"idle_inhibitor"
"pulseaudio"
"network#eth"
"network#wlan"
"cpu"
"memory"
"temperature"
"backlight"
"battery"
"clock"
"tray"
];
mpd = lib.mkIf config.services.mpd.enable {
format = "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ";
format-stopped = "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ";
format-disconnected = "Disconnected ";
on-click-middle = "${pkgs.alacritty}/bin/alacritty --command ncmpcpp";
consume-icons = {
on = " ";
};
random-icons = {
on = " ";
};
repeat-icons = {
on = " ";
};
single-icons = {
on = "1 ";
};
state-icons = {
playing = "";
paused = "";
};
};
idle_inhibitor = {
format = "{icon}";
format-icons = {
activated = "";
deactivated = "";
};
on-click = let
script = pkgs.writeShellApplication {
name = "switch-idle-mode";
runtimeInputs = [pkgs.mako pkgs.gnugrep];
text = ''
if makoctl mode | grep -q do-not-disturb; then
makoctl mode -r do-not-disturb
else
makoctl mode -a do-not-disturb
fi
'';
};
in
lib.getExe script;
};
clock = {
tooltip-format = "{:%Y-%m-%d | %H:%M}";
format-alt = "{:%Y-%m-%d}";
};
cpu = { format = "{usage}% "; };
memory = { format = "{}% "; };
battery = {
states = { good = 90; };
format = "{capacity}% {icon}";
format-icons = [
""
""
""
""
""
];
};
"network#eth" = {
interface = "enp*";
format-ethernet = "{ipaddr}/{cidr} ";
format-disconnected = "Disconnected ";
};
"network#wlan" = {
interface = "wlp*";
format-wifi = "{essid} ({signalStrength}%) ";
format-disconnected = "Disconnected ";
tooltip = true;
tooltip-format-wifi = "{ipaddr}/{cidr}";
};
temperature = {
hwmon-path = "/sys/class/hwmon/hwmon0/temp1_input";
format = "{temperatureC} °C ";
};
backlight = {
format = "{percent}% {icon}";
format-icons = [ "" "" ];
};
pulseaudio = {
format = "{volume}% {icon}";
format-bluetooth = "{volume}% {icon}";
format-muted = "";
format-icons = {
headphones = "";
handsfree = "";
headset = "";
phone = "";
portable = "";
car = "";
default = [ "" "" ];
};
on-click = "pavucontrol";
};
}];
style = with config.theme.colors; ''
* {
border: none;
border-radius: 0;
font-family: mono;
font-size: 11px;
min-height: 0;
}
window#waybar {
background: ${background};
border-bottom: 3px solid ${lightBackground};
color: ${foreground};
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button {
padding: 0 5px;
background: transparent;
color: ${foreground};
border-bottom: 3px solid transparent;
}
#workspaces button.focused {
background: ${dominant};
border-bottom: 3px solid ${foreground};
}
#mode {
background: ${lightBackground};
border-bottom: 3px solid ${foreground};
}
#clock, #battery, #cpu, #memory, #temperature, #backlight, #network, #pulseaudio, #custom-mpd, #mpd, #tray, #mode, #idle_inhibitor {
padding: 0 10px;
margin: 0 5px;
}
#clock {
background-color: ${neutralMagenta};
color: ${background};
}
#battery {
background-color: ${neutralYellow};
color: ${background};
}
/*
#battery.charging {
color: ${foreground};
background-color: #26A65B;
}
*/
@keyframes blink {
to {
background-color: ${foreground};
color: ${background};
}
}
#battery.critical:not(.charging) {
background: ${fadedRed};
color: ${foreground};
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#cpu {
background: ${neutralOrange};
color: ${background};
}
#memory {
background: ${brightBlue};
color: ${background};
}
#backlight {
background: ${background6};
color: ${background};
}
#network {
background: ${neutralGreen};
color: ${background};
}
#network.disconnected {
background: ${lightBackground};
color: ${foreground};
}
#pulseaudio {
background: ${neutralCyan};
color: ${background};
}
#pulseaudio.muted {
background: ${foreground};
}
#temperature {
background: ${brightCyan};
color: ${background};
}
#temperature.critical {
background: ${fadedRed};
color: ${foreground};
}
#tray {
background-color: #2980b9;
}
#idle_inhibitor {
background-color: ${lightBackground};
}
#custom-mpd {
background-color: ${dominant};
}
#mpd {
background: ${dominant};
}
#mpd.disconnected {
background: ${lightBackground};
color: ${foreground};
}
#mpd.stopped {
background: ${foreground};
color: ${background};
}
#mpd.paused {
background: ${dimDominant};
}
'';
systemd.enable = true;
};
# Fix https://github.com/nix-community/home-manager/pull/1628
systemd.user.services.waybar.Unit = {
Requisite = lib.mkForce [];
After = lib.mkForce [];
};
};
}