Search code examples
guardtmux

Guard - "tests are running" indication in tmux?


I use guard for test automation, and it sends notifications to tmux when tests runs complete.

However, some of my tests are fairly long in running, and I don't have any clear way to know, if the tmux pane guard runs in is hidden, whether tests have completed. This is especially true if the tests complete with the same status two runs in a row.

Does guard have support for a different notification which shows that there are running tests?

If so, what's an example configuration if, say, I wanted the tmux session title to turn white while tests are running and then red/green/yellow when they complete?

If not, where should I look in the guard source code if I wanted to develop and pull request that feature?


Solution

  • Check out all the TMux options here:

    https://github.com/guard/guard/blob/45ac8e1013767e1d84fcc590418f9a8469b0d3b2/lib/guard/notifiers/tmux.rb#L24-L38

    There's a display_on_all_clients option - which should flash in any other TMUX clients you have created.

    There's also a color_location option (see TMUX man page for possible values).

    Here's some example settings you can place in your ~/.guard.rb file:

    notification(:tmux, {
      timeout: 0.5,
      display_message: true,
      display_title: true,
      default_message_color: 'black',
      display_on_all_clients: true,
      success: 'colour150',
      failure: 'colour174',
      pending: 'colour179',
      color_location: %w[status-left-bg pane-active-border-fg pane-border-fg],
    }) if ENV['TMUX']