Coder Social home page Coder Social logo

zlong_alert.zsh's Introduction

zlong_alert.zsh

zlong_alert.zsh will send a desktop notification and sound a bell to alert you when a command that has taken a long time (default: 15 seconds) has completed.

Desktop notifications are sent using notify-send on Linux and using alerter on MacOS.


Installation

Pre-requisite for MacOS only

Ensure that you downloaded the alerter binary from here, have placed it in your PATH, and given the file executable permissions before continuing with any of the installation methods.

zplug

zplug "kevinywlui/zlong_alert.zsh"

Oh My Zsh

  1. Clone into $ZSH_CUSTOM/plugins/zlong_alert.
  2. Add zlong_alert to plugins in .zshrc.

Manual

This script just needs to be sourced so add this to your .zshrc:

source /path/to/zlong_alert.zsh

Configuration

There are 4 variables you can set that will alter the behavior this script.

  • zlong_duration (default: 15): number of seconds that is considered a long duration.
  • zlong_ignore_cmds (default: "vim ssh"): commands to ignore.
  • zlong_send_notifications (default: true): whether to send notifications.
  • zlong_ignorespace (default: false): whether to ignore commands with a leading space

For example, adding the following anywhere in your .zshrc

zlong_send_notifications=false
zlong_duration=2
zlong_ignore_cmds="vim ssh pacman yay"

will alert you, without sending a notification, if a command has lasted for more than 2 seconds, provided that the command does not start with any of vim ssh pacman yay.

Changelog

See CHANGELOG

Credit

This script is the result of me trying to understand and emulate this gist: https://gist.github.com/jpouellet/5278239 My version fixes some things (possibly bugs?) that I did not like about the original version.

zlong_alert.zsh's People

Contributors

chrisrhayden avatar dakshin-k avatar deseven avatar hankyusa avatar kevinywlui avatar

Watchers

 avatar

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.