aboutsummaryrefslogtreecommitdiffstats
path: root/home/waybar/default.nix
diff options
context:
space:
mode:
authorPetri Hienonen <petri.hienonen@gmail.com>2024-05-23 13:56:00 +0300
committerPetri Hienonen <petri.hienonen@gmail.com>2025-11-30 12:29:57 +0200
commit08297376a85a1719518507e54fca9de954d2376a (patch)
tree3b9c58304b40248533bbb2bb5b7bad2da9da1ff0 /home/waybar/default.nix
parent75c2af4aedd2ac5c2cfc74b346625fa4b265541d (diff)
downloadnixos-08297376a85a1719518507e54fca9de954d2376a.tar.zst
Agenix configuration
Diffstat (limited to 'home/waybar/default.nix')
-rw-r--r--home/waybar/default.nix304
1 files changed, 301 insertions, 3 deletions
diff --git a/home/waybar/default.nix b/home/waybar/default.nix
index bfe3c39..fd9a735 100644
--- a/home/waybar/default.nix
+++ b/home/waybar/default.nix
@@ -1,6 +1,304 @@
+{ pkgs, lib, ... }:
+
+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 = { enable = true; };
+ 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 = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
+ calendar = {
+ mode = "year";
+ weeks-pos = "right";
+ mode-mon-col = 3;
+ format = {
+ months = "<span color='#ffead3'><b>{}</b></span>";
+ days = "<span color='#ecc6d9'><b>{}</b></span>";
+ weeks = "<span color='#99ffdd'><b>W{}</b></span>";
+ weekdays = "<span color='#ffcc66'><b>{}</b></span>";
+ today = "<span color='#ff6699'><b><u>{}</u></b></span>";
+ };
+ };
+ };
+
+ "hyprland/window" = {
+ max-length = 80;
+ separate-outputs = false;
+ 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} <i>{dynamic}</i>";
+ 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";
+ };
- home.file."./config/waybar/config".source = ./config;
- home.file."./config/waybar/style.css".source = ./style.css;
+ "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;
+ };
}