diff --git a/home/programs/waybar/default.nix b/home/programs/waybar/default.nix index c3fe3f0..530c213 100644 --- a/home/programs/waybar/default.nix +++ b/home/programs/waybar/default.nix @@ -1,152 +1,173 @@ { - osConfig, pkgs, lib, + osConfig, + config, ... }: let - inherit (lib) getExe; + inherit (lib) getExe mkMerge mkIf; in { imports = [./style.nix]; programs.waybar = { enable = true; systemd.enable = true; settings = { - mainBar = { - layer = "top"; - position = "top"; - height = 30; + mainBar = mkMerge [ + { + layer = "top"; + position = "top"; + height = 30; - margin-top = 6; - margin-left = 6; - margin-right = 6; - margin-bottom = 0; + margin-top = 6; + margin-left = 6; + margin-right = 6; + margin-bottom = 0; - modules-left = ["niri/workspaces" "niri/window"]; - modules-center = ["group/clock"]; - modules-right = ["tray" "group/status" "group/power"]; + modules-left = ["niri/workspaces" "niri/window"]; + modules-center = ["group/clock"]; + modules-right = + ["tray" "group/status" "group/power"] + ++ lib.optional config.services.swaync.enable "custom/notification"; - battery = { - interval = 10; - states = { - warning = 30; - critical = 15; + battery = { + interval = 10; + states = { + warning = 30; + critical = 15; + }; + format = "{icon} {capacity}%"; + format-charging = " {capacity}% - {time}"; + format-full = " {capacity}% - Full"; + format-icons = [ + "" + "" + "" + "" + "" + ]; + max-length = 25; }; - format = "{icon} {capacity}%"; - format-charging = " {capacity}% - {time}"; - format-full = " {capacity}% - Full"; - format-icons = [ - "" - "" - "" - "" - "" - ]; - max-length = 25; - }; - "niri/window" = { - icon = true; - }; - - "pulseaudio" = { - format = "{icon} {volume}%"; - format-bluetooth = "{icon} {volume}%"; - format-muted = " "; - format-icons = { - "alsa_output.pci-0000_00_1f.3.analog-stereo" = ""; - "alsa_output.pci-0000_00_1f.3.analog-stereo-muted" = ""; - headphone = ""; - hands-free = ""; - headset = ""; - phone = ""; - phone-muted = ""; - portable = ""; - car = ""; - default = [ - "" - "" + "pulseaudio" = { + format = "{icon} {volume}%"; + format-bluetooth = "{icon} {volume}%"; + format-muted = " "; + format-icons = { + "alsa_output.pci-0000_00_1f.3.analog-stereo" = ""; + "alsa_output.pci-0000_00_1f.3.analog-stereo-muted" = ""; + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + phone-muted = ""; + portable = ""; + car = ""; + default = [ + "" + "" + ]; + }; + scroll-step = 1; + on-click = "pavucontrol"; + ignored-sinks = [ + "Easy Effects Sink" ]; }; - scroll-step = 1; - on-click = "pavucontrol"; - ignored-sinks = [ - "Easy Effects Sink" - ]; - }; - "power-profiles-daemon" = { - format-icons = { - default = ""; - performance = ""; - balanced = ""; - power-saver = ""; + "power-profiles-daemon" = { + format-icons = { + default = ""; + performance = ""; + balanced = ""; + power-saver = ""; + }; }; - }; - "group/status" = { - orientation = "inherit"; - modules = [ - "pulseaudio" - "power-profiles-daemon" - "network" - "battery" - ]; - }; + "group/status" = { + orientation = "inherit"; + modules = [ + "pulseaudio" + "power-profiles-daemon" + "network" + "battery" + ]; + }; - "group/power" = { - orientation = "inherit"; - modules = [ - "custom/power" - ]; - }; + "group/power" = { + orientation = "inherit"; + modules = [ + "custom/power" + ]; + }; - "group/clock" = { - orientation = "inherit"; - modules = [ - "clock#time" - "clock#date" - ]; - }; + "group/clock" = { + orientation = "inherit"; + modules = [ + "clock#time" + "clock#date" + ]; + }; - "custom/power" = { - format = ""; - tooltip = false; - on-click = getExe pkgs.wlogout; - }; + "custom/power" = { + format = ""; + tooltip = false; + on-click = getExe pkgs.wlogout; + }; - "clock#date" = { - format = "{:%D}"; - tooltip-format = "{calendar}"; - }; + "clock#date" = { + format = "{:%D}"; + tooltip-format = "{calendar}"; + }; - "clock#time" = { - format = "{:%H:%M}"; - tooltip-format = "{tz_list}"; - timezones = [ - osConfig.time.timeZone - "US/Eastern" - ]; - }; + "clock#time" = { + format = "{:%H:%M}"; + tooltip-format = "{tz_list}"; + timezones = [ + osConfig.time.timeZone + "US/Eastern" + ]; + }; - network = { - interface = "wlp1s0"; - format = "{ifname}"; - format-wifi = "{icon}"; - format-ethernet = "{ipaddr}/{cidr} 󰊗"; - format-disconnected = ""; - tooltip-format = "{ifname} via {gwaddr} 󰊗"; - tooltip-format-wifi = "{essid} ({signalStrength}%)"; - tooltip-format-ethernet = "{ifname} "; - tooltip-format-disconnected = "Disconnected"; - max-length = 50; - format-icons = [ - "󰤟" - "󰤢" - "󰤥" - "󰤨" - ]; - }; - }; + network = { + interface = "wlp1s0"; + format = "{ifname}"; + format-wifi = "{icon}"; + format-ethernet = "{ipaddr}/{cidr} 󰊗"; + format-disconnected = ""; + tooltip-format = "{ifname} via {gwaddr} 󰊗"; + tooltip-format-wifi = "{essid} ({signalStrength}%)"; + tooltip-format-ethernet = "{ifname} "; + tooltip-format-disconnected = "Disconnected"; + max-length = 50; + format-icons = [ + "󰤟" + "󰤢" + "󰤥" + "󰤨" + ]; + }; + } + (mkIf osConfig.programs.niri.enable { + "niri/window" = { + icon = true; + }; + }) + (mkIf config.services.swaync.enable { + "custom/notification" = { + tooltip = false; + format = "{icon}"; + format-icons = { + notification = "󱅫"; + none = "󰂚"; + dnd-notification = "󱏧"; + dnd-none = "󱏧"; + }; + return-type = "json"; + exec = "swaync-client -swb"; + on-click = "swaync-client -t -sw"; + }; + }) + ]; }; }; diff --git a/home/programs/waybar/style.nix b/home/programs/waybar/style.nix index 53c5fb7..904807c 100644 --- a/home/programs/waybar/style.nix +++ b/home/programs/waybar/style.nix @@ -88,7 +88,8 @@ in { #network, #pulseaudio, #tray, - #power-profiles-daemon { + #power-profiles-daemon + { padding: 0 0.5em; } @@ -102,5 +103,9 @@ in { padding: 0 1.2em; color: @base08; } + + #custom-notification { + padding: 0 1.2em; + } ''; } diff --git a/home/services/swaync.nix b/home/services/swaync.nix new file mode 100644 index 0000000..f89e51e --- /dev/null +++ b/home/services/swaync.nix @@ -0,0 +1,5 @@ +_: { + services.swaync = { + enable = true; + }; +} diff --git a/hosts/vamos/default.nix b/hosts/vamos/default.nix index a3a156c..bb8ca48 100644 --- a/hosts/vamos/default.nix +++ b/hosts/vamos/default.nix @@ -35,6 +35,7 @@ in { "${home}/programs/niri" "${home}/programs/waybar" + "${home}/services/swaync.nix" "${home}/programs/fuzzel.nix" "${home}/programs/swaybg.nix" "${home}/programs/swaylock.nix"