Add uptime-module to waybar
This commit is contained in:
parent
c9b0185c9a
commit
6a85c0e22b
3 changed files with 30 additions and 3 deletions
|
@ -14,6 +14,7 @@
|
||||||
"cpu",
|
"cpu",
|
||||||
"memory",
|
"memory",
|
||||||
"custom/pacman",
|
"custom/pacman",
|
||||||
|
"custom/status",
|
||||||
"custom/weather",
|
"custom/weather",
|
||||||
"clock",
|
"clock",
|
||||||
"tray"
|
"tray"
|
||||||
|
@ -32,7 +33,7 @@
|
||||||
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>"
|
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>"
|
||||||
},
|
},
|
||||||
"cpu": {
|
"cpu": {
|
||||||
"format": " {usage}%"
|
"format": " {usage}%"
|
||||||
},
|
},
|
||||||
"memory": {
|
"memory": {
|
||||||
"format": " {percentage}%"
|
"format": " {percentage}%"
|
||||||
|
@ -47,7 +48,7 @@
|
||||||
"spacing": 4
|
"spacing": 4
|
||||||
},
|
},
|
||||||
"custom/pacman": {
|
"custom/pacman": {
|
||||||
"format": " {}",
|
"format": " {}",
|
||||||
"interval": 3600,
|
"interval": 3600,
|
||||||
"exec": "~/.config/waybar/custom/pacman",
|
"exec": "~/.config/waybar/custom/pacman",
|
||||||
"on-click": "alacritty -e 'archlinux-update'",
|
"on-click": "alacritty -e 'archlinux-update'",
|
||||||
|
@ -61,5 +62,13 @@
|
||||||
"format": "{}",
|
"format": "{}",
|
||||||
"tooltip": true,
|
"tooltip": true,
|
||||||
"interval": 1200
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
14
.config/waybar/custom/status-serguzim-net
Executable file
14
.config/waybar/custom/status-serguzim-net
Executable file
|
@ -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\"}"
|
|
@ -4,7 +4,7 @@
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
|
|
||||||
font-family: "JetBrains Mono", monospace;
|
font-family: "JetBrainsMono Nerd Font", monospace;
|
||||||
font-size: 10pt;
|
font-size: 10pt;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
}
|
}
|
||||||
|
@ -56,3 +56,7 @@ window#waybar {
|
||||||
#custom-pacman {
|
#custom-pacman {
|
||||||
border-bottom: solid 2px @cyan;
|
border-bottom: solid 2px @cyan;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#custom-status {
|
||||||
|
border-bottom: solid 2px @orange;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue