{ pkgs, lib, config, ... }: { home.packages = with pkgs; [ playerctl ]; programs.waybar = { enable = true; systemd = { enable = true; target = "graphical-session.target"; }; style = lib.mkAfter (builtins.readFile ./waybar.css); settings = { mainBar = { layer = "top"; position = "top"; output = [ "eDP-1" "HDMI-A-1" ]; mode = "dock"; spacing = "8"; modules-left = [ "niri/workspaces" "tray" "niri/window" ]; modules-center = [ "privacy" "clock" "custom/swaync" ]; modules-right = [ "group/system-tray" #"image" "group/status-infos" "custom/wlogout" ]; "group/system-tray" = { orientation = "inherit"; modules = [ "mpris" "wireplumber" "bluetooth" "backlight" "network" "power-profiles-daemon" "idle_inhibitor" ]; }; "group/status-infos" = { orientation = "inherit"; modules = [ "custom/weather" "temperature" "cpu" "memory" "disk" # "battery" "upower" ]; }; "niri/workspaces" = { format = "{icon}"; }; "niri/window" = { separate-outputs = true; icon = true; }; network = { interface = "wlo1"; format = "{ifname}"; format-wifi = " "; format-ethernet = "󰈀 "; format-linked = "󱘖 "; format-disconnected = "󰣽 "; tooltip-format = "{ifname} via {gwaddr}"; tooltip-format-wifi = "{essid} ({signalStrength}%)"; tooltip-format-ethernet = "{ifname} {ipaddr}/{cidr}"; tooltip-format-disconnected = "Disconnected"; max-length = 50; }; clock = { format = "{:%a, %d. %b %H:%M}"; tooltip-format = "{calendar}"; calendar = { mode = "month"; weeks-pos = "right"; on-scroll = 1; on-click-right = "mode"; format = { #months = "{}"; #days = "{}"; #weeks = "W{}"; #weekdays = "{}"; #weekdays = "{}"; today = "{}"; }; }; actions = { on-click-right = "mode"; on-click-forward = "tz_up"; on-click-backward = "tz_down"; on-scroll-up = "shift_down"; on-scroll-down = "shift_up"; }; }; upower = { icon-size = 14; }; battery = { format = "{capacity}% {icon}"; format-icons = [ "󰂎" # 0% "󰁺" # 10% "󰁻" # 20% "󰁼" # 30% "󰁽" # 40% "󰁾" # 50% "󰁿" # 60% "󰂀" # 70% "󰂁" # 80% "󰂂" # 90% "󱟢" # 100% ]; states = { warning = 25; critical = 15; }; events = let mkNotifySendCommand = { summary, urgency ? null, body ? null, icon ? null, category ? null, }: let body-part = if body != null then "'${body}'" else ""; urgency-part = if urgency != null then "--urgency ${urgency}" else ""; icon-part = if icon != null then "--icon ${icon}" else ""; category-part = if category != null then "--category ${category}" else ""; in "${lib.getBin pkgs.libnotify}/bin/notify-send ${urgency-part} ${icon-part} ${category-part} '${summary}' ${body-part}"; in { on-discharging-warning = mkNotifySendCommand { summary = "Low Battery"; icon = "battery-caution"; category = "device"; }; on-discharging-critical = mkNotifySendCommand { urgency = "critical"; summary = "Very Low Battery"; body = "Connect to power now!"; icon = "battery-low"; category = "device"; }; }; }; backlight = { device = "intel_backlight"; format = "{percent}%  "; on-scroll-down = "light -U 1"; on-scroll-up = "light -A 1"; }; cpu = { interval = 1; format = "{usage:3}%@{avg_frequency:4}"; }; disk = { format = "{free}/{total}"; }; "custom/wlogout" = { format = " "; tooltip = false; on-click = "wlogout"; min-width = 20; }; idle_inhibitor = { format = "{icon} "; format-icons = { activated = ""; deactivated = ""; }; }; #image = # let # albumArtScript = pkgs.writeShellScriptBin "album-art.sh" '' # #!${pkgs.bash}/bin/bash # album_art=$(playerctl metadata mpris:artUrl) # if [[ -z $album_art ]] # then # exit # fi # curl -s "''${album_art}" --output "/tmp/cover.jpeg" # echo "/tmp/cover.jpeg" # ''; # in # { # exec = "${albumArtScript}/bin/album-art.sh"; # interval = 15; # on-click = "playerctl play-pause"; # }; mpris = { format = "{status_icon} {player} "; tooltip-format = "{player} ({status_icon} {status}) {dynamic}"; status-icons = { playing = ""; paused = "󰏤"; stopped = "󰓛"; }; }; memory = { format = "{}%  "; }; power-profiles-daemon = { format = "{icon}"; tooltip-format = "Power profile: {profile}\nDriver: {driver}"; tooltip = true; format-icons = { default = ""; performance = ""; balanced = ""; power-saver = ""; }; }; wireplumber = { format = "{volume}% {icon}"; format-muted = ""; format-icons = [ "" "" "" ]; }; temperature = { format = "{temperatureC}°C "; }; tray = { spacing = 4; show-passive-items = true; }; bluetooth = { format = "  {status} "; format-connected = "  {device_alias} "; format-connected-battery = "  {device_alias} {device_battery_percentage}% "; tooltip-format = "{controller_alias}\t{controller_address}\n\n{num_connections} connected"; tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}"; tooltip-format-enumerate-connected = "{device_alias}\t{device_address}"; tooltip-format-enumerate-connected-battery = "{device_alias}\t{device_address}\t{device_battery_percentage}%"; }; "custom/swaync" = let swaync-client = "${lib.getBin config.services.swaync.package}/bin/swaync-client"; in { tooltip = true; format = "{icon} {0} "; format-icons = { notification = "󱅫"; none = "󰂜"; dnd-notification = "󰂠"; dnd-none = "󰪓"; inhibited-notification = "󰂛"; inhibited-none = "󰪑"; dnd-inhibited-notification = "󰂛"; dnd-inhibited-none = "󰪑"; }; return-type = "json"; exec = "${swaync-client} --subscribe-waybar"; on-click = "${swaync-client} --toggle-panel --skip-wait"; on-click-right = "${swaync-client} --toggle-dnd --skip-wait"; escape = true; }; "custom/weather" = { format = "{}°"; tooltip = true; interval = 3600; exec = "${lib.getBin pkgs.wttrbar}/bin/wttrbar --nerd"; return-type = "json"; }; }; }; }; }