I was thinking , would it be helpful and efficient to get a notification(sound or popup) back after npm finish running a task , a long installation for example . I'm using vscode and running most of my command in the integrated terminal and while waiting for it to finish I ended up spending more time on doing other task that is non-productive.
So we can break this down to running npm install
, followed by some way of making a sound. According to this thread, a simple beep can be done using:
echo -en "\007"
.
Combine these two, and you get:
npm install; echo -en "\007"
The use of ;
ensures that the beep is played even if npm install
fails (as opposed to &&
which only runs the beep if the first command is successful). You could also look here for how to start playing a song with VLC: play-only-audio-with-vlc
npm install
? Like a global postinstall
script. –
Guppy npm
, I doubt it is possible. You could create an alias in that case. –
Industrious If your npm install
is part of a task, VSCode 1.72 (Sept. 2022) will offer:
add audio cue for task end and terminal bell
Settings
audioCues.taskEnded
This has been released to VSCode Insiders yesterday.
For a slightly different solution there is a npm package named benny-hill:
Play the Benny Hill theme while running another command
e.g.
npx benny-hill npm install
will play Yakety Sax while you're waiting.
Actually there is a npm package doing exactly what you are asking for:
Literally tells you when a command is done running.
E.g.
npx okimdone npm install
It depends on external speech to text tools like espeak or festival to produce the audio.
for cmd like Terminals
Your_Command && [System.Media.SystemSounds]::Beep.Play()
Sounds: Beep, Hand, Quetsion, Asterisk, Exclamation
You can also play the raw sound and changes its pitch and duration [console]::beep(1000,500)
There are two terminal audio signals that are helpful here:
Accessibility > Signals: Terminal Command Succeeded
Accessibility > Signals: Terminal Command Failed
These are settings you can find in your Setting UI. You will probably need to change the volume, search for "signals volume" in your Settings UI.
© 2022 - 2024 — McMap. All rights reserved.
npm install; [search on how to make a sound from bash]
, e.g. this -;
instead of&&
since you may want an alert even if it fails. – Industrious