Coder Social home page Coder Social logo

zsh-auto-notify's Introduction

ZSH Auto-Notify

CircleCI Version GPLv3

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! 🎉

Usage

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.

img/notification-example.png

Requirements

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-send to be installed)
  • MacOSX

Installation

Add one of the following to your .zshrc file depending on your package manager:

ZPlug

zplug "MichaelAquilina/zsh-auto-notify"

Antigen

antigen bundle "MichaelAquilina/zsh-auto-notify"

Zgen

zgen load "MichaelAquilina/zsh-auto-notify"

Fig

Install zsh-auto-notify with Fig in just one click.

Install with Fig

oh-my-zsh

Copy this repository to $ZSH_CUSTOM/custom/plugins, where $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 source $ZSH/oh-my-zsh.sh.

plugins=(auto-notify $plugins)

Configuration

Notification Threshold

By default, auto-notify will send notifications for tasks that take longer than 10 seconds. You can configure this value by setting the environment variable AUTO_NOTIFY_THRESHOLD:

# Set threshold to 20seconds
export AUTO_NOTIFY_THRESHOLD=20

Notification Formatting

You can change the formatting of notifications by setting the values for AUTO_NOTIFY_TITLE and 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

Ignored Commands

A number of commands do not get notifications for long running times due to their nature (e.g. watch or 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 zshrc.

If you wish to completely redefine what is ignored and not ignored, then just set AUTO_NOTIFY_IGNORE to a new array.

# redefine what is ignored by auto-notify
export AUTO_NOTIFY_IGNORE=("docker" "man" "sleep")

Using a Whitelist to ignore commands

If you wish to use a whitelist approach instead of the default blacklist approach used by AUTO_NOTIFY_IGNORE, you can do so by defining the environment variable AUTO_NOTIFY_WHITELIST with the elements you wish to allow auto-notify to track and send notifications for. NOTE: If AUTO_NOTIFY_WHITELIST is defined, then all the values in AUTO_NOTIFY_IGNORE are not used.

export AUTO_NOTIFY_WHITELIST=("apt-get" "docker")

Adding an icon - Linux

If you wish to have an icon displayed on command success and/or failure, you can do so by defining the environmental variables AUTO_NOTIFY_ICON_SUCCESS and AUTO_NOTIFY_ICON_FAILURE respectively.

export AUTO_NOTIFY_ICON_SUCCESS=/path/to/success/icon.png
export AUTO_NOTIFY_ICON_FAILURE=/path/to/failure/icon.png

Temporarily Disabling Notifications

You can temporarily disable auto notify by running the command disable_auto_notify.

When you want to re-enable notifications, run the command enable_auto_notify.

Contributing

Pull requests and Feedback are welcome! 🎉

I have tried to cater for as many use cases that I can think of. However, they are naturally tailored to to my own workflow and I could be missing many others.

Because of this if there is a specific use case that does not work as you would expect or if you have any suggestions to how the plugin should behave, feel free to open an issue

Running Tests

Install zunit. Run zunit in the root directory of the repo.

$ zunit
Launching ZUnit
ZUnit: 0.8.2
ZSH:   zsh 5.3.1 (x86_64-suse-linux-gnu)

✔ version exported
✔ hook functions are loaded by default
✔ enable/disable auto-notify
✔ auto-notify-send does not send notification for short task
✔ auto-notify-send does not send notification for ignored commands

NOTE: It is required that you use a minimum zunit version of 0.8.2

zsh-auto-notify's People

Contributors

avi-d-coder avatar brendanfalk avatar caderidris avatar dmitmel avatar grafcube avatar michaelaquilina avatar mrymtsk avatar nousefreak avatar spikespaz avatar vierbergenlars avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

zsh-auto-notify's Issues

Add option oppsite to AUTO_NOTIFY_IGNORE

Issue Details

This plugin is helpful for me, but with my workflow I need it only for certain commands, but not to each one. So current behaviour is pretty annoying. Add commands to AUTO_NOTIFY_IGNORE seems an overhead as I adding more and more there. So it could be great to have some option to use this plugin to subset of allowed commands which are really need my attention instead of flood me with tons of notices.

Operating System (uname -a)

Linux 5.2.6-arch1-1-ARCH #1 SMP PREEMPT Sun Aug 4 14:58:49 UTC 2019 x86_64 GNU/Linux

zsh version (zsh --version)

zsh 5.7.1 (x86_64-pc-linux-gnu)

auto-notify version (echo "$AUTO_NOTIFY_VERSION")

0.4.0

How is auto-notify installed?

  • zplug
  • oh-my-zsh
  • Antigen
  • Other (please specify)

Notifications is send again when doing Ctrl+C

Issue Details

When I do Ctrl+C on the command line after a command that triggered a notification, the notification is sent again.

Operating System (uname -a)

rhel

zsh version (zsh --version)

zsh 5.7.1 (x86_64-pc-linux-gnu)

auto-notify version (echo "$AUTO_NOTIFY_VERSION")

0.1.0

How is auto-notify installed?

manually

Steps to reproduce the issue

Run a long running command. When it exit, a notification is send.
Do Ctrl+C => the notification is send again.
Do Ctrl+C => the notification is send again.
Do Ctrl+C => the notification is send again.

gist link to your zshrc

Gmrl config => https://git.grml.org/?p=grml-etc-core.git;a=blob_plain;f=etc/zsh/zshrc;hb=HEAD

Ability to ignore specific subcommands

Issue Details

Please provide the following details when opening an issue:

Operating System (uname -a)

Linux sm-fswbsk013 5.3.0-40-generic #32-Ubuntu SMP Fri Jan 31 20:24:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

zsh version (zsh --version)

zsh 5.7.1 (x86_64-ubuntu-linux-gnu)

auto-notify version (echo "$AUTO_NOTIFY_VERSION")

0.8.0

How is auto-notify installed?

  • zplug
  • oh-my-zsh
  • Antigen
  • Other (please specify)

Is there a way to ignore specific subcommands? For instance, I would like to ignore pipenv shell, but remain notified of other pipenv commands. For instance, running pipenv lock can take some time, for which I would like a notification, but pipenv shell launches a subshell and can remain open for very long periods, without the need for a notification.

I've tried AUTO_NOTIFY_IGNORE+=("pipenv\ shell"), but I don't see the behaviour I would like.

Is this possible currently? Or would I need to just disable pipenv in its entirety?

_is_auto_notify_ignored:6: fork failed: resource temporarily unavailable

Issue Details

Sometimes zsh-auto-notify fails with:

_is_auto_notify_ignored:6: fork failed: resource temporarily unavailable              
_z:25: fork failed: resource temporarily unavailable
zsh: fork failed: resource temporarily unavailable
zsh: fork failed: resource temporarily unavailable

Operating System (uname -a)

Darwin Mackbook-Nikita 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64

zsh version (zsh --version)

zsh 5.7.1 (x86_64-apple-darwin18.6.0)

auto-notify version (echo "$AUTO_NOTIFY_VERSION")

0.8.0

How is auto-notify installed?

  • zplug
  • oh-my-zsh
  • Antigen
  • Other (please specify)

Steps to reproduce the issue

It is not reproducable for me. It just happens sometimes.

gist link to your zshrc

https://github.com/sobolevn/dotfiles

Very slow command execution on OSX

Issue Details

Loading this plugin greatly slows command execution on OSX. I don't seem to have any issues on Linux but don't know if OS is actually the reason. Without this plugin, ls executes instantly, for example. With it, it takes 2-3 seconds from when I hit enter before I can type in the prompt again.

Operating System (uname -a)

Darwin ga69C02W91MBHTDF 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64

zsh version (zsh --version)

zsh 5.7.1 (x86_64-apple-darwin18.2.0)

auto-notify version (echo "$AUTO_NOTIFY_VERSION")

0.8.0

How is auto-notify installed?

Zplugin. Same issue with zplug.

Steps to reproduce the issue

Minimal .zshrc that I have the problem with:

if [[ ! -f ~/.zplugin/bin/zplugin.zsh ]]; then
	git clone https://github.com/zdharma/zplugin.git ~/.zplugin/bin
fi

if [[ -f ~/.zplugin/bin/zplugin.zsh ]]; then
	source ~/.zplugin/bin/zplugin.zsh

	zplugin ice wait lucid \
			atload"AUTO_NOTIFY_IGNORE+=(vimpager emacs rn ranger vimus)"
	zplugin light "MichaelAquilina/zsh-auto-notify"
fi

Minimal .zshrc with zplug:

if [[ ! -f ~/.zplug/init.zsh ]]; then
	git clone https://github.com/zplug/zplug ~/.zplug
fi

if [[ -f ~/.zplug/init.zsh ]]; then
	source ~/.zplug/init.zsh

	zplug "MichaelAquilina/zsh-auto-notify"

	# Install plugins if there are plugins that have not been installed
	if ! zplug check --verbose; then
		printf "Install? [y/N]: "
		if read -q; then
			echo; zplug install
		fi
	fi

	# Then, source plugins and add commands to $PATH
	zplug load --verbose
fi

A list of command which would notify evne if they run for < threshold

Issue Details

I use a mac and I have an alias notifyme which is:osascript -e 'display notification "Ho Ho Ho..." with title "iTerm Alert"'

I use this after the make command like make xxx; notifyme so it would tell me that the make is done.
I need that as I generally move to different desktop after starting the build.
While the make normally take >2min to run, at time it fails in 2-3sec. And that is when I would miss the notification.
I don't want to lower overall threshold to <10s. It would be nice if there can be a list of command which would send notification even if the time is < threshold.

Please provide the following details when opening an issue:

Operating System (uname -a)

M1 Macbook : RELEASE_ARM64_T8101 arm64

zsh version (zsh --version)

zsh 5.8.1 (x86_64-apple-darwin21.0)

auto-notify version (echo "$AUTO_NOTIFY_VERSION")

0.8.0

How is auto-notify installed?

  • zplug
  • [ x] oh-my-zsh
  • Antigen
  • Other (please specify)

Steps to reproduce the issue

Run the command which takes time shorter then threshold.

gist link to your zshrc

I dont know what this is.

Timeout ignored when urgency level critical

Hi,
I noticed that once the command finishes with non-zero exit code the plugin will set urgency level to critical. It appears that on some systems underlying library ignores the timeout (--expire-time). I noticed this on KDE5, but read some reports about GNOME and Ubuntu.
I plan to move to Dunst soon, but anyway.
Please note that it's not zsh-auto-notify bug, but it would be great to make a workaround.
Would it be possible to add another variable to skip this behavior? I can make a PR.

Operating System (uname -a)

Arch Linux 5.2.14-arch2-1-ARCH

zsh version (zsh --version)

zsh 5.7.1 (x86_64-pc-linux-gnu)

auto-notify version (echo "$AUTO_NOTIFY_VERSION")

0.7.0

How is auto-notify installed?

zgen

Steps to reproduce the issue

Use zsh-auto-notify on KDE (perhaps also GNOME3 or Ubuntu).

Question about conditional %exit_code in AUTO_NOTIFY_BODY

Issue Details

I try to customize the notification body in order to display different emojis based on exit (status) codes. The code I put below always returns the failure one even though the status code is zero. I thought there's a trivial issue with the bash/zsh interpolation but I couldn't resolve it, so I'm wondering if someone has any idea or solution.

Thanks a lot for this nice plugin 🙌

export AUTO_NOTIFY_BODY="took %elapsed seconds, status code is %exit_code $([[ %exit_code == '0' ]] && echo '' || echo '')"

Operating System (uname -a)

Linux personal 6.6.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 21 Dec 2023 19:01:01 +0000 x86_64 GNU/Linux

zsh version (zsh --version)

zsh 5.9 (x86_64-pc-linux-gnu)

auto-notify version (echo "$AUTO_NOTIFY_VERSION")

0.8.1

How is auto-notify installed?

  • zplug
  • oh-my-zsh
  • Antigen
  • Other (please specify)

Some options cannot be set in .zshenv

Issue Details

I tried setting AUTO_NOTIFY_THRESHOLD and AUTO_NOTIFY_WHITELIST in my .zshenv. The whitelist works fine, but threshold doesn't. .zshenv gets sourced before .zshrc, so when the plugin is loaded it overwrites AUTO_NOTIFY_THRESHOLD with the default (also AUTO_NOTIFY_EXPIRE_TIME and AUTO_NOTIFY_IGNORE).

Couldn't/shouldn't these have a corresponding DEFAULT_ instead of being exported? Or at least check that the variable isn't already set.

Operating System (uname -a)

Linux pythos 5.5.1-arch1-1 #1 SMP PREEMPT Sat, 01 Feb 2020 16:38:40 +0000 x86_64 GNU/Linux

zsh version (zsh --version)

zsh 5.7.1 (x86_64-pc-linux-gnu)

auto-notify version (echo "$AUTO_NOTIFY_VERSION")

0.8.0

How is auto-notify installed?

  • zplug
  • [ x] oh-my-zsh
  • Antigen
  • Other (please specify)

Steps to reproduce the issue

% cat .zshenv|grep AUTO_NOTIFY_THRESHOLD
export AUTO_NOTIFY_THRESHOLD=60
% source .zshenv
% echo $AUTO_NOTIFY_THRESHOLD
60
% exec zsh
% echo $AUTO_NOTIFY_THRESHOLD
10

gist link to your zshrc

Auto Notify error in Cygwin

Issue Details

I ran into this error after running the micro command.

Unknown platform for sending notifications: CYGWIN_NT-10.0-19045
Please post an issue on gitub.com/MichaelAquilina/zsh-auto-notify/issues/

Please provide the following details when opening an issue:

Operating System (uname -a)

Windows
Drive: Cygwin

zsh version (zsh --version)

5.8 (x86_64-pc-cygwin)

auto-notify version (echo "$AUTO_NOTIFY_VERSION")

0.10.2

How is auto-notify installed?

  • zplug
  • oh-my-zsh
  • Antigen
  • Other (please specify)

It was installed through zap

Steps to reproduce the issue

  1. Install Cygwin
  2. Go to the file explorer and find the C:\cygwin64\home folder
  3. Open the home folder in the terminal
  4. Activate a command that lasts more than 1 second

gist link to your zshrc

https://gist.github.com/louiss0/afc18faa819c49f738267faa61641ff3

notify-send timeout when org.freedesktop.Notifications has not implemented

this situation is easily occurred when zsh running without desktop environment. (eg. use ctrl alt F3 to switch linux tty).
and typing a long time command such as sleep 12

got return:

Error calling StartServiceByName for org.freedesktop.Notifications: Timeout was reached

Operating System

Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.1 LTS
Release:	22.04
Codename:	jammy
Linux karen 5.15.0-69-generic #76-Ubuntu SMP Fri Mar 17 17:19:29 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

ignored_commands.txt and don't show again button

Hi, it would be great if this plugin could read list of ignored commands from a file like ignored_commands.txt, with each ignored command on a new line.
It would then be super easy to add a button on each zsh-auto-notify notification that would do echo %command>>ignored_commands.txt
Most notification daemons support buttons out of the box.
This might not seem like much, but it's a much better workflow than adding the ignored commands to variable in the config file - There are many commands you want to ignore, but it's impossible to remember all of them when writing the config. Adding each command to the config as you get the notification is even more annoying.
This solution would be very quick and user friendly and satisfying - clicking on Don't show again for this command makes up for the annoying notification after exiting neovim.

Sound support

Issue Details

Please provide the following details when opening an issue:

I want to get notified by sound as well as notification. Something like this: https://github.com/julienXX/terminal-notifier#example-uses

Operating System (uname -a)

Darwin Roenissui-MacBookAir-2.local 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:43 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T8112 arm64

zsh version (zsh --version)

zsh 5.9 (arm-apple-darwin22.1.0)

auto-notify version (echo "$AUTO_NOTIFY_VERSION")

0.8.1

How is auto-notify installed?

  • zplug
  • oh-my-zsh
  • Antigen
  • Other (please specify)

Sidenote

First, thank you for building such a cool project. Before zsh-auto-notify, I had to assume how long each command would take and manually apply some other binaries to my command. This really helps my daily life. Thank you Aquilina!

Asking sudo password

Issue Details

Please provide the following details when opening an issue:

Operating System (uname -a)

Linux archy 6.9.4-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 12 Jun 2024 20:17:17 +0000 x86_64 GNU/Linux

zsh version (zsh --version)

zsh 5.9 (x86_64-pc-linux-gnu)

auto-notify version (echo "$AUTO_NOTIFY_VERSION")

0.10.2

How is auto-notify installed?

  • oh-my-zsh

How zsh auto notify work to display sudoo password is asked, example when running yay -Syu or any password related
image

(linux) notify-send Invalid number of options.

Issue Details

i was getting an error from notify-send:

> sleep 11
Invalid number of options.

i had change auto-notify.plugin.zsh#L68 to:

notify-send "${arguments[@]}"

could this be related to some zsh option?


Operating System (uname -a)

Linux hostname 6.9.3-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 31 May 2024 15:14:45 +0000 x86_64 GNU/Linux

zsh version (zsh --version)

zsh 5.9 (x86_64-pc-linux-gnu)

auto-notify version (echo "$AUTO_NOTIFY_VERSION")

0.10.2

How is auto-notify installed?

  • zplug
  • oh-my-zsh
  • Antigen
  • Other: zcomet

ZSH options

$ setopt
alwaystoend
autocd
autopushd
nobgnice
noclobber
completeinword
correct
extendedglob
noflowcontrol
globdots
histexpiredupsfirst
histignoredups
histignorespace
histverify
incappendhistory
interactive
interactivecomments
longlistjobs
monitor
nonomatch
promptsubst
pushdignoredups
pushdsilent
rematchpcre
sharehistory
shinstdin
shwordsplit
zle

AUTO_NOTIFY_IGNORE not working for the ping command

Issue Details

I'm adding ping command to my AUTO_NOTIFY_IGNORE but it keeps notifying me when I run the ping command.

Please provide the following details when opening an issue:

Operating System (uname -a)

Darwin 192.168.1.4 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:17:33 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6031 arm64

zsh version (zsh --version)

zsh 5.9 (arm-apple-darwin22.1.0)

auto-notify version (echo "$AUTO_NOTIFY_VERSION")

0.10.2

How is auto-notify installed?

  • oh-my-zsh
git clone https://github.com/MichaelAquilina/zsh-auto-notify.git $ZSH_CUSTOM/plugins/auto-notify
plugins=(auto-notify)

Steps to reproduce the issue

add export AUTO_NOTIFY_IGNORE=("ping") in your ~/.zshrc after the plugins section

run

ping 8.8.8.8

and control+c after 10 seconds

auto-notify will still notify you about the ping command.

Invalid number of options when no icon is set

Issue Details

zsh-auto-notify results with Invalid number of options. error when no icon is set. The problematic line is:
notify-send "$title" "$body" --app-name=zsh $transient "--urgency=$urgency" "--expire-time=$AUTO_NOTIFY_EXPIRE_TIME" "$icon_arg"
Removing $icon_arg fixes the issue.

Operating System (uname -a)

Linux hostname 6.8.7-arch1-2 #1 SMP PREEMPT_DYNAMIC Fri, 19 Apr 2024 09:51:31 +0000 x86_64 GNU/Linux

zsh version (zsh --version)

zsh 5.9 (x86_64-pc-linux-gnu)

auto-notify version (echo "$AUTO_NOTIFY_VERSION")

0.10.0

How is auto-notify installed?

  • zplug
  • oh-my-zsh
  • Antigen
  • Other (direct with zsh4humans)

Steps to reproduce the issue

  1. Install zsh
  2. Install zsh4humans
  3. Install zsh-auto-notify
  4. Don't set the icon
  5. sleep 11

gist link to your zshrc

https://gist.githubusercontent.com/Grelo4ka/d6792dc219b1e285fba49f09a94bff54/raw/2517750c08fc720df06e2c5807c4e44e69eb2bd7/gistfile1.txt

How do i start debugging if this is not working

Hi

Somehow i am not getting auto-notify to work. Any pointers as to how I go about debugging it?

https://stackoverflow.com/questions/78872651/how-do-i-debug-issue-what-auto-notify-plugin-is-not-working-with-omz

Operating System: Linux dc7-sim-j21-151 4.14.78-10.x86_64 #6 SMP Tue Aug 31 14:02:14 PDT 2021 x86_64 GNU/Linux

zsh version (zsh --version): zsh 5.9 (x86_64-pc-linux-gnu)

auto-notify version (echo "$AUTO_NOTIFY_VERSION")

> echo $AUTO_NOTIFY_EXPIRE_TIME 
    8000

> echo $AUTO_NOTIFY_IGNORE 
    vim nvim less more man tig watch git commit top htop ssh nano

> echo $AUTO_NOTIFY_THRESHOLD 
    60

x echo $AUTO_NOTIFY_VERSION 
   0.10.2

How is auto-notify installed?

  • zplug
  • oh-my-zsh
  • Antigen
  • Other (please specify)

Steps to reproduce the issue

gist link to your zshrc

export ZSH="$HOME/.oh-my-zsh"
DISABLE_UNTRACKED_FILES_DIRTY="true"
ZSH_DISABLE_COMPFIX="true"

zstyle ':omz:update' mode auto      # update automatically without asking
ENABLE_CORRECTION="true"

plugins=(
    gitfast
    zoxide
    vim-interaction
    rsync
    common-aliases
    zsh-autosuggestions
    fast-syntax-highlighting
    history-substring-search
    zsh-interactive-cd
    fzf-tab
    dirhistory
    jsontools
    emacs
    extract
    poetry
    command-time
    autoupdate
    auto-notify
    fzf-zsh-plugin
    zsh-you-should-use
    history
)

fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/ripgrep/complete
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/fd/contrib/completion
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh/Completion/Unix/Command
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zchee-zsh-completions/src/zsh
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/as2/completion
export EDITOR=gvim
export FZF_PREVIEW_ADVANCED=true
export FZF_PREVIEW_WINDOW=''
export FZF_DEFAULT_COMMAND="fd --hidden --strip-cwd-prefix --exclude .git"
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND="fd --type=d --hidden --strip-cwd-prefix --exclude .git"
show_file_or_dir_preview="if [ -d {} ]; then eza --tree --color=always {} | head -200; else bat -n --color=always --line-range :500 {}; fi"
export FZF_CTRL_T_OPTS="--preview '$show_file_or_dir_preview'"
export FZF_ALT_C_OPTS="--preview 'eza --tree --color=always {} | head -200'"
export AUTO_NOTIFY_THRESHOLD=60
# export AUTO_NOTIFY_BODY="It completed in %elapsed seconds with exit code %exit_code"
HISTSIZE=10000000
SAVEHIST=10000000
[ -f $ZSH/oh-my-zsh.sh ] && source $ZSH/oh-my-zsh.sh

# User configuration
setopt appendhistory  #Append history to the history file (no overwriting)
setopt sharehistory      #Share history across terminals
setopt incappendhistory  #Immediately append to the history file, not just when a term is killed
setopt hist_ignore_space
setopt hist_expire_dups_first
setopt hist_ignore_all_dups # Delete old recorded entry if new entry is a duplicate.
setopt hist_verify
setopt bang_hist                 # Treat the '!' character specially during expansion.
# setopt INC_APPEND_HISTORY        # Write to the history file immediately, not when the shell exits.
setopt hist_find_no_dups         # Do not display a line previously found.
setopt hist_save_no_dups         # Don't write duplicate entries in the history file.
setopt hist_reduce_blanks        # Remove superfluous blanks before recording entry.

setopt ignore_eof
setopt no_clobber
setopt rm_star_wait
setopt auto_continue
setopt check_jobs
setopt long_list_jobs
setopt numeric_glob_sort

setopt nomatch
unsetopt list_ambiguous

setopt interactive_comments
setopt COMPLETE_IN_WORD
setopt NO_ALWAYS_TO_END

setopt LIST_PACKED

setopt COMPLETE_ALIASES

zle_highlight=('paste:none')

# beeping is annoying
unsetopt BEEP

_comp_options+=(globdots)       # Include hidden files.

zvm_after_commands+=('[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh')
# . ~/.local/bin/z.sh

# Use lf to switch directories and bind it to ctrl-o
lfcd () {
    tmp="$(mktemp)"
    lf -last-dir-path="$tmp" "$@"
    if [ -f "$tmp" ]; then
        dir="$(cat "$tmp")"
        rm -f "$tmp"
        [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
    fi
}
[ -f ~/.config/zsh/zsh-aliases ] && source ~/.config/zsh/zsh-aliases

# Uncomment the following line to change how often to auto-update (in days).
export UPDATE_ZSH_DAYS=1
export NOVAS_LIC_EXP_CTRL=0
export GHIST_DEFAULT_OPTIONS="-fc upper -f time-,user+,branch,cl,cwd-,cmd -fe cmd:first_file*,cmd:genie_print_env*,cwd:*scratch.???regress*,cwd:*cpuregress_data*,cwd:/tmp*,cmd:ghist*,cmd:nvrun*"

source /home/rmondal/.config/broot/launcher/bash/br
source /etc/profile.d/vte.sh

# Generated for envman. Do not edit.
[ -s "$HOME/.config/envman/load.sh" ] && source "$HOME/.config/envman/load.sh"

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
# [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# Add below lines into $HOME/.zshrc
easyjump_home=/home/nv/utils/stepstone/latest/easyjump
if [ -s $easyjump_home/bin/easyjump.zsh ]; then
    source $easyjump_home/bin/easyjump.zsh $easyjump_home/bin
fi

autoload -Uz compinit
compinit

eval "$(starship init zsh)"

FR: Chanify Integration

If you want, it would be super easy to integrate this with Chanify for push notifications. My fork here https://github.com/aidan-gibson/zsh-auto-notify/blob/master/auto-notify.plugin.zsh does that. All I did was change the notify-send line to curl --form-string "text=$title $body" "https://api.chanify.net/v1/sender/$CHAN" (you must have $CHAN set to your token). I did this real quick and dirty to work for me, but it could be done nicely also.
Thanks for this plugin! Super handy.

A "syntax error" on OS X

Hello,
after running sleep 11 I'm getting:

22:28: syntax error: Element „identyfikator” nie może następować po „„"””. (-2740)

which translated to English is:

22:28: syntax error: Element „identificator” cannot occur after „„"””. (-2740)

Unknown option --transient

Issue Details

Some long running commands get a notification as expected, while others (running and finishing nvim typically get this error) do not get a notification, but instead a warning message is printed:

$ nvim
Unknown option --transient

I suppose it is related to these lines.

Operating System (uname -a)

Linux ubuntu-work 5.19.0-41-generic #42~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 18 17:40:00 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

zsh version (zsh --version)

zsh 5.8.1 (x86_64-ubuntu-linux-gnu)

auto-notify version (echo "$AUTO_NOTIFY_VERSION")

0.8.0

How is auto-notify installed?

  • zplug
  • oh-my-zsh
  • Antigen
  • Other (please specify)

Installed with zap.

Steps to reproduce the issue

With zap, installation is done as: link to location in zshrc

# .zshrc
...
plug "MichaelAquilina/zsh-auto-notify"
...

gist link to your zshrc

zshrc files are form the zsh_mac directory (also my when on my linux machine): zsh_mac.

Icon support reintroduced a previously squashed bug

As currently implemented, the otherwise welcome introduction of support for icons has caused #45 to resurface.

notify-send "$title" "$body" --app-name=zsh $transient "--urgency=$urgency" "--expire-time=$AUTO_NOTIFY_EXPIRE_TIME" "$icon_arg"

Because $icon_arg is quoted, it gets sent unconditionally and, in the case of it being the empty string, will be treated by notify-send as a third (and thus invalid) positional argument. Regrettably, the previous fix of simply removing the quotes would fail to account for space-containing icon names/paths.

I suspect we could get away with just passing "--icon=$icon", but I've only confirmed that suspicion against Dunst on X11 and mako on Wayland. The more robust solution probably involves adding another conditional and duplicating the command.

As an aside, this regression wasn't caught by the tests because zunit is perfectly happy with the following:

run notify-send too many args
assert $state equals 0

In fact, the assertion even holds with just run notify-send, whereas run false does cause it to fail, but I'm afraid I wasn't able to make much headway on that particular mystery.

Request: Evaluate 1 level of aliases to determine ignore rules

Issue Details

I have so many commands like alias gdf=git diff and other git things. git AFAIK is ignored. but the aliases aren't

if $0 is an alias, we could look up the $0 inside that alias and use that to determine the rules

Operating System (uname -a)

zsh version (zsh --version)

auto-notify version (echo "$AUTO_NOTIFY_VERSION")

0.8

How is auto-notify installed?

  • zplug
  • oh-my-zsh
  • Antigen
  • Other (please specify)

Steps to reproduce the issue

gist link to your zshrc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.