From 8b46d70319a2577a5aebc518d02df7cff4c54980 Mon Sep 17 00:00:00 2001 From: "agausmann@fastmail.com" Date: Tue, 25 Mar 2025 19:59:10 -0500 Subject: [PATCH] Add auto-ethernet option (for liberation) --- hosts/liberation.toml | 2 +- install.py | 1 + templates/.config/waybar/config.jsonc | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/hosts/liberation.toml b/hosts/liberation.toml index fb81cbc..b91daf5 100644 --- a/hosts/liberation.toml +++ b/hosts/liberation.toml @@ -1,5 +1,5 @@ wireless = ["wlp170s0"] -#ethernet = ["enp2s0"] +auto_ethernet = true temperature_path = "/sys/class/hwmon/hwmon4/temp1_input" has_battery = true diff --git a/install.py b/install.py index ccd3f66..544ac1b 100755 --- a/install.py +++ b/install.py @@ -157,6 +157,7 @@ class HostConfig: base16_scheme: str = "seti" wireless: list[str] = field(factory=list) ethernet: list[str] = field(factory=list) + auto_ethernet: bool = True disks: list[str] = field(factory=lambda: ["/"]) has_battery: bool = False system_font: str = "Fira Sans" diff --git a/templates/.config/waybar/config.jsonc b/templates/.config/waybar/config.jsonc index 9ef707c..c554ad4 100644 --- a/templates/.config/waybar/config.jsonc +++ b/templates/.config/waybar/config.jsonc @@ -16,6 +16,10 @@ "network#${iface}", % endfor +% if not host.ethernet and host.auto_ethernet: + "network#auto_ethernet", +% endif + "wireplumber", "battery", "group/disks", @@ -50,6 +54,16 @@ }, % endfor +% if not host.ethernet and host.auto_ethernet: + "network#auto_ethernet": { + "interface": "en*", + "format": "\uf6ff \uf058", + "format-disconnected": "\uf6ff \uf057", + "tooltip-format": "${iface} {ipaddr}", + "tooltip-format-disconnected": "${iface} down" + }, +% endif + "wireplumber": { "format": "{icon} {volume}%", "format-muted": "\uf6a9 {volume}%",