{ config, lib, pkgs, ... }: let scriptDir = ./../../resources/scripts/waybar; # Get all files in the scriptDir scriptFiles = builtins.filter (name: (builtins.readDir scriptDir).${name} == "regular" ) (builtins.attrNames (builtins.readDir scriptDir)); # Map to home.file entries waybarScripts = builtins.listToAttrs (map (name: { name = "bin/${name}"; value = { source = "${scriptDir}/${name}"; executable = true; }; }) scriptFiles); in { home.packages = with pkgs; [ gnugrep coreutils gawk bash ]; home.file = waybarScripts; programs.waybar = { enable = true; systemd.enable = true; settings.main = lib.mkMerge [{ command = "waybar"; layer = "top"; position = lib.mkDefault "top"; "modules-left" = lib.mkDefault [ "tray" #"custom/cpu_linux" "cpu" "temperature" "memory" "disk" "custom/nvidia" ]; "modules-center" = lib.mkDefault [ "sway/window" ]; "modules-right" = lib.mkDefault [ "group/blight" "custom/colorpicker" "idle_inhibitor" "bluetooth" "group/audio" "group/networking" "battery" "clock" ]; margin = null; spacing = 15; reload_style_on_change = true; "clock" = { format = "{:%a %d.%m.%y | Week: %U | %T}"; interval = 1; tooltip-format = "\n{:%Y %B}\n{calendar}"; calendar-weeks-pos = "right"; today-format = "{}"; format-calendar = "{}"; format-calendar-weeks = "W{:%V}"; format-calendar-weekdays = "{}"; }; "disk" = { interval = 30; format = " {percentage_used}% {free:2} free"; path = "/"; }; "memory" = { format = " {percentage}% {used:.1f}/{total:.1f} S: {swapUsed:.1f}/{swapTotal:.1f}"; }; "cpu" = { interval = 1; format = "{usage}% "; }; "custom/cpu_linux" = { exec = "~/bin/cpu_linux.sh"; "return-type" = "json"; interval = 2; format = ": {text}%"; }; "custom/nvidia" = { exec = "nvidia-smi --query-gpu=utilization.gpu,temperature.gpu --format=csv,nounits,noheader | sed 's/\\([0-9]\\+\\), \\([0-9]\\+\\)/\\1% @ \\2°C/g'"; format = " {}"; interval = 4; }; "temperature" = { format = " {temperatureC}°C"; hwmon-path = "/sys/devices/platform/coretemp.0/hwmon/hwmon7/temp1_input"; format-critical = " {temperatureC}°C"; interval = 1; critical-threshold = 80; on-click = "psensor"; }; "tray" = { icon-size = 14; spacing = 5; }; "idle_inhibitor" = { format = "{icon}"; format-icons = { activated = "󰾪 Presentation mode on"; deactivated = "󰅶"; }; }; "bluetooth" = { format-on = "󰂰"; format-off = ""; format-disabled = "󰂲"; format-connected = "󰂴"; format-connected-battery = "{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}%"; on-click = "rofi-bluetooth"; }; "pulseaudio" = { format = "{volume}% {icon}"; format-bluetooth = "󰂰"; format-muted = ""; tooltip-format = "{volume}% {icon}"; format-icons = { headphones = ""; bluetooth = "󰥰"; handsfree = ""; headset = "󱡬"; phone = ""; portable = ""; car = ""; default = [ "" ]; }; scroll-step = 5; justify = "center"; on-click = "pamixer -t"; on-click-right = "pavucontrol"; on-scroll-up = "pactl set-sink-volume @DEFAULT_SINK@ +5%"; on-scroll-down = "pactl set-sink-volume @DEFAULT_SINK@ -5%"; }; "pulseaudio#mic" = { format = "{format_source}"; format-source = ""; format-source-muted = ""; tooltip-format = "{volume}% {format_source} "; on-click = "pactl set-source-mute 1 toggle"; on-scroll-down = "pactl set-source-volume 1 -1%"; on-scroll-up = "pactl set-source-volume 1 +1%"; }; "group/audio" = { orientation = "horizontal"; modules = [ "pulseaudio" "pulseaudio#mic" ]; }; "group/networking" = { orientation = "horizontal"; modules = [ "network" "network#speed" ]; }; network = { format-wifi = " {essid}"; format-ethernet = "󰈀"; format-disconnected = "󱐅"; tooltip-format = "{ipaddr}"; tooltip-format-wifi = "{essid} ({signalStrength}%)  \n{ipaddr} | {frequency} MHz{icon}"; tooltip-format-ethernet = "{ifname} 󰈀 \n{ipaddr} | {frequency} MHz{icon} "; tooltip-format-disconnected = "Not Connected"; on-click = "networkmanager_dmenu"; }; "network#speed" = { format = "󰁅 {bandwidthDownBits:20} 󰁝 {bandwidthUpBits:20}"; interval = 1; tooltip = true; tooltip-format = "{ipaddr}"; tooltip-format-wifi = "{essid} ({signalStrength}%)  \n{ipaddr} | {frequency} MHz{icon} "; tooltip-format-ethernet = "{ifname} 󰈀 \n{ipaddr} | {frequency} MHz{icon} "; tooltip-format-disconnected = "Not Connected"; on-click = "networkmanager_dmenu"; }; "battery" = { interval = 4; states = { good = 95; warning = 30; critical = 20; }; format = "{capacity}% {icon} {power:.2f}W {time}"; format-time = "{H}h {M}min"; tooltip = "{time}"; format-charging = "{capacity}% Full at {timeTo}%"; format-plugged = "{capacity}% 󰠠"; format-icons = [ "󰪞" "󰪟" "󰪠" "󰪡" "󰪢" "󰪣" "󰪤" "󰪥" ]; }; }]; style = '' * { font-family: "JetBrainsMono Nerd Font,JetBrainsMono NF" ; color: white; } window#waybar { background: black; } .modules-right { background: #000000; } .modules-center { background: #000000; } .modules-left { background: #000000; } #battery, #custom-clipboard, #custom-colorpicker, #custom-powerDraw, #bluetooth, #pulseaudio, #network, #disk, #memory, #backlight, #cpu, #temperature, #custom-weather, #idle_inhibitor, #jack, #tray, #window, #workspaces, #clock { min-width: 1ex; padding-right: 5px; } #tray menu * { color: black; } #temperature.critical, #pulseaudio { min-width: 5ex; } #pulseaudio.muted { color: #FF0000; } #pulseaudio.mic.muted { color: #ffffff; } #pulseaudio.mic:not(.source-muted) { color: #fc0202; } #clock{ color: #f9780e; } #battery.charging { color: #ffffff; background-color: #26A65B; } #battery.warning:not(.charging) { background-color: #ffbe61; color: black; } #battery.critical:not(.charging) { background-color: #f53c3c; color: #ffffff; animation-name: blink; animation-duration: 0.5s; animation-timing-function: linear; animation-iteration-count: infinite; animation-direction: alternate; } #network.speed { min-width: 30ex; } ''; }; }