All Projects → marzocchi → Zsh Notify

marzocchi / Zsh Notify

Licence: mit
Desktop notifications for long-running commands in zsh.

Programming Languages

shell
77523 projects
applescript
352 projects

Projects that are alternatives of or similar to Zsh Notify

Pi
A minimalist zsh theme with git status decorations
Stars: ✭ 76 (-80.46%)
Mutual labels:  zsh, iterm2, oh-my-zsh
Dotfiles
What tools and plugins I use for web development?
Stars: ✭ 73 (-81.23%)
Mutual labels:  zsh, iterm2, oh-my-zsh
Nord Iterm2
An arctic, north-bluish clean and elegant iTerm2 color scheme.
Stars: ✭ 651 (+67.35%)
Mutual labels:  zsh, iterm2, macosx
dotfiles
My dotfiles for oh-my-zsh, vim and tmux 📟
Stars: ✭ 23 (-94.09%)
Mutual labels:  zsh, oh-my-zsh, iterm2
bliss-zsh
A delicate Zsh theme that injects color without overwhelming your workspace
Stars: ✭ 20 (-94.86%)
Mutual labels:  oh-my-zsh, iterm2
Starship
☄🌌️ The minimal, blazing-fast, and infinitely customizable prompt for any shell!
Stars: ✭ 20,504 (+5170.95%)
Mutual labels:  zsh, oh-my-zsh
msfvenom-zsh-completion
zsh completion for msfvenom in Metasploit
Stars: ✭ 42 (-89.2%)
Mutual labels:  zsh, oh-my-zsh
go-dev
Golang Dev Env Dockerfile
Stars: ✭ 17 (-95.63%)
Mutual labels:  zsh, oh-my-zsh
Zeta Zsh Theme
Another ⭐️ theme for oh-my-zsh
Stars: ✭ 184 (-52.7%)
Mutual labels:  zsh, oh-my-zsh
zsh-ipip
🔩 An oh-my-zsh plugin for IPIP
Stars: ✭ 13 (-96.66%)
Mutual labels:  zsh, oh-my-zsh
ansible-ohmyzsh
simple ansible role to install oh-my-zsh
Stars: ✭ 38 (-90.23%)
Mutual labels:  zsh, oh-my-zsh
Spaceship Prompt
🚀⭐ A Zsh prompt for Astronauts
Stars: ✭ 15,748 (+3948.33%)
Mutual labels:  zsh, oh-my-zsh
Ansible Role Zsh
Setup antigen with oh-my-zsh, powerlevel10k theme, fzf, autosuggestions, syntax-highlighting
Stars: ✭ 210 (-46.02%)
Mutual labels:  zsh, oh-my-zsh
careful rm
A safe wrapper for rm that adds useful warnings and an optional recycle/trash mode
Stars: ✭ 22 (-94.34%)
Mutual labels:  oh-my-zsh, macosx
Zsh Vi Mode
💻 A better and friendly vi(vim) mode plugin for ZSH.
Stars: ✭ 181 (-53.47%)
Mutual labels:  zsh, oh-my-zsh
zsh-ssh-agent
Ssh-agent management for zsh
Stars: ✭ 19 (-95.12%)
Mutual labels:  zsh, oh-my-zsh
Fz
Cli shell plugin, the missing fuzzy tab completion feature of z jump around command.
Stars: ✭ 359 (-7.71%)
Mutual labels:  zsh, oh-my-zsh
cdc
☣️ Shell plugin for zsh/bash that allows you to cd to subdirectories of user-defined directories from anywhere, without editing CDPATH.
Stars: ✭ 17 (-95.63%)
Mutual labels:  zsh, oh-my-zsh
zshrc
📝 Zsh Configuration for nerds with zplug
Stars: ✭ 28 (-92.8%)
Mutual labels:  zsh, oh-my-zsh
Zsh In Docker
Install Zsh, Oh-My-Zsh and plugins inside a Docker container with one line!
Stars: ✭ 169 (-56.56%)
Mutual labels:  zsh, oh-my-zsh

zsh-notify

Desktop notifications for long-running commands in ZSH.

Supported terminals

