From 9da99893c4696290e24623efb71d24568625e7bb Mon Sep 17 00:00:00 2001 From: Skia Date: Thu, 16 Nov 2023 15:26:50 +0100 Subject: [PATCH] Improve documentation and default config --- Cargo.toml | 2 +- README.md | 182 ++++++++++++++++++++-------------------------------- src/main.rs | 4 +- 3 files changed, 75 insertions(+), 113 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0b89ba6..6154b0c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "swaysome" version = "2.0.0" authors = ["Skia ", "Nabos "] edition = "2021" -description = "swaysome provides a different way to manage your multiple outputs with the sway windows manager" +description = "swaysome provides an awesome way to manage your multiple outputs with the sway windows manager" license = "MIT" repository = "https://gitlab.com/hyask/swaysome" homepage = "https://gitlab.com/hyask/swaysome" diff --git a/README.md b/README.md index f9a221d..cc0d77b 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,50 @@ # Swaysome +An awesome way to manage your workspaces on [sway](https://swaywm.org/). + + ## Description -This binary helps you configure sway to work a bit more like [AwesomeWM](https://awesomewm.org/). This currently means -workspaces that are name-spaced on a per-screen basis. -example: with workspace `11` on the first screen, and workspace `21` on the second screen, typing the `swaysome` -shortcut to get workspace `1` would lead you to workspace `11` if your focus is on the first screen, and workspace `21` +This binary helps you configure sway to work a bit more like [AwesomeWM](https://awesomewm.org/). This means that +**workspaces** are namespaced in what are called **workspace groups**, and **workspace groups** can be moved around the +differents outputs easily. + +For example, with workspace `11` on the first output, and workspace `21` on the second output, triggering the `swaysome focus 1` +shortcut to get workspace `1` would lead you to workspace `11` if your focus is on the first output, and workspace `21` is the focus is on the second one. -`swaysome` also supports what we call "workspace groups". These are groups of workspaces sharing the same tens number -and tied to an output. -By default, `swaysome init` will create a workspace group per active output, but you may create other groups while working. +By default, `swaysome init` will create a **workspace group** per active output, but you may create other groups while +working, by either triggering `swaysome focus-group ` and opening a new window, or sending an existing +window to it first with `swaysome move-to-group `. Here is a common use-case for this: * `output-1`: - * workspace group 1: + * **workspace group** 1: * workspace `11`: chats * workspace `12`: emails * `output-2`: - * workspace group 2: + * **workspace group** 2: * workspace `21`: IDE for first project * workspace `22`: browser for first project * workspace `23`: terminals for first project - * workspace group 3: + * **workspace group** 3: * workspace `31`: IDE for second project * workspace `32`: browser for second project * workspace `33`: terminals for second project -That way, when `output-2` is focused on workspace group 2, be it workspace `21` or `22`, the quick `$mod+` -shortcut won't leave workspace group 2, allowing you to open multiple projects in parallel without the hassle of -manually remembering how to namespace them. +That way, when `output-2` is focused on **workspace group** 2, be it workspace `21` or `22`, the quick `$mod+` +(bound to `swaysome focus `) shortcut won't leave **workspace group** 2, allowing you to open multiple projects +in parallel without the hassle of manually remembering how to namespace them. + +In that situation, suppose you plug in a new output, `output-3`, you may then want to focus **workspace group 3** +to send it to `output-3`: this is simply done by typing the shortcuts `$mod+Alt+3` (`swaysome focus-group 3`) then +`$mod+Alt+o` (`swaysome workspace-group-next-output`). `swaysome` may also work with i3, but this is untested. -`swaysome` should be compatible with [sworkstyle](https://lib.rs/crates/sworkstyle). +`swaysome` should be compatible with [sworkstyle](https://lib.rs/crates/sworkstyle). If this is broken, please report a bug. ## Installation @@ -59,106 +68,67 @@ to check that everything works before fixing your `$PATH` issue. ## Usage Then create the file (and the directory if needed) `~/.config/sway/config.d/swaysome.conf` and paste this inside: -> Use (un)bindcode or (un)bindsym, depending on what you used in your main sway config file. +> Use (un)bindcode or (un)bindsym, depending on what you used in your main sway config file. +> The `--no-warn` setting is only added to shortcuts that exist in the default config. You may want to add or remove +> that flag on some bindings depending on your config. ``` # Change focus between workspaces -unbindcode $mod+1 -unbindcode $mod+2 -unbindcode $mod+3 -unbindcode $mod+4 -unbindcode $mod+5 -unbindcode $mod+6 -unbindcode $mod+7 -unbindcode $mod+8 -unbindcode $mod+9 -unbindcode $mod+0 -bindcode $mod+1 exec "swaysome focus 1" -bindcode $mod+2 exec "swaysome focus 2" -bindcode $mod+3 exec "swaysome focus 3" -bindcode $mod+4 exec "swaysome focus 4" -bindcode $mod+5 exec "swaysome focus 5" -bindcode $mod+6 exec "swaysome focus 6" -bindcode $mod+7 exec "swaysome focus 7" -bindcode $mod+8 exec "swaysome focus 8" -bindcode $mod+9 exec "swaysome focus 9" -bindcode $mod+0 exec "swaysome focus 0" +bindsym --no-warn $mod+1 exec "swaysome focus 1" +bindsym --no-warn $mod+2 exec "swaysome focus 2" +bindsym --no-warn $mod+3 exec "swaysome focus 3" +bindsym --no-warn $mod+4 exec "swaysome focus 4" +bindsym --no-warn $mod+5 exec "swaysome focus 5" +bindsym --no-warn $mod+6 exec "swaysome focus 6" +bindsym --no-warn $mod+7 exec "swaysome focus 7" +bindsym --no-warn $mod+8 exec "swaysome focus 8" +bindsym --no-warn $mod+9 exec "swaysome focus 9" +bindsym --no-warn $mod+0 exec "swaysome focus 0" # Move containers between workspaces -unbindcode $mod+Shift+1 -unbindcode $mod+Shift+2 -unbindcode $mod+Shift+3 -unbindcode $mod+Shift+4 -unbindcode $mod+Shift+5 -unbindcode $mod+Shift+6 -unbindcode $mod+Shift+7 -unbindcode $mod+Shift+8 -unbindcode $mod+Shift+9 -unbindcode $mod+Shift+0 -bindcode $mod+Shift+1 exec "swaysome move 1" -bindcode $mod+Shift+2 exec "swaysome move 2" -bindcode $mod+Shift+3 exec "swaysome move 3" -bindcode $mod+Shift+4 exec "swaysome move 4" -bindcode $mod+Shift+5 exec "swaysome move 5" -bindcode $mod+Shift+6 exec "swaysome move 6" -bindcode $mod+Shift+7 exec "swaysome move 7" -bindcode $mod+Shift+8 exec "swaysome move 8" -bindcode $mod+Shift+9 exec "swaysome move 9" -bindcode $mod+Shift+0 exec "swaysome move 0" +bindsym --no-warn $mod+Shift+1 exec "swaysome move 1" +bindsym --no-warn $mod+Shift+2 exec "swaysome move 2" +bindsym --no-warn $mod+Shift+3 exec "swaysome move 3" +bindsym --no-warn $mod+Shift+4 exec "swaysome move 4" +bindsym --no-warn $mod+Shift+5 exec "swaysome move 5" +bindsym --no-warn $mod+Shift+6 exec "swaysome move 6" +bindsym --no-warn $mod+Shift+7 exec "swaysome move 7" +bindsym --no-warn $mod+Shift+8 exec "swaysome move 8" +bindsym --no-warn $mod+Shift+9 exec "swaysome move 9" +bindsym --no-warn $mod+Shift+0 exec "swaysome move 0" # Focus workspace groups -unbindcode $mod+Ctrl+1 -unbindcode $mod+Ctrl+2 -unbindcode $mod+Ctrl+3 -unbindcode $mod+Ctrl+4 -unbindcode $mod+Ctrl+5 -unbindcode $mod+Ctrl+6 -unbindcode $mod+Ctrl+7 -unbindcode $mod+Ctrl+8 -unbindcode $mod+Ctrl+9 -unbindcode $mod+Ctrl+0 -bindcode $mod+Ctrl+1 exec "swaysome focus-group 1" -bindcode $mod+Ctrl+2 exec "swaysome focus-group 2" -bindcode $mod+Ctrl+3 exec "swaysome focus-group 3" -bindcode $mod+Ctrl+4 exec "swaysome focus-group 4" -bindcode $mod+Ctrl+5 exec "swaysome focus-group 5" -bindcode $mod+Ctrl+6 exec "swaysome focus-group 6" -bindcode $mod+Ctrl+7 exec "swaysome focus-group 7" -bindcode $mod+Ctrl+8 exec "swaysome focus-group 8" -bindcode $mod+Ctrl+9 exec "swaysome focus-group 9" -bindcode $mod+Ctrl+0 exec "swaysome focus-group 0" +bindsym $mod+Alt+1 exec "swaysome focus-group 1" +bindsym $mod+Alt+2 exec "swaysome focus-group 2" +bindsym $mod+Alt+3 exec "swaysome focus-group 3" +bindsym $mod+Alt+4 exec "swaysome focus-group 4" +bindsym $mod+Alt+5 exec "swaysome focus-group 5" +bindsym $mod+Alt+6 exec "swaysome focus-group 6" +bindsym $mod+Alt+7 exec "swaysome focus-group 7" +bindsym $mod+Alt+8 exec "swaysome focus-group 8" +bindsym $mod+Alt+9 exec "swaysome focus-group 9" +bindsym $mod+Alt+0 exec "swaysome focus-group 0" # Move containers to other workspace groups -unbindcode $mod+Ctrl+Shift+1 -unbindcode $mod+Ctrl+Shift+2 -unbindcode $mod+Ctrl+Shift+3 -unbindcode $mod+Ctrl+Shift+4 -unbindcode $mod+Ctrl+Shift+5 -unbindcode $mod+Ctrl+Shift+6 -unbindcode $mod+Ctrl+Shift+7 -unbindcode $mod+Ctrl+Shift+8 -unbindcode $mod+Ctrl+Shift+9 -unbindcode $mod+Ctrl+Shift+0 -bindcode $mod+Ctrl+Shift+1 exec "swaysome move-to-group 1" -bindcode $mod+Ctrl+Shift+2 exec "swaysome move-to-group 2" -bindcode $mod+Ctrl+Shift+3 exec "swaysome move-to-group 3" -bindcode $mod+Ctrl+Shift+4 exec "swaysome move-to-group 4" -bindcode $mod+Ctrl+Shift+5 exec "swaysome move-to-group 5" -bindcode $mod+Ctrl+Shift+6 exec "swaysome move-to-group 6" -bindcode $mod+Ctrl+Shift+7 exec "swaysome move-to-group 7" -bindcode $mod+Ctrl+Shift+8 exec "swaysome move-to-group 8" -bindcode $mod+Ctrl+Shift+9 exec "swaysome move-to-group 9" -bindcode $mod+Ctrl+Shift+0 exec "swaysome move-to-group 0" +bindsym $mod+Alt+Shift+1 exec "swaysome move-to-group 1" +bindsym $mod+Alt+Shift+2 exec "swaysome move-to-group 2" +bindsym $mod+Alt+Shift+3 exec "swaysome move-to-group 3" +bindsym $mod+Alt+Shift+4 exec "swaysome move-to-group 4" +bindsym $mod+Alt+Shift+5 exec "swaysome move-to-group 5" +bindsym $mod+Alt+Shift+6 exec "swaysome move-to-group 6" +bindsym $mod+Alt+Shift+7 exec "swaysome move-to-group 7" +bindsym $mod+Alt+Shift+8 exec "swaysome move-to-group 8" +bindsym $mod+Alt+Shift+9 exec "swaysome move-to-group 9" +bindsym $mod+Alt+Shift+0 exec "swaysome move-to-group 0" # Move focused container to next output -bindcode $mod+o exec "swaysome next-output" - +bindsym $mod+o exec "swaysome next-output" # Move focused container to previous output -bindcode $mod+Shift+o exec "swaysome prev-output" +bindsym $mod+Shift+o exec "swaysome prev-output" # Move focused workspace group to next output -bindcode $mod+Alt+o exec "swaysome workspace-group-next-output" +bindsym $mod+Alt+o exec "swaysome workspace-group-next-output" # Move focused workspace group to previous output -bindcode $mod+Alt+Shift+o exec "swaysome workspace-group-prev-output" +bindsym $mod+Alt+Shift+o exec "swaysome workspace-group-prev-output" # Init workspaces for every screen exec "swaysome init 1" @@ -180,17 +150,7 @@ as usual. ## Exhaustive swaysome commands list -* `move [name]`: move the focused container to `[name]` on the same group -* `move-to-group [id]`: move the focused container to the same relative workspace on the `[id]` workspace group -* `next-output`: move the focused container to the next output -* `prev-output`: move the focused container to the previous output -* `focus [name]`: change focus to `[name]` on the same group -* `focus-all-outputs [name]`: change all outputs focus to `[name]` -* `focus-group [id]`: change focus to group `[id]` -* `next-group`: change focus to the next workspace group -* `previous-group`: change focus to the previous workspace group -* `init [name]`: cycle all outputs to create a default workspace with name `[name]` -* `rearrange-workspaces` Rearrange already opened workspaces to the correct outputs, useful when plugging or unplugging screens +Just run `swaysome --help` for the most up to date list of command and documentation. ## Breaking changes diff --git a/src/main.rs b/src/main.rs index 4bb5381..0ce2e14 100644 --- a/src/main.rs +++ b/src/main.rs @@ -75,7 +75,9 @@ enum Command { #[clap(about = "Move the focused container to the previous group")] PrevGroup, - #[clap(about = "Rearrange already opened workspaces")] + #[clap( + about = "Rearrange already opened workspaces to the correct outputs, useful when plugging new monitors" + )] RearrangeWorkspaces, }