diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-05 12:36:50 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-05 22:29:37 +1000 |
commit | 228c478e8d11dd14972b237574146fd0d2d6b96c (patch) | |
tree | 819dfc4d6151ebb28d7db5b862d0ac4314d82fc3 /include | |
parent | Merge pull request #1918 from RyanDwyer/title-scissor (diff) | |
download | sway-228c478e8d11dd14972b237574146fd0d2d6b96c.tar.gz sway-228c478e8d11dd14972b237574146fd0d2d6b96c.tar.zst sway-228c478e8d11dd14972b237574146fd0d2d6b96c.zip |
Implement title_format
This implements the title_format command, with a new placeholder %shell
which gets substituted with the view type (xwayland, xdg_shell_v6 or
wl_shell).
Example config:
for_window [title=".*"] title_format %title (class=%class instance=%instance shell=%shell)
Diffstat (limited to 'include')
-rw-r--r-- | include/sway/commands.h | 1 | ||||
-rw-r--r-- | include/sway/tree/container.h | 6 | ||||
-rw-r--r-- | include/sway/tree/view.h | 10 |
3 files changed, 14 insertions, 3 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h index 0732a90a..d39ac56c 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h | |||
@@ -144,6 +144,7 @@ sway_cmd cmd_splitt; | |||
144 | sway_cmd cmd_splitv; | 144 | sway_cmd cmd_splitv; |
145 | sway_cmd cmd_sticky; | 145 | sway_cmd cmd_sticky; |
146 | sway_cmd cmd_swaybg_command; | 146 | sway_cmd cmd_swaybg_command; |
147 | sway_cmd cmd_title_format; | ||
147 | sway_cmd cmd_unmark; | 148 | sway_cmd cmd_unmark; |
148 | sway_cmd cmd_workspace; | 149 | sway_cmd cmd_workspace; |
149 | sway_cmd cmd_ws_auto_back_and_forth; | 150 | sway_cmd cmd_ws_auto_back_and_forth; |
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index b07af72c..61ab7ca1 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -63,7 +63,8 @@ struct sway_container { | |||
63 | */ | 63 | */ |
64 | size_t id; | 64 | size_t id; |
65 | 65 | ||
66 | char *name; | 66 | char *name; // The view's title (unformatted) |
67 | char *formatted_title; // The title displayed in the title bar | ||
67 | 68 | ||
68 | enum sway_container_type type; | 69 | enum sway_container_type type; |
69 | enum sway_container_layout layout; | 70 | enum sway_container_layout layout; |
@@ -204,7 +205,6 @@ void container_update_title_textures(struct sway_container *container); | |||
204 | */ | 205 | */ |
205 | void container_calculate_title_height(struct sway_container *container); | 206 | void container_calculate_title_height(struct sway_container *container); |
206 | 207 | ||
207 | void container_update_title(struct sway_container *container, | 208 | void container_notify_child_title_changed(struct sway_container *container); |
208 | const char *new_title); | ||
209 | 209 | ||
210 | #endif | 210 | #endif |
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 21127ab1..9d4256f7 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -48,6 +48,7 @@ struct sway_view { | |||
48 | 48 | ||
49 | bool is_fullscreen; | 49 | bool is_fullscreen; |
50 | 50 | ||
51 | char *title_format; | ||
51 | enum sway_container_border border; | 52 | enum sway_container_border border; |
52 | int border_thickness; | 53 | int border_thickness; |
53 | 54 | ||
@@ -164,6 +165,8 @@ const char *view_get_class(struct sway_view *view); | |||
164 | 165 | ||
165 | const char *view_get_instance(struct sway_view *view); | 166 | const char *view_get_instance(struct sway_view *view); |
166 | 167 | ||
168 | const char *view_get_type(struct sway_view *view); | ||
169 | |||
167 | void view_configure(struct sway_view *view, double ox, double oy, int width, | 170 | void view_configure(struct sway_view *view, double ox, double oy, int width, |
168 | int height); | 171 | int height); |
169 | 172 | ||
@@ -207,4 +210,11 @@ void view_child_init(struct sway_view_child *child, | |||
207 | 210 | ||
208 | void view_child_destroy(struct sway_view_child *child); | 211 | void view_child_destroy(struct sway_view_child *child); |
209 | 212 | ||
213 | /** | ||
214 | * Re-read the view's title property and update any relevant title bars. | ||
215 | * The force argument makes it recreate the title bars even if the title hasn't | ||
216 | * changed. | ||
217 | */ | ||
218 | void view_update_title(struct sway_view *view, bool force); | ||
219 | |||
210 | #endif | 220 | #endif |