⚠️ iTerm2 user? If you don't need support for other terminal have a look at this new project → iterm-notify.

  • On macOS: Terminal.app or iTerm2;
  • On Linux (and possibly other systems): any terminal application should be supported as xdotool and wmctrl are used to query and modify windows state.

Setup and usage

Prerequisites

macOS

Install terminal-notifier.app (default*)

When using tmux on Yosemite:

reattach-to-user-namespace is required to prevent terminal-notifier from hanging (see julienXX/terminal-notifier#115 for details).

Linux/Other

Install notify-send (default*) -- available in libnotify


* usage of custom notifiers is described in Configuration

Installation

Just clone this repository and source notify.plugin.zsh in your ~/.zshrc, or see below for instructions on installing with some popular package managers.

Configuration

The behavior of zsh-notify can be modified by using zstyle after sourcing notify.plugin.zsh.

  • Set a custom title for error and success notifications, when using the built-in notifier.

      zstyle ':notify:*' error-title "Command failed"
      zstyle ':notify:*' success-title "Command finished"
    

    The string #{time_elapsed} will be replaced with the command run time.

      zstyle ':notify:*' error-title "Command failed (in #{time_elapsed} seconds)"
      zstyle ':notify:*' success-title "Command finished (in #{time_elapsed} seconds)"
    
  • Change the notifications icons for failure or success. Provide the path to an image, or an URL if you are on macOS.

      zstyle ':notify:*' error-icon "/path/to/error-icon.png"
      zstyle ':notify:*' success-icon "/path/to/success-icon.png"
    

    Try this. Wow.

  • Play sounds with error and success notifications when using the built-in notifier. Provide the path to an audio file, or the name of an "alert" sound if you are on macOS.

      zstyle ':notify:*' error-sound "Glass"
      zstyle ':notify:*' success-sound "default"
    
  • Have the terminal come back to front when the notification is posted.

      zstyle ':notify:*' activate-terminal yes
    
  • Disable setting the urgency hint for the terminal when the notification is posted (Linux only).

      zstyle ':notify:*' disable-urgent yes
    
  • Set a different timeout for notifications for successful commands (notifications for failed commands are always posted).

      zstyle ':notify:*' command-complete-timeout 15
    

    The default value is 30 seconds.

  • Set application name in notification if set. If this value is not set it will strip the name from message. (only notify-send).

      zstyle ':notify:*' app-name sh
    

    The default value is ''.

  • Set a expire time in notifications (only notify-send).

      zstyle ':notify:*' expire-time 2500
    

    The default value is undefined milliseconds (disabled).

  • Replace the built-in notifier with a custom one at ~/bin/my-notifier. The custom notifier will receive the notification type (error or success) as the first argument, the time elapsed as the second argument, and the command line as standard input.

      zstyle ':notify:*' notifier ~/bin/my-notifier
    
  • Use the time elapsed even when the command fails (by default, notifications for command failures are not conditional on the elapsed time).

      zstyle ':notify:*' always-notify-on-failure no
    
  • Set a blacklist of commands that should never trigger notifications, using a regex support by grep's extended regular expression syntax:

      zstyle ':notify:*' blacklist-regex 'find|git'
    
  • Enable when connected over SSH, which is disabled by default.

      zstyle ':notify:*' enable-on-ssh yes
    
  • Disable error reporting (or send it somewhere else)

      zstyle ':notify:*' error-log /dev/null
    
  • Force checking of the WINDOWID variable on every command:

      zstyle ':notify:*' always-check-active-window yes
    

Installation with package managers

Antigen

Add antigen bundle marzocchi/zsh-notify to your .zshrc with your other bundle commands.

Antigen will handle cloning the plugin for you automatically the next time you start zsh. You can also add the plugin to a running zsh with antigen bundle marzocchi/zsh-notify for testing before adding it to your .zshrc.

Oh-My-Zsh

  1. git clone [email protected]:marzocchi/zsh-notify.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/notify
  2. Add zsh-notify to your plugin list - edit ~./zshrc and change plugins=(...) to plugins=(... notify)

Note: when cloning, specify the target directory as notify since Oh-My-Zsh expects the plugin's initialization file to have the same name as it's directory.

Zgen

Add zgen load marzocchi/zsh-notify to your .zshrc file in the same function you're doing your other zgen load calls in.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].