Open hg42 opened 2 years ago
oh, I understand, OSC is a D vs C interfacing thing, as you mentioned in: https://github.com/gnunn1/tilix/issues/376#issuecomment-282531240
I'm also looking for a solution to modify the background color from the shell. I haven't find anything yet...
the comment I linked is more about how VTE handles unknown (escape) sequences. But OSC 10 and OSC 11 should be handled by VTE alone. As I said other VTE based terminals work. I don't think VTE dropped that feature.
For testing, I would like to find another terminal that uses libvte-3-0 or may be a Tilix using libvte-2.91-0
I digged a bit into the bug report you mention there. If I am understanding that correctly, it is more about sending unknown/unsupported codes to the application. So, this should not affect OSC sequences that are handled inside VTE, right?
Additionally what I thought was libvte-3-0 really was libvted-3-0 (the D language binding) which itself uses libvte-2.91-0, so, at the end it's the same vte lib.
It would be so nice if I could simply use printf "\033]11;%s\007" "$bg_color"
or xtermcontrol --bg "$bg_color"
but I do have a workaround.
A Typical use-case for changing backgrounds is doing so when you SSH into a remote. Tilix does have Automatic Profile Switching feature, but it does not support any kind of wildcard matching so it's not very practical when you have lots of dynamically provisioned servers. Instead, I spoof the directory name with a script. For example, I have a profile called "SSH red" and in its Automatic Profile Switching settings I have a rule to match :/red
(i.e. don't match hostname, match current path). Then, in my SSH config, I have something like Localcommand printf "\033]7;file://%s%s/\007" %h /red
. So Tilix "thinks" I'm in folder /red
so will change the profile accordingly. The %h
replaced by SSH with the hostname.
As a bonus you don't need to worry about restoring the previous profile when you exit SSH.
Also, if the hostname is just an IP, e.g. 11.22.33.44
, Tilix won't display a badge.
I usually want to change colors depending on conditions, including user, ssh, etc. but also shells or REPLs and other modes like directory chooser etc. This is all part of my prompt scripts. I also want this to work in different situations and on different systems with different terminals and not everything under my control. This only works with scripting and control codes. Special features of several terminals work very different and profile switching is usually not scriptable / controllable from inside. All my previously used standard terminals worked with these scripts, different xterm variants, gnome-terminal, konsole, xfce4-terminal, ...
Lately, I wanted to upgrade my main terminal, but surprise! the colors don't work. That's a pity because everything else is perfect. Still, these xterm control features are kind of a minimum requirements for me and others (also including setting the window title and similar)
The OSC sequence / xtermcontrol
command for setting the background color doesn't work, see #1455 for details. All the other colors (foreground, 256 palette colors etc.) should work.
Long story short: Instead of asking VTE to use the said color, Tilix rather asks VTE to use a fully transparent background, and it places a canvas of the selected solid background color behind VTE. This solution only knows about the background color chosen in Tilix's settings, not the OSC override.
Does all this mean there's no foreseeable fix at the moment? 😢
I'm using the current Tilix on Debian, which is 1.9.4.
I use a lot of different terminals, so I don't want to use color schemes features of terminals. Instead I am used to set the color palette, title etc. from scripts, so I can dynamically adapt colors to conditions, like user and host.
I am using escape sequences (OSC) for this, something like this:
"\e]10;$fg_color\a\e]11;$bg_color\a"
The same can be achieved with xtermcontrol and similar tools. I also use such tools to control the window state from within the terminal via scripts (e.g. lower terminal window if background work is done and raise it if needing attention).
But all this does not work with Tilix (for me).
Perhaps, I have to use some option or setting to enable this? but I didn't find any.
I thought, VTE might not be able to do that, but many of my terminals use VTE and they all work like expected (e.g. xfce4-terminal, sakura, roxterm, termit, ...).
Well, I the main difference seems to be that Tilix uses libvte-3-0, while the others use libvte-2.91-0... [EDIT: wrong, it's libvted-3-0 (D binding) which uses libvte2.91-0]