diff options
Diffstat (limited to 'sysutil.sh')
| -rwxr-xr-x | sysutil.sh | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/sysutil.sh b/sysutil.sh new file mode 100755 index 0000000..3bf6946 --- /dev/null +++ b/sysutil.sh @@ -0,0 +1,56 @@ +#!/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 $@ +} + +if [ "$1" ]; then + $@ +fi |
