From dede79d7ac39ee4f03aad26559e520288d8dec33 Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Tue, 28 Jun 2022 09:00:43 +0200 Subject: [PATCH] Update waybar config to updated home-manager schema --- home-manager/modules/waybar/default.nix | 241 ++++++++++++------------ 1 file changed, 120 insertions(+), 121 deletions(-) diff --git a/home-manager/modules/waybar/default.nix b/home-manager/modules/waybar/default.nix index 1c00f13..ce79d20 100644 --- a/home-manager/modules/waybar/default.nix +++ b/home-manager/modules/waybar/default.nix @@ -49,145 +49,144 @@ in "idle_inhibitor" "custom/notifications" ]; - modules = { - "clock#time" = { - interval = 1; - format = "{:%H:%M:%S}"; - tooltip = false; - }; - "clock#date" = { - interval = 10; - format = " {:%e %b %Y}"; - tooltip-format = "{:%e %B %Y}"; - }; + "clock#time" = { + interval = 1; + format = "{:%H:%M:%S}"; + tooltip = false; + }; - "cpu" = { - interval = 5; - format = "﬙ {usage}% ({load})"; - states = { - warning = 70; - critical = 90; - }; - }; + "clock#date" = { + interval = 10; + format = " {:%e %b %Y}"; + tooltip-format = "{:%e %B %Y}"; + }; - "custom/keyboard-layout" = { - exec = "swaymsg -t get_inputs | grep -m1 'xkb_active_layout_name' | cut -d '\"' -f4"; - interval = 30; - format = " {}"; # Icon: keyboard - # Signal sent by Sway key binding (~/.config/sway/key-bindings) - signal = 1; # SIGHUP - tooltip = false; + "cpu" = { + interval = 5; + format = "﬙ {usage}% ({load})"; + states = { + warning = 70; + critical = 90; }; + }; - "memory" = { - interval = 5; - format = " {}%"; # Icon: memory - states = { - warning = 70; - critical = 90; - }; - }; + "custom/keyboard-layout" = { + exec = "swaymsg -t get_inputs | grep -m1 'xkb_active_layout_name' | cut -d '\"' -f4"; + interval = 30; + format = " {}"; # Icon: keyboard + # Signal sent by Sway key binding (~/.config/sway/key-bindings) + signal = 1; # SIGHUP + tooltip = false; + }; - "network" = { - interval = 5; - format-wifi = "直 {essid} ({signalStrength}%)"; # Icon: wifi - format-ethernet = " {ifname}: {ipaddr}/{cidr}"; # Icon: ethernet - format-disconnected = "⚠ Disconnected"; - tooltip-format = "{ifname}: {ipaddr}"; + "memory" = { + interval = 5; + format = " {}%"; # Icon: memory + states = { + warning = 70; + critical = 90; }; + }; - "sway/mode" = { - format = " {}"; # Icon: expand-arrows-alt - tooltip = false; - }; + "network" = { + interval = 5; + format-wifi = "直 {essid} ({signalStrength}%)"; # Icon: wifi + format-ethernet = " {ifname}: {ipaddr}/{cidr}"; # Icon: ethernet + format-disconnected = "⚠ Disconnected"; + tooltip-format = "{ifname}: {ipaddr}"; + }; - # TODO: package as nix thingy - "custom/now_playing" = { - exec = "${pkgs.ha-now-playing}/bin/ha-now-playing --host home.datarift.nl --entity media_player.sonos_woonkamer --token-file /run/secrets/ha_now_playing_token"; - exec-on-event = false; - format = " ♪ {}"; - restart-interval = 1; - return-type = "json"; - on-click = "${pkgs.ha-now-playing}/bin/ha-now-playing --host home.datarift.nl --entity media_player.sonos_woonkamer --token-file /run/secrets/ha_now_playing_token play-pause"; - on-scroll-down = "${pkgs.ha-now-playing}/bin/ha-now-playing --host home.datarift.nl --entity media_player.sonos_woonkamer --token-file /run/secrets/ha_now_playing_token volume-up"; - on-scroll-up = "${pkgs.ha-now-playing}/bin/ha-now-playing --host home.datarift.nl --entity media_player.sonos_woonkamer --token-file /run/secrets/ha_now_playing_token volume-down"; - }; + "sway/mode" = { + format = " {}"; # Icon: expand-arrows-alt + tooltip = false; + }; - "sway/window" = { - format = "{}"; - max-length = 120; - }; + # TODO: package as nix thingy + "custom/now_playing" = { + exec = "${pkgs.ha-now-playing}/bin/ha-now-playing --host home.datarift.nl --entity media_player.sonos_woonkamer --token-file /run/secrets/ha_now_playing_token"; + exec-on-event = false; + format = " ♪ {}"; + restart-interval = 1; + return-type = "json"; + on-click = "${pkgs.ha-now-playing}/bin/ha-now-playing --host home.datarift.nl --entity media_player.sonos_woonkamer --token-file /run/secrets/ha_now_playing_token play-pause"; + on-scroll-down = "${pkgs.ha-now-playing}/bin/ha-now-playing --host home.datarift.nl --entity media_player.sonos_woonkamer --token-file /run/secrets/ha_now_playing_token volume-up"; + on-scroll-up = "${pkgs.ha-now-playing}/bin/ha-now-playing --host home.datarift.nl --entity media_player.sonos_woonkamer --token-file /run/secrets/ha_now_playing_token volume-down"; + }; - "sway/workspaces" = { - all-outputs = false; - disable-scroll = true; - format = "{icon} {name}"; - format-icons = { - "urgent" = ""; - "focused" = ""; - "default" = ""; - }; - }; + "sway/window" = { + format = "{}"; + max-length = 120; + }; - "pulseaudio" = { - #scroll-step = 1; - format = "{icon} {volume}%"; - format-bluetooth = "{icon} {volume}%"; - format-muted = "婢"; - format-icons = { - headphones = ""; - handsfree = ""; - headset = ""; - phone = ""; - portable = ""; - car = ""; - default = [ "奄" "奔" "墳" ]; - }; - on-click = "pavucontrol"; + "sway/workspaces" = { + all-outputs = false; + disable-scroll = true; + format = "{icon} {name}"; + format-icons = { + "urgent" = ""; + "focused" = ""; + "default" = ""; }; + }; - "temperature" = { - hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input"; - critical-threshold = 80; - interval = 5; - format = "{icon} {temperatureC}°C"; - format-icons = [ - "" # Icon = temperature-empty - "" # Icon = temperature-quarter - "" # Icon = temperature-half - "" # Icon = temperature-three-quarters - "" # Icon = temperature-full - ]; - tooltip = true; + "pulseaudio" = { + #scroll-step = 1; + format = "{icon} {volume}%"; + format-bluetooth = "{icon} {volume}%"; + format-muted = "婢"; + format-icons = { + headphones = ""; + handsfree = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = [ "奄" "奔" "墳" ]; }; + on-click = "pavucontrol"; + }; - "tray" = { - icon-size = 21; - spacing = 10; + "temperature" = { + hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input"; + critical-threshold = 80; + interval = 5; + format = "{icon} {temperatureC}°C"; + format-icons = [ + "" # Icon = temperature-empty + "" # Icon = temperature-quarter + "" # Icon = temperature-half + "" # Icon = temperature-three-quarters + "" # Icon = temperature-full + ]; + tooltip = true; + }; + + "tray" = { + icon-size = 21; + spacing = 10; + }; + "idle_inhibitor" = { + format = "{icon}"; + format-icons = { + activated = "﯎"; + deactivated = "﯏"; }; - "idle_inhibitor" = { - format = "{icon}"; - format-icons = { - activated = "﯎"; - deactivated = "﯏"; - }; - }; - "custom/notifications" = { - exec = "${pkgs.swaynotificationcenter}/bin/swaync-client --subscribe-waybar"; - on-click = "${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-panel --skip-wait"; - on-click-right = "${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-dnd --skip-wait"; - return-type = "json"; - tooltip = false; - format = "{icon}"; - format-icons = { - notification = ""; - none = ""; - dnd-notification = ""; - dnd-none = ""; - }; - escape = true; + }; + "custom/notifications" = { + exec = "${pkgs.swaynotificationcenter}/bin/swaync-client --subscribe-waybar"; + on-click = "${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-panel --skip-wait"; + on-click-right = "${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-dnd --skip-wait"; + return-type = "json"; + tooltip = false; + format = "{icon}"; + format-icons = { + notification = ""; + none = ""; + dnd-notification = ""; + dnd-none = ""; }; + escape = true; }; } ];