summaryrefslogtreecommitdiff
path: root/sysutil.sh
blob: 7f542c4d075e916d092411ee99b022b3faa2da84 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash

XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache}

function prepsound() {
	tDIR=$XDG_CACHE_HOME/stoggle

	if [ ! -d $tDIR ]; then
		mkdir -p $tDIR || exit 1
	fi
	sDIR=/usr/share/sounds/freedesktop/stereo
}

function playSound() {
	if [ ! $sDIR ]; then
		echo Warning: Sound directory not set, setting to default
		prepsound
	fi
	pw-play $sDIR/$1 || paplay $sDIR/$1
}

function getSound() {
	prepsound
	if [ -f $tDIR/$1 ]; then
		return 1
	else
		return 0
	fi
}

function setSound() {
	prepsound

	if [ ! -d $sDIR ]; then
		mkdir -p $sDIR || exit 1
	fi
	if [ -f $sDIR/$1 ]; then
		rm $sDIR/$1
	else
		touch $sDIR/$1
	fi
}

# if $(getSound screenshot); then
# echo "Screenshot sound is enabled"
# else
# echo "Screenshot sound is disabled"
# fi

function screenshot() {
	$HOME/scripts/hyprshot $@
}

function volume() {
	$HOME/scripts/hyprvol $@
}

function brightness() {
	# $HOME/scripts/hyprbri $@
	$HOME/scripts/ddcutil-client.sh $@
}

if [ "$1" ]; then
	$@
fi