aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--dot_config/waybar/config.jsonc8
-rw-r--r--dot_config/waybar/executable_dock-status.sh27
-rw-r--r--dot_config/waybar/style.css5
3 files changed, 40 insertions, 0 deletions
diff --git a/dot_config/waybar/config.jsonc b/dot_config/waybar/config.jsonc
index 6d4f287..2270b42 100644
--- a/dot_config/waybar/config.jsonc
+++ b/dot_config/waybar/config.jsonc
@@ -10,6 +10,7 @@
"temperature",
"custom/memory",
"network#bond",
+ "custom/dock",
"battery",
"privacy",
"custom/webcam",
@@ -181,6 +182,13 @@
"tooltip": true,
},
+ "custom/dock": {
+ "exec": "~/.config/waybar/dock-status.sh",
+ "return-type": "json",
+ "interval": 5,
+ "tooltip": true,
+ },
+
"custom/notifications": {
"exec": "~/.config/waybar/mako-status.sh",
"return-type": "json",
diff --git a/dot_config/waybar/executable_dock-status.sh b/dot_config/waybar/executable_dock-status.sh
new file mode 100644
index 0000000..501bb7d
--- /dev/null
+++ b/dot_config/waybar/executable_dock-status.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+# Detect a Lenovo ThinkPad USB-C Dock Gen2 by its distinctive built-in
+# ethernet adapter (17ef:a387). The dock's USB hubs share product IDs
+# with internal ThinkPad hubs on some models, but the ethernet is only
+# present when the dock is physically attached.
+#
+# Output is a single waybar JSON record. When undocked, "text" is empty
+# so waybar collapses the module — no clutter on the bar when on the go.
+
+set -eu
+
+docked=0
+for dev in /sys/bus/usb/devices/*/; do
+ [ -f "$dev/idVendor" ] && [ -f "$dev/idProduct" ] || continue
+ v=$(cat "$dev/idVendor")
+ p=$(cat "$dev/idProduct")
+ if [ "$v" = "17ef" ] && [ "$p" = "a387" ]; then
+ docked=1
+ break
+ fi
+done
+
+if [ "$docked" -eq 1 ]; then
+ printf '{"text":"󰧹","tooltip":"Docked: ThinkPad USB-C Dock Gen2","class":"docked","alt":"docked"}\n'
+else
+ printf '{"text":"","tooltip":"Undocked","class":"undocked","alt":"undocked"}\n'
+fi
diff --git a/dot_config/waybar/style.css b/dot_config/waybar/style.css
index 71c8b3d..f0d764d 100644
--- a/dot_config/waybar/style.css
+++ b/dot_config/waybar/style.css
@@ -49,6 +49,7 @@ window#waybar {
#custom-memory,
#custom-wifi,
#custom-webcam,
+#custom-dock,
#custom-notifications,
#custom-thunderbird {
padding: 0 6px;
@@ -123,6 +124,10 @@ window#waybar {
color: #fb4934; /* red — only rendered when webcam is in use */
}
+#custom-dock.docked {
+ color: #b8bb26; /* green — desk mode */
+}
+
#custom-notifications {
color: #928374; /* gray baseline */
}