guard / notiffany

wrapper for popular notification libs
MIT License
34 stars 25 forks source link

Reset tmux options after showing notification #27

Open docwhat opened 7 years ago

docwhat commented 7 years ago

Currently in Guard, if I use:

notification(
  :tmux,
  display_message: true,
  timeout: 5, # in seconds
  default_message_format: '%s >> %s',
  # the first %s will show the title, the second the message
  # Alternately you can also configure *success_message_format*,
  # *pending_message_format*, *failed_message_format*
  line_separator: ' > ', # since we are single line we need a separator
  color_location: 'status-left-bg', # to customize which tmux element will change color

  # Colors
  default_message_color: 'colour222',
  default: 'colour27',

  success_message_color: 'colour16',
  success: 'colour82',

  failed_message_color: 'colour16',
  failed: 'colour196',

  pending_message_color: 'colour16',
  pending: 'colour220',

  # Notify on all tmux clients
  display_on_all_clients: false
)

Then when I use the status line for anything else, it isn't my default global color but one of the ones above.

An example is showing the "wrong" colors is:

$ tmux command-prompt -p "ssh: " "new-window -n 'ssh/%1' 'ssh %1'"
$ tmux show-options
message-style fg=colour16,bg=colour82
status-left-style bg=colour82

I would like it after each notification that it restores the colors by doing tmux set-option -u on each of the values it set.

docwhat commented 7 years ago

A workaround is to unset all color things; which is not as pretty:

    change_color: false,

    success: nil,
    failed: nil,
    pending: nil,

    default_message_color: nil,
    default: nil,