playshellsound is now a standalone script
This commit is contained in:
@@ -36,6 +36,7 @@ let
|
|||||||
myScripts.s_check
|
myScripts.s_check
|
||||||
myScripts.switchmon
|
myScripts.switchmon
|
||||||
myScripts.git-compose
|
myScripts.git-compose
|
||||||
|
myScripts.playshellsound
|
||||||
];
|
];
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
{ lib, config, self, ... }:
|
{ lib, config, self, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
shellsound = "${pkgs.myScripts.playshellsound}/bin/playshellsound";
|
||||||
|
sndpath = "${self}/assets/sound";
|
||||||
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
movOpts.envConfig.zshConfig.extraConfig.enable = lib.mkEnableOption "enables my extra shell configurations";
|
movOpts.envConfig.zshConfig.extraConfig.enable = lib.mkEnableOption "enables my extra shell configurations";
|
||||||
@@ -7,17 +11,6 @@
|
|||||||
config = lib.mkIf config.movOpts.envConfig.zshConfig.extraConfig.enable {
|
config = lib.mkIf config.movOpts.envConfig.zshConfig.extraConfig.enable {
|
||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
initExtra = ''
|
initExtra = ''
|
||||||
playshellsound() {
|
|
||||||
if [ $# -ne 1 ]; then
|
|
||||||
echo "Usage: playshellsound <path/to/sound>"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
if ! scheck; then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
runbg aplay "$1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
build-drv() { # Put the derivation path in $RESULT instead of making a 'result' symlink
|
build-drv() { # Put the derivation path in $RESULT instead of making a 'result' symlink
|
||||||
RESULT=$(nix-build "$@" --no-link)
|
RESULT=$(nix-build "$@" --no-link)
|
||||||
if [ -z "$RESULT" ]; then
|
if [ -z "$RESULT" ]; then
|
||||||
@@ -26,6 +19,11 @@
|
|||||||
export RESULT
|
export RESULT
|
||||||
echo "\$RESULT = $RESULT"
|
echo "\$RESULT = $RESULT"
|
||||||
}
|
}
|
||||||
|
nvim() {
|
||||||
|
${shellsound} ${sndpath}/nvim.wav
|
||||||
|
command nvim "$@"
|
||||||
|
}
|
||||||
|
alias vi="nvim"
|
||||||
ssh() { # reverts ssh theme upon returning
|
ssh() { # reverts ssh theme upon returning
|
||||||
command ssh "$@"
|
command ssh "$@"
|
||||||
kitty_ssh_theme
|
kitty_ssh_theme
|
||||||
@@ -39,58 +37,58 @@
|
|||||||
}
|
}
|
||||||
grimblast() {
|
grimblast() {
|
||||||
if grimblast "$@"; then
|
if grimblast "$@"; then
|
||||||
playshellsound ${self}/assets/sound/screenshot.wav
|
${shellsound} ${sndpath}/screenshot.wav
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
gitcheckout_sfx() {
|
gitcheckout_sfx() {
|
||||||
if git checkout "$@"; then
|
if git checkout "$@"; then
|
||||||
playshellsound ${self}/assets/sound/gitcheckout.wav
|
${shellsound} ${sndpath}/gitcheckout.wav
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
playshellsound ${self}/assets/sound/error.wav
|
${shellsound} ${sndpath}/error.wav
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
gitrebase_sfx() {
|
gitrebase_sfx() {
|
||||||
if git rebase "$@"; then
|
if git rebase "$@"; then
|
||||||
playshellsound ${self}/assets/sound/gitrebase.wav
|
${shellsound} ${sndpath}/gitrebase.wav
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
playshellsound ${self}/assets/sound/error.wav
|
${shellsound} ${sndpath}/error.wav
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
gitcommit_sfx() {
|
gitcommit_sfx() {
|
||||||
if git commit "$@"; then
|
if git commit "$@"; then
|
||||||
playshellsound ${self}/assets/sound/gitcommit.wav
|
${shellsound} ${sndpath}/gitcommit.wav
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
playshellsound ${self}/assets/sound/error.wav
|
${shellsound} ${sndpath}/error.wav
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
gitpush_sfx() {
|
gitpush_sfx() {
|
||||||
if git push "$@"; then
|
if git push "$@"; then
|
||||||
playshellsound ${self}/assets/sound/gitpush.wav
|
${shellsound} ${sndpath}/gitpush.wav
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
playshellsound ${self}/assets/sound/error.wav
|
${shellsound} ${sndpath}/error.wav
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
gitpull_sfx() {
|
gitpull_sfx() {
|
||||||
if git pull "$@"; then
|
if git pull "$@"; then
|
||||||
playshellsound ${self}/assets/sound/gitpull.wav
|
${shellsound} ${sndpath}/gitpull.wav
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
playshellsound ${self}/assets/sound/error.wav
|
${shellsound} ${sndpath}/error.wav
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
unalias ls
|
unalias ls
|
||||||
ls() {
|
ls() {
|
||||||
eza -1 --group-directories-first --icons "$@"
|
eza -1 --group-directories-first --icons "$@"
|
||||||
playshellsound ${self}/assets/sound/ls.wav
|
${shellsound} ${sndpath}/ls.wav
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +111,7 @@
|
|||||||
eza -1 --group-directories-first --icons "$@"
|
eza -1 --group-directories-first --icons "$@"
|
||||||
SOUNDS_ENABLED=$prev_sounds_enabled
|
SOUNDS_ENABLED=$prev_sounds_enabled
|
||||||
builtin cd "$@"
|
builtin cd "$@"
|
||||||
playshellsound /nix/store/7a9w7np3qrvmzxjbs7xj05qq2yccgfsj-source/assets/sound/cd.wav
|
${shellsound} /nix/store/7a9w7np3qrvmzxjbs7xj05qq2yccgfsj-source/assets/sound/cd.wav
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
if [ ! -e $HOME/.zsh_history ]; then
|
if [ ! -e $HOME/.zsh_history ]; then
|
||||||
@@ -157,7 +155,7 @@
|
|||||||
{
|
{
|
||||||
eval "$(starship init zsh)"
|
eval "$(starship init zsh)"
|
||||||
}
|
}
|
||||||
playshellsound ${self}/assets/sound/sh-source.wav
|
${shellsound} ${sndpath}/sh-source.wav
|
||||||
[ ! -f $FLAKEPATH/flake.nix ] && echo "WARNING: flake.nix not found at \$FLAKEPATH. Shell aliases for editing config files won't work correctly!" && echo "Edit the FLAKEPATH session variable in zshell.nix to point to the path where you saved the system configuration flake."
|
[ ! -f $FLAKEPATH/flake.nix ] && echo "WARNING: flake.nix not found at \$FLAKEPATH. Shell aliases for editing config files won't work correctly!" && echo "Edit the FLAKEPATH session variable in zshell.nix to point to the path where you saved the system configuration flake."
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
chpaper = super.callPackage ./scripts/wm-controls/chpaper.nix {};
|
chpaper = super.callPackage ./scripts/wm-controls/chpaper.nix {};
|
||||||
chscheme = super.callPackage ./scripts/wm-controls/chscheme.nix {};
|
chscheme = super.callPackage ./scripts/wm-controls/chscheme.nix {};
|
||||||
keyring = super.callPackage ./scripts/wm-controls/keyring.nix {};
|
keyring = super.callPackage ./scripts/wm-controls/keyring.nix {};
|
||||||
|
playshellsound = super.callPackage ./scripts/wm-controls/playshellsound.nix {};
|
||||||
mkscreenshots = super.callPackage ./scripts/wm-controls/mkscreenshots.nix {};
|
mkscreenshots = super.callPackage ./scripts/wm-controls/mkscreenshots.nix {};
|
||||||
moveonscreen = super.callPackage ./scripts/wm-controls/moveonscreen.nix {};
|
moveonscreen = super.callPackage ./scripts/wm-controls/moveonscreen.nix {};
|
||||||
s_check = super.callPackage ./scripts/wm-controls/s_check.nix {};
|
s_check = super.callPackage ./scripts/wm-controls/s_check.nix {};
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
{ host, self, pkgs, }:
|
{ host, self, pkgs, }:
|
||||||
pkgs.writeShellApplication {
|
pkgs.writeShellApplication {
|
||||||
name = "rebuild";
|
name = "rebuild";
|
||||||
|
runtimeInputs = [
|
||||||
|
pkgs.myScripts.playshellsound
|
||||||
|
];
|
||||||
text = ''
|
text = ''
|
||||||
checkbools() { [ "$all" = false ] && [ "$system" = false ] && [ "$home" = false ]; }
|
checkbools() { [ "$all" = false ] && [ "$system" = false ] && [ "$home" = false ]; }
|
||||||
checkflags() {
|
checkflags() {
|
||||||
@@ -24,8 +27,8 @@ pkgs.writeShellApplication {
|
|||||||
all=false
|
all=false
|
||||||
dry=false
|
dry=false
|
||||||
|
|
||||||
hooray() { scheck && runbg aplay "${self}/assets/sound/update.wav"; }
|
hooray() { playshellsound "${self}/assets/sound/update.wav"; }
|
||||||
damn() { scheck && runbg aplay "${self}/assets/sound/error.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"
|
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"
|
||||||
|
|
||||||
|
|||||||
20
overlay/scripts/wm-controls/playshellsound.nix
Normal file
20
overlay/scripts/wm-controls/playshellsound.nix
Normal 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
|
||||||
|
'';
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user