From 4b075bb0750754f219704b99486605ee81634c7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 6 Feb 2024 13:55:30 +0100 Subject: [PATCH] osc: 176 (app-id): implement query+reply Applications can now query for the current app-id with: \E] 176 ; ? \E\\ The reply is \E] 176 ; \E\\ --- osc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/osc.c b/osc.c index 28e93e51..06cc7db6 100644 --- a/osc.c +++ b/osc.c @@ -917,6 +917,18 @@ osc_dispatch(struct terminal *term) break; case 176: + if (string[0] == '?' && string[1] == '\0') { + const char *terminator = term->vt.osc.bel ? "\a" : "\033\\"; + char *reply = xasprintf( + "\033]176;%s%s", + term->app_id != NULL ? term->app_id : term->conf->app_id, + terminator); + + term_to_slave(term, reply, strlen(reply)); + free(reply); + break; + } + term_set_app_id(term, string); break;