From f3943e80222e4dc7f5026b7bc1585aeb51ee2ad7 Mon Sep 17 00:00:00 2001 From: coolneng Date: Wed, 24 May 2023 15:18:47 +0200 Subject: [PATCH] Add CGM value to Waybar --- scripts/.local/share/scripts/cgm-value | 6 ++++++ waybar/.config/waybar/config | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 scripts/.local/share/scripts/cgm-value diff --git a/scripts/.local/share/scripts/cgm-value b/scripts/.local/share/scripts/cgm-value new file mode 100755 index 0000000..acea600 --- /dev/null +++ b/scripts/.local/share/scripts/cgm-value @@ -0,0 +1,6 @@ +#!/bin/sh + +CGM_VALUE=$(curl -s -H 'api-secret: 48380073c2e46d673ab40c764d160976eb1150eb' -H "accept: application/json" \ + "https://nightscout.coolneng.duckdns.org/api/v1/entries?count=1" | + grep -o '"sgv":[0-9]*' | cut -d ":" -f 2) +echo "$CGM_VALUE" diff --git a/waybar/.config/waybar/config b/waybar/.config/waybar/config index a023291..d73cf00 100644 --- a/waybar/.config/waybar/config +++ b/waybar/.config/waybar/config @@ -2,7 +2,7 @@ "layer": "top", "height": 25, "modules-left": ["sway/workspaces" ], - "modules-center": ["custom/org-pomodoro", "clock"], + "modules-center": ["custom/org-pomodoro", "clock", "custom/cgm-value"], "modules-right": ["mpd", "network", "pulseaudio", "battery", "battery#bat2"], "mpd": { "format": "{stateIcon} {title}", @@ -78,5 +78,10 @@ "format": "󰅐 {}", "exec": "$HOME/.local/share/scripts/org-clock-status", "interval": 2 + }, + "custom/cgm-value": { + "format": "󱄦 {}", + "exec": "$HOME/.local/share/scripts/cgm-value", + "interval": 2 } }