Metadata-Version: 2.1
Name: xontrib-cmd-durations
Version: 0.2.7
Summary: Send notification once long running command is finished. Add duration PROMP_FIELD.
Home-page: https://github.com/jnoortheen/xontrib-cmd-durations
License: MIT
Keywords: xontrib,xonsh
Author: Noortheen Raja J
Author-email: jnoortheen@gmail.com
Requires-Python: >=3.6
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development
Classifier: Topic :: System :: Shells
Classifier: Topic :: System :: System Shells
Classifier: Topic :: Terminals
Classifier: Topic :: Utilities
Requires-Dist: notify-py (>=0.3.3); python_version >= "3.6" and python_version < "4.0"
Requires-Dist: xonsh (>=0.10)
Project-URL: Code, https://github.com/jnoortheen/xontrib-cmd-durations
Project-URL: Documentation, https://github.com/jnoortheen/xontrib-cmd-durations/blob/master/README.md
Project-URL: Issue tracker, https://github.com/jnoortheen/xontrib-cmd-durations/issues
Project-URL: Repository, https://github.com/jnoortheen/xontrib-cmd-durations
Description-Content-Type: text/markdown

## Overview

<p align="center">
Send notification once long-running command is finished and also show the execution time..
</p>

## Installation

To install use pip:

``` bash
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](https://xon.sh/tutorial.html#customizing-the-prompt) and load the xontrib i.e.:

``` bash
$RIGHT_PROMPT = '{long_cmd_duration:⌛{}}{user:{{BOLD_RED}}🤖{}}{hostname:{{BOLD_#FA8072}}🖥{}}'
$XONRTIB_CD_LONG_DURATION = 5  # default
xontrib load cmd_done
```

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

![](./images/2020-10-26-10-59-38.png)

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

![](./images/2020-11-02-13-38-47.png)

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 `$XONRTIB_CD_TRIGGER_NOTIFICATION = False` to completely off the notification part.


## Credits

This package was created with [xontrib cookiecutter template](https://github.com/jnoortheen/xontrib-cookiecutter).

