diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-09-02 17:36:35 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-09-02 17:36:35 +0800 |
| commit | 582c7ad0569e4bc52a86b38e9a51f07f41842e15 (patch) | |
| tree | 49bd07d6e6cfc85ee9d825ead224fbaed98160b4 /sysutil.sh | |
| parent | 4bafe49e51237da9f4f92c935912426d3661cc11 (diff) | |
init hyprland scripts
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 |
