From bc314e72461db20ab7bfd8a4fa4fedf240aa0a5e Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Fri, 29 Oct 2021 21:00:08 +0200 Subject: [PATCH] Rename next/prev-similar-window to next/prev-window-of-same-layout --- NEWS.md | 17 +++++++++++++++++ README.md | 21 +++++++++++++++------ src/cmds.rs | 22 +++++++++++----------- 3 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 NEWS.md diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 0000000..eac408c --- /dev/null +++ b/NEWS.md @@ -0,0 +1,17 @@ +swayr v8.0.0 +============ + +- There's now the possibility to define a system-wide config file + `/etc/xdg/swayr/config.toml`. It is used when no + `~/.config/swayr/config.toml` exists. +- New commands: `next-tiled-window`, `prev-tiled-window`, + `next-tabbed-or-stacked-window`, `prev-tabbed-or-stacked-window`, + `next-floating-window`, `prev-floating-window`, `next-window-of-same-layout`, + 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`. +- Bugfix: `prev-window` has never worked correctly. Instead of cycling through + all windows in last-recently-used order, it switched between the current and + last recently used window. Now it works as expected. diff --git a/README.md b/README.md index 5e7501f..c27d3e9 100644 --- a/README.md +++ b/README.md @@ -36,12 +36,13 @@ Right now, there are these subcommands: a tabbed or stacked container. * `next-floating-window` & `prev-floating-window` do the same as `next-window` & `prev-window` but switch only between floating windows. -* `next-similar-window` & `prev-similar-window` 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 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. +* `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 + 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. * `execute-swaymsg-command` displays most swaymsg which don't require additional input and executes the selected one. That's handy especially for less often used commands not bound to a key. @@ -319,6 +320,14 @@ over IPC. Therefore, auto-tiling is triggered by new-window events, close-events, move-events, floating-events, and also focus-events. The latter are a workaround and wouldn't be required if there were resize-events. +## Version Changes + +Since version 8.0.0, I've started writing a [NEWS](NEWS.md) file listing the +news, and changes to `swayr` commands or configuration options. If something +doesn't seem to work as expected after an update, please consult this file to +check if there has been some (possibly incompatible) change requiring an update +of your config. + ## Questions & Patches For asking questions, sending feedback, or patches, refer to [my public inbox diff --git a/src/cmds.rs b/src/cmds.rs index a55109c..3318413 100644 --- a/src/cmds.rs +++ b/src/cmds.rs @@ -51,12 +51,12 @@ pub enum SwayrCommand { SwitchToUrgentOrLRUWindow, /// Focus the selected window. SwitchWindow, - /// Focus the next window. + /// Focus the next window in LRU order. NextWindow { #[clap(subcommand)] windows: ConsiderWindows, }, - /// Focus the previous window. + /// Focus the previous window in LRU order. PrevWindow { #[clap(subcommand)] windows: ConsiderWindows, @@ -92,12 +92,12 @@ pub enum SwayrCommand { windows: ConsiderWindows, }, /// Focus the next window having the same layout as the current one. - NextSimilarWindow { + NextWindowOfSameLayout { #[clap(subcommand)] windows: ConsiderWindows, }, /// Focus the previous window having the same layout as the current one. - PrevSimilarWindow { + PrevWindowOfSameLayout { #[clap(subcommand)] windows: ConsiderWindows, }, @@ -151,8 +151,8 @@ impl SwayrCommand { | SwayrCommand::PrevTabbedOrStackedWindow { .. } | SwayrCommand::NextFloatingWindow { .. } | SwayrCommand::PrevFloatingWindow { .. } - | SwayrCommand::NextSimilarWindow { .. } - | SwayrCommand::PrevSimilarWindow { .. } + | SwayrCommand::NextWindowOfSameLayout { .. } + | SwayrCommand::PrevWindowOfSameLayout { .. } ) } } @@ -263,15 +263,15 @@ pub fn exec_swayr_cmd(args: ExecSwayrCmdArgs) { Box::new(|w: &con::Window| w.is_floating()), ) } - SwayrCommand::NextSimilarWindow { windows } => { - focus_similar_window_in_direction( + SwayrCommand::NextWindowOfSameLayout { windows } => { + focus_window_of_same_layout_in_direction( Direction::Forward, windows, &*props.read().unwrap(), ) } - SwayrCommand::PrevSimilarWindow { windows } => { - focus_similar_window_in_direction( + SwayrCommand::PrevWindowOfSameLayout { windows } => { + focus_window_of_same_layout_in_direction( Direction::Backward, windows, &*props.read().unwrap(), @@ -464,7 +464,7 @@ pub fn focus_window_in_direction( } } -pub fn focus_similar_window_in_direction( +pub fn focus_window_of_same_layout_in_direction( dir: Direction, consider_wins: &ConsiderWindows, extra_props: &HashMap,