summary refs log tree commit diff
path: root/.config
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2022-09-28 19:35:32 +0200
committerRobert Günzler <r@gnzler.io>2022-09-28 19:35:32 +0200
commitd02ebebe68b84b6996bcf7e9e76fdabf0d69e47a (patch)
tree4bfc389d405d2d70fc6eb5a3bcc601818463fa38 /.config
parent807fc10b96d06761b63fcccf440454b359712369 (diff)
waybar: add hotspots module
Diffstat (limited to '.config')
-rw-r--r--.config/waybar/config.jsonc2
-rwxr-xr-x.config/waybar/modules/hotspots.sh21
-rw-r--r--.config/waybar/style.css8
-rw-r--r--.config/waybar/style.css.in8
4 files changed, 38 insertions, 1 deletions
diff --git a/.config/waybar/config.jsonc b/.config/waybar/config.jsonc
index 28c1af5..d30d87a 100644
--- a/.config/waybar/config.jsonc
+++ b/.config/waybar/config.jsonc
@@ -45,7 +45,7 @@
 
   // ------------------------------------------------------------------------ //
 
-  "modules-center": ["custom/weather", "clock#local", "clock#utc", "custom/timetracked"],
+  "modules-center": ["custom/weather", "clock#local", "clock#utc", "clock#extra", "custom/timetracked", "custom/hotspots"],
 
   "custom/weather": {
     "format": "{icon} {percentage}℃",
diff --git a/.config/waybar/modules/hotspots.sh b/.config/waybar/modules/hotspots.sh
new file mode 100755
index 0000000..fe2ff65
--- /dev/null
+++ b/.config/waybar/modules/hotspots.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+set -e
+
+case "$1" in
+click)
+	uri=$(hspl -u)
+	xdg-open "http://$uri"
+	;;
+*)
+	output=$(hspl || echo "none")
+	if [ "$output" != "none" ]; then
+		jq -nc \
+			--arg text "󱛄 $(head -n1 <<<"$output")" \
+			--arg tooltip "$(tail -n+2 <<<"$output")" \
+			--arg class "$(if [ "$(hspl -d)" -lt 100 ]; then echo "soon"; else echo ""; fi)" \
+			'{text:$text,tooltip:$tooltip,class:$class}'
+	else
+		jq -nc '{}'
+	fi
+	;;
+esac
diff --git a/.config/waybar/style.css b/.config/waybar/style.css
index 7f637a9..0cc379d 100644
--- a/.config/waybar/style.css
+++ b/.config/waybar/style.css
@@ -323,3 +323,11 @@ label:focus {
   /* border-top: 1px solid #941100; */
   /* color: #941100; */
 }
+
+#custom-hotspots {
+  border-top: 1px solid @urgent;
+  color: @dimmed;
+}
+#custom-hotspots.soon {
+  color: @urgent;
+}
diff --git a/.config/waybar/style.css.in b/.config/waybar/style.css.in
index 075b83c..460853c 100644
--- a/.config/waybar/style.css.in
+++ b/.config/waybar/style.css.in
@@ -323,3 +323,11 @@ label:focus {
   /* border-top: 1px solid #941100; */
   /* color: #941100; */
 }
+
+#custom-hotspots {
+  border-top: 1px solid @urgent;
+  color: @dimmed;
+}
+#custom-hotspots.soon {
+  color: @urgent;
+}