aboutsummaryrefslogtreecommitdiff
path: root/osc.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-02-06 12:55:30 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-02-06 12:55:30 +0000
commit4b075bb0750754f219704b99486605ee81634c7b (patch)
tree6490999c189b3ce36ee79726e93ff4b174ffb6b7 /osc.c
parentMerge branch 'app-id' (diff)
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 ; <title> \E\\
Diffstat (limited to 'osc.c')
-rw-r--r--osc.c12
1 files changed, 12 insertions, 0 deletions
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;