power menu, redshift, polybar

This commit is contained in:
azpsen
2024-01-28 16:37:10 -06:00
parent 89516a6ce1
commit 319b44ecbd
307 changed files with 7642 additions and 5 deletions

View File

@@ -0,0 +1,31 @@
# Script: info-healthchecks.io
Shows the health of your services registered with [healthchecks.io](https://healthchecks.io).
![info-healthchecks.io](screenshots/1.png)
## Dependencies
* `jq`
* `curl`
## Configuration
Modify any of the all-caps variables to configure the script:
* `API_KEY`: Your [healthchecks.io](https://healthchecks.io) API key. These are project specific and can be generated on the project settings page.
* `CHECK_ENDPOINT`: URL of the checks API endpoint. Change if self-hosting.
* `STATES`: Array of states to monitor. Available options: `"up" "down" "new" "pending" "grace" "started" "paused"`
* `COLORS`: Associative array that maps a color to each configured state. Defaults to white (#ffffff).
* `SHOWN_TAGS`: Array of tags to show. Leave empty to disable filtering based on tags.
## Module
```ini
[module/info-healthchecks.io]
type = custom/script
exec = ~/polybar-scripts/info-healthchecks.io.sh
interval = 60
```

View File

@@ -0,0 +1,49 @@
#!/bin/bash
# Your API Key
API_KEY=""
# URL of the checks api endpoint. Change if self-hosting the service.
CHECK_ENDPOINT="https://healthchecks.io/api/v1/checks/"
# States to track
# Available options: up down new pending grace started paused
STATES=("up" "down")
# Color of each state. Defaults to white (#ffffff).
declare -A COLORS=( [up]="#7cfc00" [down]="#ff0000" )
# Leave empty to show all tags
SHOWN_TAGS=()
function build_url {
url=$CHECK_ENDPOINT
next_sep="?"
for tag in "${SHOWN_TAGS[@]}"; do
url+="${next_sep}tag=${tag}"
next_sep="&"
done
echo "$url"
}
response=$(curl --silent --header "X-Api-Key: ${API_KEY}" "$(build_url)")
declare -A stati
for status in "up" "down"; do
stati[$status]=0
done
for status in $(echo "$response" | jq -r '.checks[].status'); do
stati[$status]=$((stati[$status] + 1))
done
output=""
for status in "${STATES[@]}"; do
count=${stati[$status]}
if [ ${COLORS[$status]+_} ]; then
color=${COLORS[$status]}
else
color="#ffffff"
fi
output+="|%{F${color}}${count}%{F-}"
done
echo "${output:1}"

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B