{ config, lib, pkgs, ... }: let cfg = config.reborn.waybar; in { options.reborn.waybar = { enable = lib.mkEnableOption "Reborn waybar config"; }; config = lib.mkIf cfg.enable { 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 = [ "custom/notification" "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 = ""; }; }; "custom/notification" = let swaync-client = "${lib.getBin config.home-manager.users.minijackson.services.swaync.package}/bin/swaync-client"; in { format = "{icon}"; format-icons = { notification = "󰂜"; none = "󰂜"; dnd-notification = "󰪑"; dnd-none = "󰪑"; inhibited-notification = "󰂜"; inhibited-none = "󰂜"; dnd-inhibited-notification = "󰪑"; dnd-inhibited-none = "󰪑"; }; tooltip = false; return-type = "json"; exec = "${swaync-client} -swb"; on-click = "${swaync-client} -t -sw"; on-click-right = "${swaync-client} -d -sw"; escape = true; }; 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, #custom-notification { 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; } #custom-notification { color: ${background}; background-color: ${foreground}; } #custom-notification.inhibited-notification, #custom-notification.inhibited-none, #custom-notification.dnd-inhibited-notification, #custom-notification.dnd-inhibited-none { color: ${foreground}; 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 [ ]; }; }; }; }