aboutsummaryrefslogtreecommitdiff
path: root/plugins/polybar
blob: 430b814d47743bd4cc0ad3ec978e4496f1fe6c4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
[ "$1" = "info" ] && echo "plugin for script module in polybar" && exit 2

. "$core_path/lib"

usage() {
	cat << EOF
usage:
	$subcmd [options]

options:
	-h, --help   display this help text

this plugin is intended to be used in combination with polybar. add the
following to your config.ini file to use this plugin:

	[module/$progname]
	type = custom/script
	exec = $subcmd
	tail = true
	click-left = $progname toggle
	click-middle = $progname reset
EOF
}

while [ $# -gt 0 ] ; do
	case "$1" in
		-h|--help) usage && exit 0 ;;
		--) shift ; break ;;
		*) err "unknown parameter: $1" ;;
	esac
done

# launch notify daemon if it is not already active
("$prog" notify 1> /dev/null 2> /dev/null &)
sleep 0.1 # warm up a little

"$prog" display
while inotifywait -qq -e attrib "$XDG_RUNTIME_DIR/$progname/notify" ; do
	unset remaining lap time running
	"$prog" display
done