Release v0.10.0

timeout_old
Tassilo Horn 3 years ago
parent b19a5ed84f
commit 251410e0ff
  1. 2
      Cargo.lock
  2. 2
      Cargo.toml
  3. 24
      NEWS.md
  4. 77
      README.md
  5. 8
      src/tree.rs

2
Cargo.lock generated

@ -360,7 +360,7 @@ dependencies = [
[[package]]
name = "swayr"
version = "0.10.0-beta.6"
version = "0.10.0"
dependencies = [
"clap",
"directories",

@ -1,6 +1,6 @@
[package]
name = "swayr"
version = "0.10.0-beta.6"
version = "0.10.0"
description = "A LRU window-switcher (and more) for the sway window manager"
homepage = "https://sr.ht/~tsdh/swayr/"
repository = "https://git.sr.ht/~tsdh/swayr"

@ -3,14 +3,16 @@ swayr v0.10.0
- The `con` module which enhances the sway IPC container tree structure has
been replaced by `tree` which achieves the same job but is not restricted to
only handle workspaces, and windows.
- Formats such as `format.workspace_format`, and `format.window_format` can now
include a `{indent}` placeholder which will be replaced with N times the new
`format.indent` value. N is the depth in the shown menu input, e.g., with
`swayr switch-workspace-or-window` the indent level for workspaces is 0, and
1 for windows.
- The `format.workspace_format` may now include a `{layout}` placeholder which
is replaced with the current container's layout.
only handle workspaces and windows.
- There's a new `format.container_format` for formatting the line showing a
container.
- Formats such as `format.workspace_format`, `format.container_format`, and
`format.window_format` can now include a `{indent}` placeholder which will be
replaced with N times the new `format.indent` value. N is the depth in the
shown menu input, e.g., with `swayr switch-workspace-or-window` the indent
level for workspaces is 0 and 1 for windows.
- The `format.workspace_format` and `format.container_format` may include a
`{layout}` placeholder which is replaced with the container's layout.
- New command: `switch-workspace-container-or-window` shows workspaces,
containers, and their windows in the menu program and switches to the
selected one.
@ -27,7 +29,7 @@ swayr v0.10.0
swayr v0.9.0
============
- The commands `switch-workspace`, and `switch-workspace-or-window` now also
- The commands `switch-workspace` and `switch-workspace-or-window` now also
show empty workspaces which makes it possible to switch to another output
currently showing an empty workspace.
- All menu switching commands (`switch-window`, `switch-workspace`, and
@ -36,7 +38,7 @@ swayr v0.9.0
to force a non-match), a shortcut followed by a colon, and some string as
required by the shortcut. The following shortcuts are supported.
- `w:<workspace>`: Switches to a possibly non-existing workspace.
`<workspace>` must be a digit, a name, or `<digit>:<name>`. The
`<workspace>` must be a digit, a name or `<digit>:<name>`. The
`<digit>:<name>` format is explained in `man 5 sway`. If that format is
given, `swayr` will create the workspace using `workspace number
<digit>:<name>`. If just a digit or name is given, the `number` argument
@ -64,7 +66,7 @@ swayr v0.8.0
and `prev-window-of-same-layout`.
- **Incompatible change**: All `next/prev-window` commands (including the new
ones above) now have a mandatory subcommand determining if all or only the
current workspace's windows should be considered: `all-workspaces`, or
current workspace's windows should be considered: `all-workspaces` or
`current-workspace`.
- Bugfix: `prev-window` has never worked correctly. Instead of cycling through
all windows in last-recently-used order, it switched between the current and

@ -20,14 +20,24 @@ Right now, there are these subcommands:
selected one.
* `switch-workspace-or-window` displays all workspaces and their windows and
switches to the selected workspace or window.
* `switch-workspace-container-or-window` shows workspaces, containers, and
their windows in the menu program and switches to the selected one.
* `quit-window` displays all windows and quits the selected one.
* `quit-workspace-or-window` displays all workspaces and their windows and
allows to quit either the selected workspace (all its windows) or the
selected window.
* `quit-workspace-container-or-window` shows workspaces, containers, and their
windows and quits all windows of the selected workspace/container or the
selected window.
* `move-focused-to-workspace` moves the currently focused window or container
to another workspace selected with the menu program. Non-matching input of
the form `#w:<workspace>` where the hash and `w:` shortcut are optional can
be used to move it to a new workspace.
* `move-focused-to` moves the currently focused container or window to the
selected workspace, container, or window. Non-matching input is handled like
with `move-focused-to-workspace`.
* `swap-focused-with` swaps the currently focused window or container with the
one selected from the menu program.
* `next-window (all-workspaces|current-workspace)` & `prev-window
(all-workspaces|current-workspace)` focus the next/previous window in
depth-first iteration order of the tree. The argument `all-workspaces` or
@ -43,7 +53,7 @@ Right now, there are these subcommands:
* `next-window-of-same-layout` & `prev-window-of-same-layout` is like
`next-floating-window` / `prev-floating-window` if the current window is
floating, it is like `next-tabbed-or-stacked-window` /
`prev-tabbed-or-stacked-window` if the current window is in a tabbed, or
`prev-tabbed-or-stacked-window` if the current window is in a tabbed or
stacked container, it is like `next-tiled-window` / `prev-tiled-window` if
the current windows is in a tiled container, and is like `next-window` /
`prev-window` otherwise.
@ -86,7 +96,7 @@ nothing. The input should start with any number of `#` (in order to be able to
force a non-match), a shortcut followed by a colon, and some string as required
by the shortcut. The following shortcuts are supported.
- `w:<workspace>`: Switches to a possibly non-existing workspace.
`<workspace>` must be a digit, a name, or `<digit>:<name>`. The
`<workspace>` must be a digit, a name or `<digit>:<name>`. The
`<digit>:<name>` format is explained in `man 5 sway`. If that format is
given, `swayr` will create the workspace using `workspace number
<digit>:<name>`. If just a digit or name is given, the `number` argument is
@ -202,7 +212,7 @@ programs such as [dmenu](https://tools.suckless.org/dmenu/),
[bemenu](https://github.com/Cloudef/bemenu),
[rofi](https://github.com/davatorium/rofi), a script spawning a terminal with
[fzf](https://github.com/junegunn/fzf), or whatever. The only requirement is
that the launcher needs to be able to read the items to choose from from stdin,
that the launcher needs to be able to read the items to choose from from stdin
and spit out the selected item to stdout.
The default config looks like this:
@ -217,22 +227,26 @@ args = [
'--insensitive',
'--cache-file=/dev/null',
'--parse-search',
'--height=40%',
'--prompt={prompt}',
]
[format]
window_format = '{urgency_start}<b>“{title}”</b>{urgency_end} — <i>{app_name}</i> on workspace {workspace_name} <span alpha="20000">({id})</span>'
workspace_format = '<b>Workspace {name}</b> <span alpha="20000">({id})</span>'
html_escape = true
window_format = 'img:{app_icon}:text:{indent}<i>{app_name}</i> — {urgency_start}<b>“{title}”</b>{urgency_end} on workspace {workspace_name} <i>{marks}</i> <span alpha="20000">({id})</span>'
workspace_format = '{indent}<b>Workspace {name} [{layout}]</b> <span alpha="20000">({id})</span>'
container_format = '{indent}<b>Container [{layout}]</b> on workspace {workspace_name} <i>{marks}</i> <span alpha="20000">({id})</span>'
indent = ' '
urgency_start = '<span background="darkred" foreground="yellow">'
urgency_end = '</span>'
html_escape = true
icon_dirs = [
'/usr/share/icons/hicolor/scalable/apps',
'/usr/share/icons/Adwaita/48x48/apps',
'/usr/share/icons/hicolor/64x64/apps',
'/usr/share/icons/hicolor/48x48/apps',
'/usr/share/icons/Adwaita/64x64/apps',
'/usr/share/icons/Adwaita/48x48/apps',
'/usr/share/pixmaps',
]
fallback_icon = '/usr/share/pixmaps/archlinux-logo.png'
[layout]
auto_tile = false
@ -254,9 +268,9 @@ In the following, all sections are explained.
### The menu section
In the `[menu]` section, you can specify the menu program using the
`executable` name or full path, and the `args` (flags and options) it should
get passed. If some argument contains the placeholder `{prompt}`, it is
replaced with a prompt such as "Switch to window" depending on context.
`executable` name or full path and the `args` (flags and options) it should get
passed. If some argument contains the placeholder `{prompt}`, it is replaced
with a prompt such as "Switch to window" depending on context.
### The format section
@ -265,19 +279,29 @@ choices are to be layed out. `wofi` supports [pango
markup](https://docs.gtk.org/Pango/pango_markup.html) which makes it possible
to style the text using HTML and CSS. The following formats are supported
right now.
* `window_format` defines how windows are displayed. The placeholder `{title}`
is replaced with the window's title, `{app_name}` with the application name,
`{marks}` with a comma-separated list of the window's marks, `{app_icon}`
with the application's icon (a path to a PNG or SVG file), `{workspace_name}`
with the name or number of the workspace the window is shown, and `{id}` is
the window's sway-internal con id. There are also the placeholders
`{urcency_start}` and `{urgency_end}` which get replaced by the empty string
if the window has no urgency flag, and with the values of the same-named
formats if the window has the urgency flag set. That makes it possible to
highlight urgent windows as shown in the default config.
* `workspace_format` defines how workspaces are displayed. There are the
placeholders `{name}` which gets replaced by the workspace's number or name,
and `{id}` which gets replaced by the sway-internal con id of the workspace.
* `workspace_format` defines how workspaces are displayed, `container_format`
defines how non-workspace containers are displayed, and `window_format`
defines how application windows are displayed.
* In these formats, the following placeholders can be used:
* `{name}` gets replaced by the workspace number, or name or a window's
title. The placeholder `{title}` is an obsolete synonym which will be
removed in a later version.
* `{layout}` shows the workspace or container's layout.
* `{id}` gets replaced by the sway-internal con id.
* `{indent}` gets replaced with N times the new `format.indent` value where N
is the depth in the shown menu input.
* `{app_name}` gets replaced with a window's application name.
* `{marks}` shows a comma-separated list of the container's or window's
marks.
* `{app_icon}` shows the application's icon (a path to a PNG or SVG file).
* `{workspace_name}` gets replaced with the name or number of the workspace
the container or window belongs to.
* The placeholders `{urcency_start}` and `{urgency_end}` get replaced by the
empty string if the window has no urgency flag and with the values of the
same-named formats if the window has the urgency flag set. That makes it
possible to highlight urgent windows as shown in the default config.
* `indent` is a string which is repeatedly inserted at the `{indent}`
placeholder in formats.
* `html_escape` defines if the strings replacing the placeholders above (except
for `{urgency_start}` and `{urgency_end}`) should be HTML-escaped.
* `urgency_start` is a string which replaces the `{urgency_start}` placeholder
@ -291,8 +315,9 @@ right now.
It is crucial that during selection (using wofi or some other menu program)
each window has a different display string. Therefore, it is highly
recommended to include the `{id}` placeholder at least in `window_format`.
Otherwise, e.g., two terminals (of the same terminal app) with the same working
recommended to include the `{id}` placeholder at least in `container_format`
and `window_format`. Otherwise, e.g., two vertical splits on the same
workspace or two terminals (of the same terminal app) with the same working
directory (and therefore, the same title) wouldn't be distinguishable.
**Hint for wofi**: `wofi` supports icons with the syntax

@ -470,10 +470,6 @@ impl DisplayFormat for DisplayNode<'_> {
"{app_name}",
&maybe_html_escape(html_escape, self.node.get_app_name()),
)
.replace(
"{name}",
&maybe_html_escape(html_escape, self.node.get_name()),
)
.replace(
"{workspace_name}",
&maybe_html_escape(
@ -513,6 +509,10 @@ impl DisplayFormat for DisplayNode<'_> {
"{title}",
&maybe_html_escape(html_escape, self.node.get_name()),
)
.replace(
"{name}",
&maybe_html_escape(html_escape, self.node.get_name()),
)
}
fn get_indent_level(&self) -> usize {

Loading…
Cancel
Save