根据分支名称更改xterm配置文件

时间:2017-02-03 15:31:20

标签: version-control xterm

我想根据我目前所处的分支更改Xterm背景颜色。是否有一种自动化的好方法?

目前我正在手动更改个人资料。而且我发现谷歌无法向我提供答案有点烦人。通过改变提示,每个人似乎都安定下来。

1 个答案:

答案 0 :(得分:1)

你可以从&#34开始修复提示":其中一些答案涉及修改(bash或zsh)提示以发送更改窗口标题的转义序列。 xterm的背景颜色只是另一个转义序列,是同一组Operating System Commands的一部分:

OSC Ps ; Pt BEL
OSC Ps ; Pt ST
          Set Text Parameters.  For colors and font, if Pt is a "?", the
          control sequence elicits a response which consists of the con-
          trol sequence which would set the corresponding value.  The
          dtterm control sequences allow you to determine the icon name
          and window title.

...

          The 10 colors (below) which may be set or queried using 1 0
          through 1 9  are denoted dynamic colors, since the correspond-
          ing control sequences were the first means for setting xterm's
          colors dynamically, i.e., after it was started.  They are not
          the same as the ANSI colors.  These controls may be disabled
          using the allowColorOps resource.  At least one parameter is
          expected for Pt.  Each successive parameter changes the next
          color in the list.  The value of Ps tells the starting point
          in the list.  The colors are specified by name or RGB specifi-
          cation as per XParseColor.

...

            Ps = 1 0  -> Change VT100 text foreground color to Pt.
            Ps = 1 1  -> Change VT100 text background color to Pt.

使用 xterm (不一定是" xterm"模仿者......),

printf '\033]11;blue\007'
printf '\033]11;white\007'

将窗口背景更改为蓝色,然后白色

与" ANSI颜色"的设置不同,动态颜色保持不变,其他转义序列不会重置。

奇怪的是, xterm: how to change the background color? 建议"两个" (实际上 一个 )用于设置背景颜色的不同方式,但这对您的目的没有用。