0

For example I run a command to update my system and that takes a while . I would like to hear a sound when my input is required to reenter my password or confirm something. I am using Zsh on Arch. Thank you!

2 Answers2

2

The terminal doesn't know when an application is reading input, so there's no general solution to this.

If an application displays a prompt before waiting for input, and you can configure that prompt, then add a bell character to this prompt. The bell character is Ctrl+G. In places where backslash escapes are supported, you can write it as \a.

For example, if you want a bell to sound at a sudo prompt, run visudo and add the following line to the sudoers file:

Defaults passprompt="␇[sudo] password for %p: "

with an actual Ctrl+G character instead of (check your editor's configuration to see how to enter a control character).

The effect of the bell character depends on the terminal and its configuration. Many terminals can create an effect such as flashing their title bar.

0

A little lateral, but you could trigger on low CPU usage. You might get some false positives, but eventually you'd catch a process that is just sitting there waiting for your input.

One way is to use batch to schedule a script that just calls echo -ne '\007', which plays the terminal bell. batch will run the script when processor load falls below the preset value (called _LOADAVG_MX on BSD, but AFAIK know, has no name on Arch).

To change the preset load threshold, see https://unix.stackexchange.com/a/306965/216323