Revert back accidentally removed {layout} placeholder

...and also rewrite the first sentence in the related paragraph in
README and NEWS - there are more placeholders that support formatting
than those that do not.  It would have been clear from the diff if
these files weren't wrapped...

I accidentally removed it in commit
cae756bab8.
timeout_old
Jakub Jirutka 2 years ago
parent b2913f2b9e
commit 3a81295859
  1. 8
      NEWS.md
  2. 22
      README.md
  3. 1
      src/tree.rs

@ -1,10 +1,10 @@
swayr v0.13.0 swayr v0.13.0
============= =============
- The placeholders `{id}`, `{app_name}`, `{name}`/`{title}`, `{output_name}`, - All the placeholders except `{app_icon}`, `{indent}`, `{urgency_start}`, and
`{workspace_name}`, and `{marks}` may optionally provide a format string as `{urgency_end}` may optionally provide a format string as specified by
specified by [Rust's std::fmt](https://doc.rust-lang.org/std/fmt/). The [Rust's std::fmt](https://doc.rust-lang.org/std/fmt/). The syntax is
syntax is `{<placeholder>:<fmt_str><clipped_str>}`. For example, `{<placeholder>:<fmt_str><clipped_str>}`. For example,
`{app_name:{:>10.10}}` would mean that the application name is printed with `{app_name:{:>10.10}}` would mean that the application name is printed with
exactly 10 characters. If it's shorter, it will be right-aligned (the `>`) exactly 10 characters. If it's shorter, it will be right-aligned (the `>`)
and padded with spaces, if it's longer, it'll be cut after the 10th and padded with spaces, if it's longer, it'll be cut after the 10th

@ -324,17 +324,17 @@ right now.
* `fallback_icon` is a path to some PNG/SVG icon which will be used as * `fallback_icon` is a path to some PNG/SVG icon which will be used as
`{app_icon}` if no application-specific icon can be determined. `{app_icon}` if no application-specific icon can be determined.
The placeholders `{id}`, `{app_name}`, `{name}`/`{title}`, `{output_name}`, All the placeholders except `{app_icon}`, `{indent}`, `{urgency_start}`, and
`{workspace_name}`, and `{marks}` may optionally provide a format string as `{urgency_end}` may optionally provide a format string as specified by
specified by [Rust's std::fmt](https://doc.rust-lang.org/std/fmt/). The syntax [Rust's std::fmt](https://doc.rust-lang.org/std/fmt/). The syntax is
is `{<placeholder>:<fmt_str><clipped_str>}`. For example, `{<placeholder>:<fmt_str><clipped_str>}`. For example, `{app_name:{:>10.10}}`
`{app_name:{:>10.10}}` would mean that the application name is printed with would mean that the application name is printed with exactly 10 characters. If
exactly 10 characters. If it's shorter, it will be right-aligned (the `>`) and it's shorter, it will be right-aligned (the `>`) and padded with spaces, if
padded with spaces, if it's longer, it'll be cut after the 10th character. it's longer, it'll be cut after the 10th character. Another example,
Another example, `{app_name:{:.10}...}` would mean that the application name is `{app_name:{:.10}...}` would mean that the application name is truncated at 10
truncated at 10 characters. If it's shorter, it will be printed as-is (no characters. If it's shorter, it will be printed as-is (no padding), if it's
padding), if it's longer, it'll be cut after the 10th character and the last longer, it'll be cut after the 10th character and the last 3 characters of that
3 characters of that substring will be replaced with `...` (`<clipped_str>`). substring will be replaced with `...` (`<clipped_str>`).
It is crucial that during selection (using wofi or some other menu program) It is crucial that during selection (using wofi or some other menu program)
each window has a different display string. Therefore, it is highly each window has a different display string. Therefore, it is highly

@ -516,6 +516,7 @@ impl DisplayFormat for DisplayNode<'_> {
let value = match &caps["name"] { let value = match &caps["name"] {
"id" => self.node.id.to_string(), "id" => self.node.id.to_string(),
"app_name" => self.node.get_app_name().to_string(), "app_name" => self.node.get_app_name().to_string(),
"layout" => format!("{:?}", self.node.layout),
"name" | "title" => self.node.get_name().to_string(), "name" | "title" => self.node.get_name().to_string(),
"output_name" => self "output_name" => self
.tree .tree

Loading…
Cancel
Save