aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2025-11-12 09:22:17 +0000
committerDaniel Eklöf <daniel@ekloef.se>2025-12-20 14:59:31 +0000
commitaa26676c43edf2cfcc3543a443a25e881e34473e (patch)
tree67a8b4bc9cec358052104ae3e54423ded83d1c32
parentconfig: remove deprecated config option cursor.color (diff)
builtin terminfo: add custom 'query-os-name'
Inspired by Kitty's 'kitty-query-os_name'. Notable changes: * Drop kitty prefix * os_name -> os-name * Use "uname -s" without any transformations (e.g. no lower-casing) $ ./utils/xtgettcap query-os-name reply: (44 chars): <ESC>P1+r71756572792d6f732d6e616d65=4C696E7578<ESC>\ query-os-name=Linux Closes #2209
-rw-r--r--CHANGELOG.md3
-rw-r--r--README.md4
-rwxr-xr-xscripts/generate-builtin-terminfo.py2
3 files changed, 9 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3a73893d..6fa7439e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -76,8 +76,11 @@
Wayland protocol ([#2212][2212]).
* `[colors-dark]` section to `foot.ini`. Replaces `[colors]`.
* `[colors-light]` section to `foot.ini`. Replaces `[colors2]`.
+* `XTGETTCAP`: added `query-os-name`, returning the OS foot is
+ compiled for (e.g. _'Linux'_) ([#2209][2209]).
[2212]: https://codeberg.org/dnkl/foot/issues/2212
+[2209]: https://codeberg.org/dnkl/foot/issues/2209
### Changed
diff --git a/README.md b/README.md
index e8f3c8cd..7ee771ba 100644
--- a/README.md
+++ b/README.md
@@ -641,6 +641,10 @@ All replies are in `tigetstr()` format. That is, given the same
capability name, foot's reply is identical to what `tigetstr()` would
have returned.
+In addition to queries for terminfo entries, the `query-os-name` query
+will be answered with a response of the form `uname=$(uname -s)`,
+where `$(uname -s)` is the name of the OS foot was compiled for.
+
# Credits
diff --git a/scripts/generate-builtin-terminfo.py b/scripts/generate-builtin-terminfo.py
index 28b31b57..6a6ba68c 100755
--- a/scripts/generate-builtin-terminfo.py
+++ b/scripts/generate-builtin-terminfo.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import argparse
+import os
import re
import sys
@@ -185,6 +186,7 @@ def main():
entry.add_capability(StringCapability('TN', target_entry_name))
entry.add_capability(StringCapability('name', target_entry_name))
entry.add_capability(IntCapability('RGB', 8)) # 8 bits per channel
+ entry.add_capability(StringCapability('query-os-name', os.uname().sysname))
terminfo_parts = []
for cap in sorted(entry.caps.values()):