Not sure how to apply a patch and it would take me time to figure out, and I don't have the time now.
BUT: why not leave the problem to the operating system and/or desktop environment? Maybe, instead of C::B calling a specific xterm, konsole, gnome-terminal or whatever, would it perhaps be a smarter solution if C::B called on x-terminal-emulator instead, and let the OS start the correct terminal emulator pre-configured by the desktop, or even reconfigured by the user?
which x-terminal-emulator
/usr/bin/x-terminal-emulator
If I start x-terminal-emulator from the KDE menu search field, I get an instance of konsole because on my system x-terminal-emulator maps to konsole:
sudo update-alternatives --config x-terminal-emulator
There are 5 choices for the alternative x-terminal-emulator (providing /usr/bin/x-terminal-emulator).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/konsole 40 auto mode
1 /usr/bin/koi8rxterm 20 manual mode
2 /usr/bin/konsole 40 manual mode
3 /usr/bin/lxterm 30 manual mode
4 /usr/bin/uxterm 20 manual mode
5 /usr/bin/xterm 20 manual mode
Press <enter> to keep the current choice[*], or type selection number:
So I am guessing that under Gnome, x-terminal-emulator maps to gnome-terminal? If that is so, would it not be a much simpler and generic solution under linux if C::B used x-terminal-emulator for console output? If correct, C::B terminal output would seamlessly adapt to the current environment.