Tmux 设置更改窗口的颜色

if *_*one 4 tmux

当非当前窗口的内容发生变化时,我让 Tmux 通知我。

setw -g monitor-activity on
set -g visual-activity on  
Run Code Online (Sandbox Code Playgroud)

唯一的问题是,它的颜色很糟糕。我想将 fg/bg 的颜色从灰色更改为更好地融合的颜色。我该怎么做(选项名称是什么)?

Chr*_*sen 8

活动和静音监控功能共享一组显示配置选项:

  • window-status-activity-attr
  • window-status-activity-fg
  • window-status-activity-bg

“attr”的默认值是reverse,因此如果您还更改颜色,您可能需要将其设置为其他值(这样…-fg将设置有效的前景色而不是反转为有效的背景色);请参阅 的手册页描述中的属性名称列表message-attr

颜色默认为default,在构建状态行时只保留上次设置的颜色;请参阅 的手册页描述中的颜色列表message-bg

set-option -gw window-status-activity-attr bold
set-option -gw window-status-activity-bg black
set-option -gw window-status-activity-fg red
Run Code Online (Sandbox Code Playgroud)

其他“警报”(内容监控和铃声)有自己的显示选项(替换activitycontentbell在选项名称中)。


Ste*_* Lu 5

实际上,在后来的 tmux 版本中(我在 1.9a 上看到了这一点),样式设置的方式似乎发生了变化。

虽然@ChrisJohnsen 的回答仍然适用(并且我的 tmuxconfig 当然仍然使用这些语句),但是如 manage 所解释的那样,执行此操作的新方法是使用*-style而不是 的三元组*-attr *-bg *-fg,因此您可以使用单个窗口选项指定样式声明而不是三个。

message-command-style style
    Set status line message command style, where style is a
    comma-separated list of characteristics to be specified.

    These may be `bg=colour' to set the background colour,
    `fg=colour' to set the foreground colour, and a list of
    attributes as specified below.

    The colour is one of: black, red, green, yellow, blue,
    magenta, cyan, white, aixterm bright variants (if sup-
    ported: brightred, brightgreen, and so on), colour0 to
    colour255 from the 256-colour set, default, or a hexadec-
    imal RGB string such as `#ffffff', which chooses the
    closest match from the default 256-colour set.

    The attributes is either none or a comma-delimited list
    of one or more of: bright (or bold), dim, underscore,
    blink, reverse, hidden, or italics, to turn an attribute
    on, or an attribute prefixed with `no' to turn one off.

    Examples are:

          fg=yellow,bold,underscore,blink
          bg=black,fg=default,noreverse

    With the -a flag to the set-option command the new style
    is added otherwise the existing style is replaced.
Run Code Online (Sandbox Code Playgroud)

所以这个声明将是:

set-option -gw window-status-activity-style fg=red,bg=black,bold
Run Code Online (Sandbox Code Playgroud)