Giter Site home page Giter Site logo

xieyt / xontrib-cmd-durations Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jnoortheen/xontrib-cmd-durations

0.0 0.0 0.0 807 KB

Show long running commands durations in prompt with option to send notification when terminal is not focused.

License: MIT License

Python 100.00%

xontrib-cmd-durations's Introduction

Overview

Send notification once long-running command is finished and also show the execution time.

Installation

To install use pip:

xpip install xontrib-cmd-durations
# or: xpip install -U git+https://github.com/jnoortheen/xontrib-cmd-durations

Usage

Add the long_cmd_duration section to the prompt fields and load the xontrib i.e.:

$RIGHT_PROMPT = '{long_cmd_duration:โŒ›{}}{user:{{BOLD_RED}}๐Ÿค–{}}{hostname:{{BOLD_#FA8072}}๐Ÿ–ฅ{}}'
$XONTRIB_CD_LONG_DURATION = 5  # default
xontrib load cmd_done

If the command is taking more than $XONTRIB_CD_LONG_DURATION seconds then long_cmd_duration returns the duration in human readable way:

The desktop notification is sent if the terminal is not focused:

Currently the focusing part requires xdotool to be installed.

Known issues

Notifications in Windows

On windows the notification will get triggered all the time. Finding whether the terminal is focused is not implemented for Windows yet and PRs are very welcome on that. Set $XONTRIB_CD_TRIGGER_NOTIFICATION = False to completely off the notification part.

Notifications in MacOS

If you want to change the app name in notification in MacOS you can use $XONTRIB_CD_NOTIFICATION_APP_NAME environment variable with automatically replaced keywords:

$XONTRIB_CD_NOTIFICATION_APP_NAME = '{user}@{hostname}:{cwd}'
$RIGHT_PROMPT = '{long_cmd_duration}'
xontrib load cmd_done

sleep 6
# Switch to another window

Result:

Credits

This package was created with xontrib cookiecutter template.

xontrib-cmd-durations's People

Contributors

jnoortheen avatar anki-code avatar dependabot[bot] 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.