From 6005f72476428ecab45fa12f6da55a86291e5d25 Mon Sep 17 00:00:00 2001 From: aszlig Date: Fri, 9 Jul 2021 18:26:00 +0200 Subject: workstation: Patch XTerm to set $COLORTERM While ncurses already has support for detecting direct color terminals, a lot of applications out there do not yet query terminfo but instead rely on some shady COLORTERM environment variable. While I don't really like that approach, patching XTerm to set that variable currently is better than patching all the applications to query terminfo. Signed-off-by: aszlig --- pkgs/aszlig/xterm/default.nix | 5 +++++ pkgs/aszlig/xterm/set-colorterm.patch | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 pkgs/aszlig/xterm/default.nix create mode 100644 pkgs/aszlig/xterm/set-colorterm.patch (limited to 'pkgs/aszlig/xterm') diff --git a/pkgs/aszlig/xterm/default.nix b/pkgs/aszlig/xterm/default.nix new file mode 100644 index 00000000..bbb2144d --- /dev/null +++ b/pkgs/aszlig/xterm/default.nix @@ -0,0 +1,5 @@ +{ xterm }: + +xterm.overrideAttrs (drv: { + patches = [ ./set-colorterm.patch ]; +}) diff --git a/pkgs/aszlig/xterm/set-colorterm.patch b/pkgs/aszlig/xterm/set-colorterm.patch new file mode 100644 index 00000000..2f6b97c5 --- /dev/null +++ b/pkgs/aszlig/xterm/set-colorterm.patch @@ -0,0 +1,13 @@ +diff --git a/main.c b/main.c +index ec3e9bb..88b0983 100644 +--- a/main.c ++++ b/main.c +@@ -4580,6 +4580,8 @@ spawnXTerm(XtermWidget xw, unsigned line_speed) + xtermSetenv("TERM", resource.term_name); + if (!resource.term_name) + *get_tcap_buffer(xw) = 0; ++ else if (!strcmp(resource.term_name, "xterm-direct")) ++ xtermSetenv("COLORTERM", "truecolor"); + + sprintf(buf, "%lu", + ((unsigned long) XtWindow(SHELL_OF(CURRENT_EMU())))); -- cgit 1.4.1