Inspired by Kitty's kitty-query-os_name
$ ./utils/xtgettcap query-os-name
reply: (44 chars): <ESC>P1+r71756572792d6f732d6e616d65=4C696E7578<ESC>\
query-os-name=Linux
Closes #2209
terminfo-query-os-name into master Inspired by Kitty's kitty-query-os_name
$ ./utils/xtgettcap query-os-name
reply: (44 chars): <ESC>P1+r71756572792d6f732d6e616d65=4C696E7578<ESC>\
query-os-name=Linux
Closes #2209
@ -186,3 +187,4 @@
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', platform.system().lower()))
Nice. We should probably make sure that terminals agree on the values for query-os_name.
I'd naively expect os.uname().sysname which is what uname prints,
so it should be a low common denominator (not specific to Python).
If we do that, we could call it query-uname which makes the semantics more obvious (and doesn't mix "-" and "_").
I'm not sure what are the downsides (compared to the kitty approach), maybe that the possible values are not known at compile time? Or that "darwin" is not as nice as "macos".
I'm also fine with platform.system().
Asked on the kitty tracker -> https://github.com/kovidgoyal/kitty/issues/9217
I would also prefer uname. This was really just a quick hack to show how it can be done.
+1 for calling it query-uname as well :)
Even if we keep the original name, query-os_name (query-os-name? query-os?), we could still standardize on using uname as source. That would make it very easy for all Unix terminals. Windows terminals would have to decide together, which name to use.
I've updated the MR to use uname.sysname instead.
To be explicit about the data source, we could add a uname= prefix (query-os-name=uname=$(uname)).
I guess conflicts would be quite unlikely but this seems a bit cleaner.
I'm okay either way I've cc'ed some folks in https://github.com/wezterm/wezterm/issues/7370 in case others want share thoughts.
I wouldn't call .lower() because that makes it needlessly different from uname(1).
Also some nits
query-os_name to query-os-name though I'm fine with eitherquery-system-name would be better.) Hard to tell, so I'd leave query-os.Updated to:
query-os-nameuname -s as is (no lower-casing)uname=$ ./utils/xtgettcap query-os-name
reply: (56 chars): <ESC>P1+r71756572792d6f732d6e616d65=756E616D653D4C696E7578<ESC>\
query-os-name=uname=Linux
Thanks! Tested successfully with this upcoming change.
Usage would be a bit simpler without the uname= prefix but I think I still prefer its explicitness.
So this LGTM; maybe mention it in docs somewhere like this:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6dd0719fa3..b4aec92c16 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -74,8 +74,8 @@
`foot` and `footclient`), allowing you to set a custom toplevel
tag. The compositor must implement the new `xdg-toplevel-tag-v1`
Wayland protocol ([#2212][2212]).
-* `XTGETTCAP`: added `query-os_name`, returning the OS foot is
- compiled for (e.g. _'linux'_) ([#2209][2209]).
+* `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
[2202]: https://codeberg.org/dnkl/foot/issues/2202
diff --git a/README.md b/README.md
index e8f3c8cd5a..632e6147f3 100644
--- a/README.md
+++ b/README.md
@@ -641,6 +641,9 @@
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)`,
+where `$(uname)` is the name of the OS foot was compiled for.
# Credits
Applied, thanks!
16a0154970
2e477f6a37
2e477f6a37
d29b1f915c
d29b1f915c
71a43f5420
71a43f5420
87bc829e87
@ -644,0 +644,4 @@
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.
we got a vote for removing the uname= prefix (https://github.com/wezterm/wezterm/issues/7370#issuecomment-3567974927),
so I think we should do that (it's less surprising).
I'm fine with either. I've dropped the uname=-prefix.
87bc829e87
53b97b90dc
53b97b90dc
d8c69894e3
d8c69894e3
c8cad1af57
c8cad1af57
aa26676c43
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?