diff --git a/.config/waybar/config b/.config/waybar/config
index e215c46..8fada29 100644
--- a/.config/waybar/config
+++ b/.config/waybar/config
@@ -14,6 +14,7 @@
"cpu",
"memory",
"custom/pacman",
+ "custom/status",
"custom/weather",
"clock",
"tray"
@@ -32,7 +33,7 @@
"tooltip-format": "{:%Y %B}\n{calendar}"
},
"cpu": {
- "format": " {usage}%"
+ "format": " {usage}%"
},
"memory": {
"format": " {percentage}%"
@@ -47,7 +48,7 @@
"spacing": 4
},
"custom/pacman": {
- "format": " {}",
+ "format": " {}",
"interval": 3600,
"exec": "~/.config/waybar/custom/pacman",
"on-click": "alacritty -e 'archlinux-update'",
@@ -61,5 +62,13 @@
"format": "{}",
"tooltip": true,
"interval": 1200
+ },
+ "custom/status": {
+ "format": " {}",
+ "exec": "~/.config/waybar/custom/status-serguzim-net",
+ "on-click": "xdg-open 'https://status.serguzim.net'",
+ "return-type": "json",
+ "tooltip": true,
+ "interval": 500
}
}
diff --git a/.config/waybar/custom/status-serguzim-net b/.config/waybar/custom/status-serguzim-net
new file mode 100755
index 0000000..5a432ed
--- /dev/null
+++ b/.config/waybar/custom/status-serguzim-net
@@ -0,0 +1,14 @@
+#!/usr/bin/env sh
+
+result=$(curl https://status.serguzim.net/api/status-page/heartbeat/serguzim-net \
+ | jq '.heartbeatList | to_entries | map(.value | last .status)
+ | [group_by(.)[] | {value: .[0], count: length}] | map({(.value|tostring): .count}) | add')
+
+up_count=$(echo "$result" | jq '."1" // 0')
+down_count=$(echo "$result" | jq '."0" // 0')
+count=$((up_count + down_count))
+percent=$((up_count * 100 / count))
+
+tooltip="status.serguzim.net\nUp: $up_count\nDown: $down_count\nTotal: $count\nPercent: $percent%"
+
+echo "{\"text\": \"$percent%\", \"tooltip\": \"$tooltip\"}"
diff --git a/.config/waybar/style.css b/.config/waybar/style.css
index 19cda04..8a25327 100644
--- a/.config/waybar/style.css
+++ b/.config/waybar/style.css
@@ -4,7 +4,7 @@
border: none;
border-radius: 0;
- font-family: "JetBrains Mono", monospace;
+ font-family: "JetBrainsMono Nerd Font", monospace;
font-size: 10pt;
min-height: 0;
}
@@ -56,3 +56,7 @@ window#waybar {
#custom-pacman {
border-bottom: solid 2px @cyan;
}
+
+#custom-status {
+ border-bottom: solid 2px @orange;
+}