commit f177d0544108d2fbf567ee0db646efc99e72d47f
parent 3ab1f0ca3d4f7701c7219f9401f5f372bedc244b
Author: Jacob McNamee <jacob@jacobmcnamee.com>
Date: Fri, 27 Dec 2024 00:03:06 -0800
tree/container: support sandbox properties in title format
Diffstat:
2 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/sway/sway.5.scd b/sway/sway.5.scd
@@ -372,12 +372,29 @@ set|plus|minus|toggle <amount>
*title_format* <format>
Sets the format of window titles. The following placeholders may be used:
- %title - The title supplied by the window ++
- %app_id - The wayland app ID (applicable to wayland windows only) ++
- %class - The X11 classname (applicable to xwayland windows only) ++
- %instance - The X11 instance (applicable to xwayland windows only) ++
- %shell - The protocol the window is using (typically xwayland or
- xdg_shell)
+ *%title*
+ The title supplied by the window
+
+ *%app_id*
+ The wayland app ID (applicable to wayland windows only)
+
+ *%class*
+ The X11 classname (applicable to xwayland windows only)
+
+ *%instance*
+ The X11 instance (applicable to xwayland windows only)
+
+ *%shell*
+ The protocol the window is using (typically xwayland or xdg_shell)
+
+ *%sandbox_engine*
+ The associated sandbox engine
+
+ *%sandbox_app_id*
+ The app ID provided by the associated sandbox engine
+
+ *%sandbox_instance_id*
+ The instance ID provided by the associated sandbox engine
This command is typically used with *for_window* criteria. For example:
diff --git a/sway/tree/container.c b/sway/tree/container.c
@@ -716,6 +716,15 @@ size_t parse_title_format(struct sway_container *container, char *buffer) {
} else if (has_prefix(next, "%shell")) {
len += append_prop(buffer, view_get_shell(container->view));
format += strlen("%shell");
+ } else if (has_prefix(next, "%sandbox_engine")) {
+ len += append_prop(buffer, view_get_sandbox_engine(container->view));
+ format += strlen("%sandbox_engine");
+ } else if (has_prefix(next, "%sandbox_app_id")) {
+ len += append_prop(buffer, view_get_sandbox_app_id(container->view));
+ format += strlen("%sandbox_app_id");
+ } else if (has_prefix(next, "%sandbox_instance_id")) {
+ len += append_prop(buffer, view_get_sandbox_instance_id(container->view));
+ format += strlen("%sandbox_instance_id");
} else {
lenient_strcat(buffer, "%");
++format;