aboutsummaryrefslogtreecommitdiff
path: root/config/fish/functions/alert.fish
blob: 773877ed1314dc23efdc057968bb40652df245cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function alert --description 'print and ring bell' --argument loop
	set usage "Usage: alert [-l | --loop]"
	set cmd "xkbbell ^/dev/null; echo -n -e \a"

	if test -n "$loop"; and test "$loop" != "-l" -a "$loop" != "--loop"; or test (count $argv) -gt 1
		echo $usage >&2
		return 1
	else
		eval $cmd
		if test -n "$loop"
			while true
				for i in (seq 1 20)
					alert
					sleep 1
					end
				sleep 1m
			end
		end
	end
end