• Stars
    star
    101
  • Rank 338,166 (Top 7 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Tmux plugin to notify you when processes are finished.

tmux-notify

Maintained Contributions Tmux version

tmux notify logo

Tmux plugin to notify you when processes are finished.

Note

Notifications are sent via libnotify, and visual bells are raised in the Tmux window. Visual bells can be mapped (in the terminal level) to the X11 urgency bit and handled by your window manager.

Table of Contents

Use cases

  • When you have already started a process in a pane and wish to be notified (i.e. you can't use a manual trigger).
  • Working in different containers (Docker) -> can't choose the shell -> and can't use a shell-level feature.
  • Working over ssh, but your Tmux is on the client side.

Pre-requisites

  • Bash
  • Tmux
  • notify-send or osascript.
  • Optional: wget (for telegram notifications).

Note

Works on Linux and macOS (note: only actively tested on Linux).

Install

Using Tmux Plugin Manager, add:

set -g @plugin 'rickstaa/tmux-notify'

to your .tmux.conf.

Use prefix + I to install.

Usage

  • prefix + m: Start monitoring a pane and notify when it finishes.

  • prefix + alt + m: Start monitoring a pane, return it in focus and notify when it finishes.

  • prefix + M: Cancel monitoring of a pane.

Important

There is a known issue with alt-based Tmux shortcuts on osx. If you encounter problems, please check this post for a workaround.

Configuration

Enable verbose notification

The default notification text is Tmux pane task completed!. This tool also contains a verbose output option which gives more information about the pane, window, and session the task has completed.

To enable this, put set -g @tnotify-verbose 'on' in the .tmux.conf config file.

Change the verbose notification message

To change the verbose notification text, put set -g @tnotify-verbose-msg 'put your notification text here' in the .tmux.conf config file. You can use all the Tmux variables in your notification text. Some useful Tmux aliases are:

  • #D: Pane id
  • #P: Pane index
  • #T: Pane title
  • #S: Session name
  • #I: Window index
  • #W: Window name

For the complete list of aliases and variables, you are referred to the FORMATS section of the tmux manual. You can also add a notification title using set -g @tnotify-verbose-title. Doing so will move the verbose notification text into the notification body.

Change monitor update period

By default, the monitor sleep period is set to 10 seconds. This means that tmux-notify checks the pane activity every 10 seconds.

Put set -g @tnotify-sleep-duration 'desired duration' in the .tmux.conf file to change this duration.

Warning

Remember that there is a trade-off between notification speed (short sleep duration) and the amount of memory this tool needs.

Add additional shell suffixes

The Tmux notify script uses your shell prompt suffix to check whether a command has finished. By default, it looks for the $, # and % suffixes.

Put set -g @tnotify-prompt-suffixes 'put your comma-separated bash suffix list here' in the .tmux.conf file to add additional suffixes.

Note

Feel free to open a pull request or issue if you think your shell prompt suffix should be included by default.

Enable telegram channel notifications

Warning

This feature requires wget to be installed on your system.

By default, the tool only sent operating system notifications. It can, however, also send a message to a user-specified telegram channel.

Put set -g @tnotify-telegram-bot-id 'your telegram bot id' and set -g @tnotify-telegram-channel-id 'your channel id' in the .tmux.conf config file to enable this.

After enabling this option, the following key bindings are available:

  • prefix + ctrl + m: Start monitoring pane and notify in bash and telegram when it finishes.

  • prefix + ctrl + alt + m: Start monitoring a pane, return it in focus and notify in bash and telegram when it finishes.

Additionally, you can use the set -g @tnotify-telegram-all 'on' option to send all notifications to telegram.

Note

You can get your telegram bot id by creating a bot using BotFather and your channel id by sending your channel invite link to the @username_to_id_bot bot.

Execute custom notification commands

You can execute a custom command after a process has finished by putting set -g @tnotify-custom-cmd 'your custom command here' in the .tmux.conf file. The custom command is executed in the pane where the process has finished. If you want to execute multiple commands, you can also put them in a bash script and execute this script (i.e. set -g @tnotify-custom-cmd 'bash /path/to/script.sh').

Warning

The custom command is executed using the eval command, so be careful with what you put in here.

Note

Please consider contributing to this repository if your custom command is useful for others.

How does it work

A naive approach. Checks if pane content ends with the bash prompt suffixes mentioned above every 10 seconds.

Other use cases

Use inside a docker container

Because tmux-notify uses libnotify to send notifications, it needs access to the host's D-Bus socket. An excellent guide on how to do this can be found here. You can also check out the examples/docker folder for an example.

Contributing

Feel free to open an issue if you have ideas on how to make this GitHub action better or if you want to report a bug! All contributions are welcome πŸš€. Please consult the contribution guidelines for more information.

References

More Repositories

1

github-emoji-picker

A simple emotion picker that displays all the supported GitHub emojis :octocat:.
TypeScript
367
star
2

awesome-adsb

πŸ“‘ A curated list of awesome ASD-B tools, projects, images, resources and other shiny things.
HTML
94
star
3

action-create-tag

Simple GitHub action that can be used to create a tag inside a GitHub action.
Shell
59
star
4

.ros_conda_wrapper

Wrapper for using ROS inside of a conda enviroment
Shell
50
star
5

action-black

Runs the psf/black formatter to check/format your python code.
Shell
37
star
6

ros-gazebo-gym

Framework for integrating ROS and Gazebo with gymnasium, streamlining the development and training of RL algorithms in realistic robot simulations.
Python
27
star
7

todoist-global-shortcuts-WIN10

Since TODOIST its Windows 10 app doesn’t support global shortcuts at the moment. I made a little workaround for the "open TODOIST" global shortcut.
VBScript
26
star
8

realsense-ros-gazebo

Gazebo implementation of the realsense-ros repository
25
star
9

top-issues-action

Labels and displays the top-upvoted (i.e. πŸ‘) issues and pull requests in your repository.
TypeScript
20
star
10

rickstaa

My personal readme.md
12
star
11

stable-gym

This package contains several gymnasium environments with positive definite cost functions, designed for compatibility with stable RL agents.
Python
12
star
12

panda-autograsp

An autonomous grasping solution for the Emika Franka Panda robot.
Python
10
star
13

moveit-tutorials-python-examples

A number of python examples that were created based on the Moveit tutorials C++ tutorials.
Python
8
star
14

panda-gazebo

A reinforcement learning-oriented Panda Emika Franka gazebo simulation.
Python
8
star
15

stable-learning-control

A framework for training theoretically stable (and robust) Reinforcement Learning control algorithms.
Python
6
star
16

action-contains-tag

Simple GitHub action that can be used to check if a commit or branch contains a given tag.
Shell
5
star
17

crypto-listings-sniper

A small bot that watches exchanges for new coin/token listings and, in less than 0.3 seconds, posts a Telegram/Discord message
Go
5
star
18

adsb-dashboards

A selection of several useful ADS-B Grafana dashboards.
Go
5
star
19

action-get-semver

Outputs the current/next major, minor, and patch version based on the given semver version.
Shell
5
star
20

ros-gazebo-gym-ws

A Catkin workspace designed to simplify the setup and use of the ROS Gazebo Gym framework.
Python
4
star
21

empty-issues-closer-action

GitHub action that automatically closes empty issues or issues which contain an unchanged template.
TypeScript
4
star
22

webpack5-esm-library-example

A small example repo on how to bundle a ESM library using webpack5
JavaScript
4
star
23

ros-gazebo-gym-examples

A set of practical examples showcasing the use of gymnasium environments in the ros-gazebo-gym package.
Python
4
star
24

windows-terminal-settings

A backup repository for the windows-terminal profiles.json file.
2
star
25

wordeq-2-latexeq

Small Javascript Regex app that converts Word equations to Latex equations.
TypeScript
2
star
26

get-livepeer-ai-stats

Some simple python script to get stats about the Livepeer AI subnet.
Python
2
star
27

test-markdown-admonitions

Quick test to check if the markdown admonitions work in the GitHub readme.
2
star
28

real-panda-control-examples

A small example repository that contains examples for controlling the real Panda robot.
Python
2
star
29

action-update-semver

Updates major/minor release tags on a tag push.
Shell
2
star
30

thesis-stable-variable-impedance-learning

LATEX report of my literature study into stable variable impedance learning.
TeX
2
star
31

theta-setup

My Theta edge node setup.
2
star
32

octokit_rest_create_pull

Small example repository on how to create a PR using the Octokit Rest API.
JavaScript
1
star
33

deep-robotics-singularity-recipes

This repository contains the singularity recipes I use for my robotics projects.
Python
1
star
34

nitro-type-race-info-footer

A userscript that adds an informational footer to the nitro type racing page.
JavaScript
1
star
35

action-test-repo

Repository to test my github actions
1
star
36

nitro-type-show-daily-races

A small userscript that adds the average daily races to the team roster table on the NitroType team page.
JavaScript
1
star
37

check-prb0t-action

Simple GitHub action that checks whether a PR was created using the PRB0t PR anonymiser.
Shell
1
star
38

ssh-config-example

My ssh config example
1
star
39

relative_md_links_file_bug

Small example repository to show that relative links to non-markdown files do not work.
1
star
40

hello-world-composite-action-output-bug

Small little example repository for community/community#47775.
Shell
1
star
41

.pathmod

A bash script that makes it easier to view and modify the PATH and PYTHONPATH environment variables
Shell
1
star
42

prb0t-pr-trigger-test

A small repository to test whether the `pull_request` trigger works when [PRB0t](https://github.com/PRB0t/PRB0t) creates a PR.
1
star
43

multi-platform-docker-dev-container-test

This is a small example repository to show that buildx build arguments are not working as expected in vscode dev containers.
Dockerfile
1
star
44

test-issue-templates

A simple repository to test some settings for issue-templates.
1
star
45

CODEOWNERS_TEST

Simple repo to test configuration of the CODEOWNERS file.
1
star
46

MBD-B

This repository contains the codes I wrote for the course MBDB during my master Biomechanical design It contains my solutions to the course assignments.
MATLAB
1
star
47

stand_alone_sub_package_folder_example

Example repository for including stand alone subpackages into other python packages.
Python
1
star
48

es6-jest-example

A example that shows how to use es6 with jest.
JavaScript
1
star
49

pull_request_synchronize_trigger_test

Simple repository to test whether the `pull_request.synchronize` type is also triggered when a PR is closed.
1
star
50

org-contributors-contributions-overview

A small Python script to fetch GitHub contributions by organization members and open-source contributors of a GitHub organization.
Python
1
star
51

mintlify-docs

MDX
1
star
52

warnings-discord-bot

A Go-based Discord bot that monitors chat messages for specified keywords and conditions, issuing automated warnings to maintain a respectful and safe chat environment
Go
1
star