summary refs log tree commit diff
path: root/.config/waybar/modules/hotspots.sh
blob: fe2ff65cf7a90994490cf79132eacec08a939a0d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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