From bdd33e84249224227514d537b44c1e8e16e82188 Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 23 Jan 2022 11:57:53 -0500 Subject: [PATCH] [termdesc] identify Konsole by TDA of ~KDE #2556 --- src/lib/in.c | 6 ++++-- src/lib/in.h | 1 + src/lib/termdesc.c | 12 +++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/lib/in.c b/src/lib/in.c index d85d65e82..da75960af 100644 --- a/src/lib/in.c +++ b/src/lib/in.c @@ -1300,7 +1300,7 @@ da2_cb(inputctx* ictx){ // weird form of Ternary Device Attributes used only by WezTerm static int -da3_cb(inputctx* ictx){ +wezterm_tda_cb(inputctx* ictx){ if(ictx->initdata){ loginfo("read ternary device attributes"); } @@ -1666,6 +1666,8 @@ tda_cb(inputctx* ictx){ ictx->initdata->qterm = TERMINAL_TERMINOLOGY; }else if(strcmp(str, "464F4F54") == 0){ // "FOOT" ictx->initdata->qterm = TERMINAL_FOOT; + }else if(strcmp(str, "7E4B4445") == 0){ + ictx->initdata->qterm = TERMINAL_KONSOLE; } loginfo("got TDA: %s, terminal type %d", str, ictx->initdata->qterm); } @@ -1745,7 +1747,7 @@ build_cflow_automaton(inputctx* ictx){ { "[?2;0;\\N;\\NS", xtsmgraphics_sixel_cb, }, { "[>83;\\N;0c", da2_screen_cb, }, { "[>\\N;\\N;\\Nc", da2_cb, }, - { "[=\\Sc", da3_cb, }, // CSI da3 form as issued by WezTerm + { "[=\\Sc", wezterm_tda_cb, }, // CSI da3 form as issued by WezTerm // DCS (\eP...ST) { "P0+\\S", NULL, }, // negative XTGETTCAP { "P1+r\\S", tcap_cb, }, // positive XTGETTCAP diff --git a/src/lib/in.h b/src/lib/in.h index 9620e5af7..1bc38d17b 100644 --- a/src/lib/in.h +++ b/src/lib/in.h @@ -51,6 +51,7 @@ typedef enum { TERMINAL_RXVT, // rxvt/urxvt, determined by TERM + UNIX TERMINAL_MSTERMINAL, // Microsoft Windows Terminal TERMINAL_MINTTY, // XTVERSION == 'mintty ver' MinTTY (Cygwin, MSYS2) + TERMINAL_KONSOLE, // TDA: "~KDE" (7e4b4445) } queried_terminals_e; // after spawning the input layer, send initial queries to the terminal. its diff --git a/src/lib/termdesc.c b/src/lib/termdesc.c index fcebdd9c0..68dfd3a46 100644 --- a/src/lib/termdesc.c +++ b/src/lib/termdesc.c @@ -848,11 +848,18 @@ apply_rxvt_heuristics(tinfo* ti){ static const char* apply_terminology_heuristics(tinfo* ti){ - ti->caps.rgb = false; // as of at least 1.9.0 + // no RGB as of at least 1.9.0 ti->caps.quadrants = true; return "Terminology"; } +static const char* +apply_konsole_heuristics(tinfo* ti){ + ti->caps.rgb = true; + ti->caps.quadrants = true; + return "Konsole"; +} + static const char* apply_linux_heuristics(tinfo* ti, unsigned nonewfonts){ const char* tname = NULL; @@ -958,6 +965,9 @@ apply_term_heuristics(tinfo* ti, const char* tname, queried_terminals_e qterm, case TERMINAL_TERMINOLOGY: newname = apply_terminology_heuristics(ti); break; + case TERMINAL_KONSOLE: + newname = apply_konsole_heuristics(ti); + break; default: newname = tname; break;