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]] [[package]]
name = "swayr" name = "swayr"
version = "0.10.0-beta.6" version = "0.10.0"
dependencies = [ dependencies = [
"clap", "clap",
"directories", "directories",

@ -1,6 +1,6 @@
[package] [package]
name = "swayr" name = "swayr"
version = "0.10.0-beta.6" version = "0.10.0"
description = "A LRU window-switcher (and more) for the sway window manager" description = "A LRU window-switcher (and more) for the sway window manager"
homepage = "https://sr.ht/~tsdh/swayr/" homepage = "https://sr.ht/~tsdh/swayr/"
repository = "https://git.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 - 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 been replaced by `tree` which achieves the same job but is not restricted to
only handle workspaces, and windows. only handle workspaces and windows.
- Formats such as `format.workspace_format`, and `format.window_format` can now - There's a new `format.container_format` for formatting the line showing a
include a `{indent}` placeholder which will be replaced with N times the new container.
`format.indent` value. N is the depth in the shown menu input, e.g., with - Formats such as `format.workspace_format`, `format.container_format`, and
`swayr switch-workspace-or-window` the indent level for workspaces is 0, and `format.window_format` can now include a `{indent}` placeholder which will be
1 for windows. replaced with N times the new `format.indent` value. N is the depth in the
- The `format.workspace_format` may now include a `{layout}` placeholder which shown menu input, e.g., with `swayr switch-workspace-or-window` the indent
is replaced with the current container's layout. 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, - New command: `switch-workspace-container-or-window` shows workspaces,
containers, and their windows in the menu program and switches to the containers, and their windows in the menu program and switches to the
selected one. selected one.
@ -27,7 +29,7 @@ swayr v0.10.0
swayr v0.9.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 show empty workspaces which makes it possible to switch to another output
currently showing an empty workspace. currently showing an empty workspace.
- All menu switching commands (`switch-window`, `switch-workspace`, and - 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 to force a non-match), a shortcut followed by a colon, and some string as
required by the shortcut. The following shortcuts are supported. required by the shortcut. The following shortcuts are supported.
- `w:<workspace>`: Switches to a possibly non-existing workspace. - `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 `<digit>:<name>` format is explained in `man 5 sway`. If that format is
given, `swayr` will create the workspace using `workspace number given, `swayr` will create the workspace using `workspace number
<digit>:<name>`. If just a digit or name is given, the `number` argument <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`. and `prev-window-of-same-layout`.
- **Incompatible change**: All `next/prev-window` commands (including the new - **Incompatible change**: All `next/prev-window` commands (including the new
ones above) now have a mandatory subcommand determining if all or only the 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`. `current-workspace`.
- Bugfix: `prev-window` has never worked correctly. Instead of cycling through - Bugfix: `prev-window` has never worked correctly. Instead of cycling through
all windows in last-recently-used order, it switched between the current and 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. selected one.
* `switch-workspace-or-window` displays all workspaces and their windows and * `switch-workspace-or-window` displays all workspaces and their windows and
switches to the selected workspace or window. 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-window` displays all windows and quits the selected one.
* `quit-workspace-or-window` displays all workspaces and their windows and * `quit-workspace-or-window` displays all workspaces and their windows and
allows to quit either the selected workspace (all its windows) or the allows to quit either the selected workspace (all its windows) or the
selected window. 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 * `move-focused-to-workspace` moves the currently focused window or container
to another workspace selected with the menu program. Non-matching input of 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 the form `#w:<workspace>` where the hash and `w:` shortcut are optional can
be used to move it to a new workspace. 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 * `next-window (all-workspaces|current-workspace)` & `prev-window
(all-workspaces|current-workspace)` focus the next/previous window in (all-workspaces|current-workspace)` focus the next/previous window in
depth-first iteration order of the tree. The argument `all-workspaces` or 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-window-of-same-layout` & `prev-window-of-same-layout` is like
`next-floating-window` / `prev-floating-window` if the current window is `next-floating-window` / `prev-floating-window` if the current window is
floating, it is like `next-tabbed-or-stacked-window` / 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 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` / the current windows is in a tiled container, and is like `next-window` /
`prev-window` otherwise. `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 force a non-match), a shortcut followed by a colon, and some string as required
by the shortcut. The following shortcuts are supported. by the shortcut. The following shortcuts are supported.
- `w:<workspace>`: Switches to a possibly non-existing workspace. - `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 `<digit>:<name>` format is explained in `man 5 sway`. If that format is
given, `swayr` will create the workspace using `workspace number given, `swayr` will create the workspace using `workspace number
<digit>:<name>`. If just a digit or name is given, the `number` argument is <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), [bemenu](https://github.com/Cloudef/bemenu),
[rofi](https://github.com/davatorium/rofi), a script spawning a terminal with [rofi](https://github.com/davatorium/rofi), a script spawning a terminal with
[fzf](https://github.com/junegunn/fzf), or whatever. The only requirement is [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. and spit out the selected item to stdout.
The default config looks like this: The default config looks like this:
@ -217,22 +227,26 @@ args = [
'--insensitive', '--insensitive',
'--cache-file=/dev/null', '--cache-file=/dev/null',
'--parse-search', '--parse-search',
'--height=40%',
'--prompt={prompt}', '--prompt={prompt}',
] ]
[format] [format]
window_format = '{urgency_start}<b>“{title}”</b>{urgency_end} — <i>{app_name}</i> on workspace {workspace_name} <span alpha="20000">({id})</span>' 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 = '<b>Workspace {name}</b> <span alpha="20000">({id})</span>' workspace_format = '{indent}<b>Workspace {name} [{layout}]</b> <span alpha="20000">({id})</span>'
html_escape = true 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_start = '<span background="darkred" foreground="yellow">'
urgency_end = '</span>' urgency_end = '</span>'
html_escape = true
icon_dirs = [ icon_dirs = [
'/usr/share/icons/hicolor/scalable/apps', '/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/hicolor/48x48/apps',
'/usr/share/icons/Adwaita/64x64/apps',
'/usr/share/icons/Adwaita/48x48/apps',
'/usr/share/pixmaps', '/usr/share/pixmaps',
] ]
fallback_icon = '/usr/share/pixmaps/archlinux-logo.png'
[layout] [layout]
auto_tile = false auto_tile = false
@ -254,9 +268,9 @@ In the following, all sections are explained.
### The menu section ### The menu section
In the `[menu]` section, you can specify the menu program using the 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 `executable` name or full path and the `args` (flags and options) it should get
get passed. If some argument contains the placeholder `{prompt}`, it is passed. If some argument contains the placeholder `{prompt}`, it is replaced
replaced with a prompt such as "Switch to window" depending on context. with a prompt such as "Switch to window" depending on context.
### The format section ### 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 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 to style the text using HTML and CSS. The following formats are supported
right now. right now.
* `window_format` defines how windows are displayed. The placeholder `{title}` * `workspace_format` defines how workspaces are displayed, `container_format`
is replaced with the window's title, `{app_name}` with the application name, defines how non-workspace containers are displayed, and `window_format`
`{marks}` with a comma-separated list of the window's marks, `{app_icon}` defines how application windows are displayed.
with the application's icon (a path to a PNG or SVG file), `{workspace_name}` * In these formats, the following placeholders can be used:
with the name or number of the workspace the window is shown, and `{id}` is * `{name}` gets replaced by the workspace number, or name or a window's
the window's sway-internal con id. There are also the placeholders title. The placeholder `{title}` is an obsolete synonym which will be
`{urcency_start}` and `{urgency_end}` which get replaced by the empty string removed in a later version.
if the window has no urgency flag, and with the values of the same-named * `{layout}` shows the workspace or container's layout.
formats if the window has the urgency flag set. That makes it possible to * `{id}` gets replaced by the sway-internal con id.
highlight urgent windows as shown in the default config. * `{indent}` gets replaced with N times the new `format.indent` value where N
* `workspace_format` defines how workspaces are displayed. There are the is the depth in the shown menu input.
placeholders `{name}` which gets replaced by the workspace's number or name, * `{app_name}` gets replaced with a window's application name.
and `{id}` which gets replaced by the sway-internal con id of the workspace. * `{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 * `html_escape` defines if the strings replacing the placeholders above (except
for `{urgency_start}` and `{urgency_end}`) should be HTML-escaped. for `{urgency_start}` and `{urgency_end}`) should be HTML-escaped.
* `urgency_start` is a string which replaces the `{urgency_start}` placeholder * `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) 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
recommended to include the `{id}` placeholder at least in `window_format`. recommended to include the `{id}` placeholder at least in `container_format`
Otherwise, e.g., two terminals (of the same terminal app) with the same working 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. directory (and therefore, the same title) wouldn't be distinguishable.
**Hint for wofi**: `wofi` supports icons with the syntax **Hint for wofi**: `wofi` supports icons with the syntax

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

Loading…
Cancel
Save