{ pkgs, ... }: let waybarTimer = pkgs.writeShellScript "waybar_timer.sh" '' #!/bin/sh CUR_TIME=$(date +%s) STATUS=$(cat /var/tmp/waybar_timer) if [ $STATUS == "READY" ]; then echo "" elif [ $STATUS == "FINISHED" ]; then mpv $HOME/.config/waybar/modules/timer.wav & echo "READY" > /var/tmp/waybar_timer echo "" elif [[ $STATUS > $CUR_TIME ]]; then DIFF=$(( (STATUS - CUR_TIME) )) echo $( date -d @$DIFF +%M:%S ) else if [ -f "/var/tmp/waybar_timer" ]; then echo "FINISHED" > /var/tmp/waybar_timer echo "" else echo "READY" > /var/tmp/waybar_timer echo "" fi fi ''; in { programs.waybar = { systemd.enable = true; enable = true; settings = [ { ipc = true; layer = "top"; position = "top"; height = 36; margin = "5 5 0 5"; modules-left = [ "custom/startmenu" "hyprland/workspaces" "idle_inhibitor" "keyboard-state" "hyprland/language" "systemd-failed-units" "wireplumber" "privacy" "hyprland/window" ]; modules-center = [ "clock" "custom/timer" "mpris" ]; modules-right = [ "network" "temperature" "load" "group/system-status" "bluetooth" "tray" "custom/weather" "custom/exit" ]; "hyprland/workspaces" = { format = "{name}"; format-icons = { default = " "; active = " "; urgent = " "; }; on-scroll-up = "${pkgs.hyprland}/bin/hyprctl dispatch workspace e+1"; on-scroll-down = "${pkgs.hyprland}/bin/hyprctl dispatch workspace e-1"; }; clock = { interval = 1; format = "{:%A, %Y-%m-%d %H:%M:%S}"; tooltip-format = "{:%Y %B}\n{calendar}"; calendar = { mode = "year"; weeks-pos = "right"; mode-mon-col = 3; format = { months = "{}"; days = "{}"; weeks = "W{}"; weekdays = "{}"; today = "{}"; }; }; }; "hyprland/window" = { max-length = 80; separate-outputs = true; icon = true; rewrite = { "" = "🙈 No Windows?"; }; }; "hyprland/language" = { format = "{long}"; min-length = 14; }; "keyboard-state" = { capslock = true; format = "{icon}"; format-icons = { locked = ""; unlocked = ""; }; tooltip = false; }; "custom/weather" = { format = "{}°C"; tooltip = true; interval = 3600; exec = "${pkgs.wttrbar}/bin/wttrbar --date-format=%d.%m.%Y --location=Helsinki"; return-type = "json"; }; "group/system-status" = { orientation = "horizontal"; modules = [ "cpu" "memory" "battery" "backlight" ]; }; memory = { interval = 1; format = " {}%"; tooltip-format = "{used:0.1f}G / {total:0.1f}G"; states = { warning = 70; critical = 90; }; }; load = { interval = 1; format = "load: {load1:>4}"; max-length = 10; }; cpu = { interval = 1; format = " {usage:>3}%"; tooltip-format = "{usage}%"; tooltip = true; states = { warning = 70; critical = 90; }; }; backlight = { device = "intel_backlight"; format = "{icon} {percent}%"; format-icons = [ "" ]; on-scroll-up = "${pkgs.brightnessctl}/bin/brightnessctl set +1%"; on-scroll-down = "${pkgs.brightnessctl}/bin/brightnessctl set 1%-"; }; systemd-failed-units = { hide-on-ok = false; format = "✗ {nr_failed}"; format-ok = "✓"; system = true; }; temperature = { format = "{temperatureC}°C "; }; privacy = { icon-spacing = 4; icon-size = 18; transition-duration = 250; modules = [ { type = "screenshare"; tooltip = true; tooltip-icon-size = 24; } { type = "audio-out"; tooltip = true; tooltip-icon-size = 24; } { type = "audio-in"; tooltip = true; tooltip-icon-size = 24; } ]; ignore-monitor = true; }; network = { tooltip = true; interval = 1; format-wifi = "{icon} {essid} ({signalStrength}) up: {bandwidthUpBits:>6} down: {bandwidthDownBits:>6}"; format-ethernet = "{icon} up: {bandwidthUpBits:>6} down: {bandwidthDownBits:>6}"; format-disconnected = "⚠ Disconnected"; tooltip-format = "{ifname}: {ipaddr}/{cidr}\nUp: {bandwidthUpBits:>6}\nDown: {bandwidthDownBits:>6}"; format-icons = { wifi = ""; ethernet = ""; }; }; tray = { spacing = 12; }; 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}%"; }; mpris = { format = "DEFAULT: {player_icon} {dynamic}"; format-paused = "DEFAULT: {status_icon} {dynamic}"; interval = 1; player-icons = { default = "▶"; mpv = "🎵"; }; status-icons = { paused = "⏸"; }; }; wireplumber = { format = "{icon} {volume}%"; format-muted = " {volume}%"; format-icons = { default = [ "" "" "" ]; }; on-click = "${pkgs.lxqt.pavucontrol-qt}/bin/pavucontrol-qt"; }; "custom/timer" = { tooltip = false; min-length = 5; exec = "${waybarTimer}"; on-click = "date --date='5 minutes' +%s > /var/tmp/waybar_timer"; on-click-right = "echo READY > /var/tmp/waybar_timer"; on-click-middle = "date --date='1 minute' +%s > /var/tmp/waybar_timer"; on-scroll-up = "date --date='5 seconds' +%s > /var/tmp/waybar_timer"; on-scroll-down = "date --date='30 minutes' +%s > /var/tmp/waybar_timer"; interval = 1; }; "custom/exit" = { format = ""; on-click = "${pkgs.wlogout}/bin/wlogout"; }; "custom/startmenu" = { format = "⚡"; on-click = "${pkgs.walker}/bin/walker"; }; "idle_inhibitor" = { format = "{icon}"; format-icons = { activated = ""; deactivated = ""; }; }; battery = { states = { warning = 30; critical = 15; }; format = "{icon} {capacity}%"; format-charging = " {capacity}%"; format-plugged = " {capacity}%"; format-full = " {capacity}%"; format-icons = [ "" "" "" ]; }; } ]; style = builtins.readFile ./style.css; }; }