playshellsound is now a standalone script

This commit is contained in:
2024-11-17 11:20:31 -05:00
parent 93acf864ea
commit 21f11673b6
5 changed files with 51 additions and 28 deletions

View File

@@ -1,6 +1,9 @@
{ host, self, pkgs, }:
pkgs.writeShellApplication {
name = "rebuild";
runtimeInputs = [
pkgs.myScripts.playshellsound
];
text = ''
checkbools() { [ "$all" = false ] && [ "$system" = false ] && [ "$home" = false ]; }
checkflags() {
@@ -24,8 +27,8 @@ pkgs.writeShellApplication {
all=false
dry=false
hooray() { scheck && runbg aplay "${self}/assets/sound/update.wav"; }
damn() { scheck && runbg aplay "${self}/assets/sound/error.wav"; }
hooray() { playshellsound "${self}/assets/sound/update.wav"; }
damn() { playshellsound "${self}/assets/sound/error.wav"; }
usage="\033[1;4;38;2;243;139;168mUsage\033[0m: rebuild -h for home config, rebuild -s for sys config, rebuild -a for both. Including 'n' with the flag does a dry run, i.e. rebuild -nh"

View File

@@ -0,0 +1,20 @@
{ pkgs }:
pkgs.writeShellApplication {
name = "playshellsound";
runtimeInputs = with pkgs; [
alsa-utils
pkgs.myScripts.runbg
];
text = ''
if [ $# -ne 1 ]; then
echo "Usage: playshellsound <path/to/sound>"
exit 1
fi
if scheck; then
runbg aplay "$1"
else
exit 1
fi
'';
}