When a running app changes the color scheme, after losing focus the scheme is reset (and ruined).
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Terminator |
Fix Released
|
Low
|
Stephen Boddy |
Bug Description
I have a Vim plugin that, when Vim is started, changes the current color scheme of the terminal to (almost) exactly match the colors that would have been displayed had Vim started in a gui (ie true color). This works flawlessly in other terminal emulators, such as gnome-terminal and xfce4-terminal (although doesn't work at all in kde konsole), so I know it's very much possible for it to work. However, in Terminator, the color scheme is successfully set by Vim initially, but anytime Terminator either loses focus or is re-sized, the colors reset and the result is not only hideous but absolutely unreadable. The only way to fix it is to kill Vim and restart it.
I tried to get a screenshot but that proved impossible, whenever I took the screenshot, Terminator lost focus and the colors were reset. So I just took one of Terminator exhibiting its broken colors beside Xfce4-Terminal showing what it ought to look like (and did, before taking the screenshot).
Obviously this isn't a huge bug, but it's enough that Terminator is practically useless to me.
Screenshot: http://
Extras:
Running: Ubuntu 15.10, bug appeared in both Xfce4 and in Plasma
Version: 0.97
I've attached a debug log in which it seems clear that the problem occurs because Terminator reapplies all the default settings for color when it has lost focus, which makes sense.
The vim plugin, incidently, is called CSExact, link below.
Changed in terminator: | |
status: | Incomplete → Triaged |
assignee: | nobody → Stephen Boddy (stephen-j-boddy) |
Changed in terminator: | |
status: | Fix Committed → Fix Released |
So the focus out/in events for the terminal widget switch between active and inactive colour palettes. The inactive one is generated from the configured active palette multiplied by the amount configured in the prefs.
A quick check of the VTE docs suggests that while we can *set* the palette, there is no obvious way to *get* the current palette. I see from the plugin code that it looks to be using shell escape codes to reconfigure the palette. It may be possible to detect those from outside the VTE widget, but if it is, I'm not aware of how to do it.
A fudge solution (if you can live without the dimming of unfocused terminals) is to add a simple wrapping clause around the palette modifications in the focus in/out handlers (terminatorlib/ terminal. py, on_vte_focus_in & on_vte_focus_out).
You can test this out by editing terminatorlib/ terminal. py, on_vte_focus_in & on_vte_focus_out methods to something like:
if self.config[ 'inactive_ color_offset' ] < 1.0: vte.set_ colors( self.fgcolor_ active, self.bgcolor,
self.palette_ active)
self.
You might need to indent the following set_cursor_color call too.
So now, if you set the "Unfocused terminal font brightness" in Global prefs to 1.0, the palette mods don't happen at all and your vim plugin palette should be left alone.