Simple zsh plugin that automatically sends out a notification when a long running task has completed.
Useful for those commands you don't predict will take long to run or just plain forgot to keep track of. Leave the task running and go do something else -
auto-notify will let you know when the task is done!
- Temporarily Disabling Notifications
- Running Tests
You don't need to do anything. Once it's installed,
zsh-auto-notify will let you know if a long running task has completed its work via a notification in your desktop environment.
auto-notify officially supports zsh versions 5.1 onwards.
It is possible the plugin might work on even older versions. However they would not have been tested as part of the CI test process.
Supported desktop environments:
- Linux X/Wayland (Requires
notify-sendto be installed)
Add one of the following to your
.zshrc file depending on your package manager:
antigen bundle "MichaelAquilina/zsh-auto-notify"
zgen load "MichaelAquilina/zsh-auto-notify"
Copy this repository to
$ZSH_CUSTOM is the directory with custom plugins of oh-my-zsh (read more):
git clone https://github.com/MichaelAquilina/zsh-auto-notify.git $ZSH_CUSTOM/plugins/auto-notify
Then add this line to your
.zshrc. Make sure it is before the line
auto-notify will send notifications for tasks that take longer than 10 seconds. You can configure this value by setting the environment variable
# Set threshold to 20seconds export AUTO_NOTIFY_THRESHOLD=20
You can change the formatting of notifications by setting the values for
AUTO_NOTIFY_BODY. When writing these values, the following variables will be replaced according to the data that
auto-notify has detected:
%command- the command that the user executed
%elapsed- number of seconds that elapsed
%exit_code- the exit code of the command that was executed
An example of how these values can be set is shown below:
export AUTO_NOTIFY_TITLE="Hey! %command has just finished" export AUTO_NOTIFY_BODY="It completed in %elapsed seconds with exit code %exit_code"
Notification Expiration Time
You can set how long a notification sent by
auto-notify will remain showing by setting the environment variable
AUTO_NOTIFY_EXPIRE_TIME to a custom value in milliseconds. The default value is set to 8 seconds. NOTE: This configuration option currently only works for Linux.
# Set notification expiry to 10 seconds export AUTO_NOTIFY_EXPIRE_TIME=10000
A number of commands do not get notifications for long running times due to their nature (e.g.
man). The list of ignored commands is specified in the
AUTO_NOTIFY_IGNORE environment variable. This can be modified or completely overwritten based on your use case.
# Add docker to list of ignored commands AUTO_NOTIFY_IGNORE+=("docker")
Make sure that you append to the array above after your plugin manager has been loaded in your