mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-12-01 12:44:10 +01:00
feat(wm): named workspaces and the other workspace commands
Workspace i is KWin's desktop i, and switching and moving by index came with the workspaces. What a user binds keys to besides is the rest of komorebi's workspace commands: going to the next or the previous workspace (or the next empty one), back to the last one, adding and closing workspaces, showing one index on every monitor, and setting the layout or the tiling of a workspace that need not be in front. They are made of the same two operations, showing a workspace and moving a container to one, so KWin keeps doing the showing and the hiding. A workspace gets a name, which focus-named-workspace, named-workspace-layout and named-workspace-tiling find it by on any monitor; focusing a named workspace focuses its monitor too, so focus_monitor comes with it. The name is komorebi's: naming a workspace does not rename KWin's desktop. The query focused-workspace-name answers with the name, or the index of a workspace that has none. The moves to a named workspace, and everything that addresses a monitor, are moves between monitors in the window manager and come with more than one monitor.
This commit is contained in:
1 parent
62e37e44cf
commit
8467b03ac2
33 files changed
+1782
-9
No files matched your search
@@ -0,0 +1,10 @@
|
||||
```text
|
||||
Close the focused workspace (must be empty and unnamed)
|
||||
|
||||
Usage: close-workspace
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,14 @@
|
||||
```text
|
||||
Focus the next empty workspace in the given cycle direction (if one exists)
|
||||
|
||||
Usage: cycle-empty-workspace <CYCLE_DIRECTION>
|
||||
|
||||
Arguments:
|
||||
<CYCLE_DIRECTION>
|
||||
[possible values: previous, next]
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,14 @@
|
||||
```text
|
||||
Move the focused window to the workspace in the given cycle direction
|
||||
|
||||
Usage: cycle-move-to-workspace <CYCLE_DIRECTION>
|
||||
|
||||
Arguments:
|
||||
<CYCLE_DIRECTION>
|
||||
[possible values: previous, next]
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,14 @@
|
||||
```text
|
||||
Send the focused window to the workspace in the given cycle direction
|
||||
|
||||
Usage: cycle-send-to-workspace <CYCLE_DIRECTION>
|
||||
|
||||
Arguments:
|
||||
<CYCLE_DIRECTION>
|
||||
[possible values: previous, next]
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,14 @@
|
||||
```text
|
||||
Focus the workspace in the given cycle direction
|
||||
|
||||
Usage: cycle-workspace <CYCLE_DIRECTION>
|
||||
|
||||
Arguments:
|
||||
<CYCLE_DIRECTION>
|
||||
[possible values: previous, next]
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,17 @@
|
||||
```text
|
||||
Create these many named workspaces for the specified monitor
|
||||
|
||||
Usage: ensure-named-workspaces <MONITOR> [NAMES]...
|
||||
|
||||
Arguments:
|
||||
<MONITOR>
|
||||
Monitor index (zero-indexed)
|
||||
|
||||
[NAMES]...
|
||||
Names of desired workspaces
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,17 @@
|
||||
```text
|
||||
Create at least this many workspaces for the specified monitor
|
||||
|
||||
Usage: ensure-workspaces <MONITOR> <WORKSPACE_COUNT>
|
||||
|
||||
Arguments:
|
||||
<MONITOR>
|
||||
Monitor index (zero-indexed)
|
||||
|
||||
<WORKSPACE_COUNT>
|
||||
Number of desired workspaces
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,10 @@
|
||||
```text
|
||||
Focus the last focused workspace on the focused monitor
|
||||
|
||||
Usage: focus-last-workspace
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,14 @@
|
||||
```text
|
||||
Focus the specified workspace
|
||||
|
||||
Usage: focus-named-workspace <WORKSPACE>
|
||||
|
||||
Arguments:
|
||||
<WORKSPACE>
|
||||
Target workspace name
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,14 @@
|
||||
```text
|
||||
Focus the specified workspace on all monitors
|
||||
|
||||
Usage: focus-workspaces <TARGET>
|
||||
|
||||
Arguments:
|
||||
<TARGET>
|
||||
Target index (zero-indexed)
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,10 @@
|
||||
```text
|
||||
Move the focused window to the last focused monitor workspace
|
||||
|
||||
Usage: move-to-last-workspace
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,26 @@
|
||||
```text
|
||||
Set the layout for the specified workspace
|
||||
|
||||
Usage: named-workspace-layout <WORKSPACE> <VALUE>
|
||||
|
||||
Arguments:
|
||||
<WORKSPACE>
|
||||
Target workspace name
|
||||
|
||||
<VALUE>
|
||||
Possible values:
|
||||
- bsp: BSP Layout
|
||||
- columns: Columns Layout
|
||||
- rows: Rows Layout
|
||||
- vertical-stack: Vertical Stack Layout
|
||||
- horizontal-stack: Horizontal Stack Layout
|
||||
- ultrawide-vertical-stack: Ultrawide Vertical Stack Layout
|
||||
- grid: Grid Layout
|
||||
- right-main-vertical-stack: Right Main Vertical Stack Layout
|
||||
- scrolling: Scrolling Layout
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help (see a summary with '-h')
|
||||
|
||||
```
|
||||
@@ -0,0 +1,17 @@
|
||||
```text
|
||||
Enable or disable window tiling for the specified workspace
|
||||
|
||||
Usage: named-workspace-tiling <WORKSPACE> <VALUE>
|
||||
|
||||
Arguments:
|
||||
<WORKSPACE>
|
||||
Target workspace name
|
||||
|
||||
<VALUE>
|
||||
[possible values: enable, disable]
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,10 @@
|
||||
```text
|
||||
Create and append a new workspace on the focused monitor
|
||||
|
||||
Usage: new-workspace
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
+2
-1
@@ -6,7 +6,8 @@ Usage: query <STATE_QUERY>
|
||||
Arguments:
|
||||
<STATE_QUERY>
|
||||
[possible values: focused-monitor-index, focused-workspace-index, focused-container-index,
|
||||
focused-window-index, focused-workspace-layout, focused-container-kind, version]
|
||||
focused-window-index, focused-workspace-name, focused-workspace-layout,
|
||||
focused-container-kind, version]
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
```text
|
||||
Send the focused window to the last focused monitor workspace
|
||||
|
||||
Usage: send-to-last-workspace
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,29 @@
|
||||
```text
|
||||
Set the layout for the specified workspace
|
||||
|
||||
Usage: workspace-layout <MONITOR> <WORKSPACE> <VALUE>
|
||||
|
||||
Arguments:
|
||||
<MONITOR>
|
||||
Monitor index (zero-indexed)
|
||||
|
||||
<WORKSPACE>
|
||||
Workspace index on the specified monitor (zero-indexed)
|
||||
|
||||
<VALUE>
|
||||
Possible values:
|
||||
- bsp: BSP Layout
|
||||
- columns: Columns Layout
|
||||
- rows: Rows Layout
|
||||
- vertical-stack: Vertical Stack Layout
|
||||
- horizontal-stack: Horizontal Stack Layout
|
||||
- ultrawide-vertical-stack: Ultrawide Vertical Stack Layout
|
||||
- grid: Grid Layout
|
||||
- right-main-vertical-stack: Right Main Vertical Stack Layout
|
||||
- scrolling: Scrolling Layout
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help (see a summary with '-h')
|
||||
|
||||
```
|
||||
@@ -0,0 +1,20 @@
|
||||
```text
|
||||
Set the workspace name for the specified workspace
|
||||
|
||||
Usage: workspace-name <MONITOR> <WORKSPACE> <VALUE>
|
||||
|
||||
Arguments:
|
||||
<MONITOR>
|
||||
Monitor index (zero-indexed)
|
||||
|
||||
<WORKSPACE>
|
||||
Workspace index on the specified monitor (zero-indexed)
|
||||
|
||||
<VALUE>
|
||||
Name of the workspace as a String
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,20 @@
|
||||
```text
|
||||
Enable or disable window tiling for the specified workspace
|
||||
|
||||
Usage: workspace-tiling <MONITOR> <WORKSPACE> <VALUE>
|
||||
|
||||
Arguments:
|
||||
<MONITOR>
|
||||
Monitor index (zero-indexed)
|
||||
|
||||
<WORKSPACE>
|
||||
Workspace index on the specified monitor (zero-indexed)
|
||||
|
||||
<VALUE>
|
||||
[possible values: enable, disable]
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -20,7 +20,8 @@ each part of the daemon that is added has its place here.
|
||||
the panels).
|
||||
- **Workspace**: the containers a monitor shows, in order, and the layout that tiles
|
||||
them. A monitor has a ring of workspaces and shows one of them. Workspace `i` is the
|
||||
compositor's desktop `i` on that monitor.
|
||||
compositor's desktop `i` on that monitor. A workspace can have a name, which the named
|
||||
commands find it by.
|
||||
- **Desktop**: one of KWin's virtual desktops. KWin shows the windows of one desktop on each
|
||||
output and hides the others; with its per-output virtual desktops on, each output shows a
|
||||
desktop of its own.
|
||||
@@ -421,6 +422,22 @@ of the monitor and shows that workspace, and `SendContainerToWorkspaceNumber` do
|
||||
and leaves the workspace in front showing ([`WindowManager::move_container_to_workspace`]). A
|
||||
workspace that does not exist yet is created, with the ones before it, and gets a desktop.
|
||||
|
||||
The other workspace commands are made of the same two operations. `CycleFocusWorkspace`,
|
||||
`CycleMoveContainerToWorkspace` and `CycleSendContainerToWorkspace` take the next or the previous
|
||||
workspace, which wraps around, and `CycleFocusEmptyWorkspace` the next or the previous with no
|
||||
window. A monitor remembers the workspace that was in front before ([`Monitor::focus_workspace`]
|
||||
records it), which `FocusLastWorkspace`, `MoveContainerToLastWorkspace` and
|
||||
`SendContainerToLastWorkspace` take. `FocusWorkspaceNumbers` shows a workspace on every monitor.
|
||||
`WorkspaceName` names a workspace, `EnsureNamedWorkspaces` gives a monitor named workspaces, and
|
||||
`FocusNamedWorkspace`, `NamedWorkspaceLayout` and `NamedWorkspaceTiling` look a workspace up by
|
||||
its name on every monitor ([`WindowManager::monitor_workspace_index_by_name`]); a name no
|
||||
workspace has changes nothing. `FocusNamedWorkspace` focuses the monitor that has the workspace
|
||||
([`WindowManager::focus_monitor`]). `WorkspaceLayout` and `WorkspaceTiling` set the layout and the
|
||||
tiling of a workspace by index. `NewWorkspace` adds a workspace and shows it, `EnsureWorkspaces`
|
||||
gives a monitor workspaces up to a number, and `CloseWorkspace` removes the workspace in front
|
||||
when it has no window and no name and is not the monitor's last. A name is komorebi's: the
|
||||
compositor's desktops keep theirs.
|
||||
|
||||
`PreselectDirection` reserves the index on one side of the focused container for the next
|
||||
window ([`WindowManager::preselect_container_in_direction`]). The workspace inserts an empty
|
||||
container there ([`Container::preselect`]), which [`Workspace::update`] keeps and the layout
|
||||
@@ -481,7 +498,8 @@ module's unit.
|
||||
window out, move the focus, move the focused container, change the layout, resize or
|
||||
promote the focused container, float a window, lock a container, set the padding of a
|
||||
workspace, manage and unmanage a window, show a workspace, move a container to another
|
||||
workspace, follow a workspace switch made by something else).
|
||||
workspace, follow a workspace switch made by something else, name a workspace and find
|
||||
it by its name, set the layout of a workspace that is not in front).
|
||||
- [`desktop`](../../komorebi/src/desktop.rs): loads the monitors and the open windows from
|
||||
the backend.
|
||||
- [`window_manager_event`](../../komorebi/src/window_manager_event.rs) and
|
||||
@@ -583,6 +601,7 @@ the fake. The window manager is its only caller, through [`backend`]. The contra
|
||||
| A workspace switch or a window move made by something else is followed, and answered with no command | framework path: the table reports what it did not send as a `WorkspaceChange` or a `WorkspaceMove`, and [`WindowManager::adopt_workspace_change`] asks the compositor for nothing | `a_workspace_switch_by_someone_else_is_followed_not_undone`, `a_window_moved_to_another_desktop_by_someone_else_changes_workspace`, `another_party_switching_a_monitor_is_a_workspace_change`, `vm-workspace-switch` ("nothing is flip-flopping") | none |
|
||||
| komorebi's own switch or move, reported back by KWin, changes nothing | framework path: the table records a switch and a move when it makes their commands | `the_compositor_reporting_komorebis_own_switch_changes_nothing`, `komorebis_own_move_coming_back_as_an_event_moves_nothing`, `komorebi_switching_a_monitor_comes_back_as_a_change_to_what_it_already_knows` | none |
|
||||
| The user's `kwinrc` gets back the value komorebi changed, also after a crash | framework path: [`Kwinrc`] records the first value of a key in a backup file, and the backend's `shutdown` puts it back | `what_komorebi_changed_is_put_back_exactly_and_what_it_added_is_removed`, `a_backup_left_by_a_crash_keeps_the_values_from_before_the_first_run`, `vm-workspace-switch` ("back as they were") | `SIGKILL`: the next run puts it back when it stops |
|
||||
| A workspace is closed only when it has no window and no name and is not the monitor's last | framework path: the `CloseWorkspace` arm of [`WindowManager::process_command`] checks all three | `new_workspace_adds_one_and_close_workspace_removes_it_when_it_is_empty_and_unnamed` | none |
|
||||
| Moving the focus moves no window | test | `focus_gives_the_focus_to_the_window_on_that_side_and_moves_nothing`, `vm-core-e2e` ("moving the focus moved no window") | none |
|
||||
| A subscriber that is gone is dropped, not retried | test | `a_subscriber_that_is_gone_is_dropped_and_not_tried_again` | none |
|
||||
| The bridge holds no window manager logic | convention, with every decision about an event in the table, which the `kwin::state` unit tests pin | the unit tests in `komorebi/src/kwin/state.rs` | none |
|
||||
@@ -714,7 +733,9 @@ A window is shown, and ends up on a tile:
|
||||
- [`nix/tests/vm/suites/commands`](../../nix/tests/vm/suites/commands/test.py): every layout,
|
||||
and every `komorebic` command, against a real KWin with two outputs.
|
||||
- [`komorebi/tests/workspaces.rs`](../../komorebi/tests/workspaces.rs): workspaces as the
|
||||
fake's desktops; [`komorebi/src/kwin/kwinrc.rs`](../../komorebi/src/kwin/kwinrc.rs), the
|
||||
fake's desktops;
|
||||
[`komorebi/tests/workspace_commands.rs`](../../komorebi/tests/workspace_commands.rs), naming,
|
||||
cycling and the other workspace commands; [`komorebi/src/kwin/kwinrc.rs`](../../komorebi/src/kwin/kwinrc.rs), the
|
||||
`kwinrc` editor and its tests.
|
||||
- [`nix/tests/vm/suites/workspace-switch`](../../nix/tests/vm/suites/workspace-switch/test.py):
|
||||
workspaces as a real KWin's desktops, switched by `komorebic` and by KWin;
|
||||
@@ -809,6 +830,9 @@ A window is shown, and ends up on a tile:
|
||||
[`WindowManager::adopt_workspace_change`]: ../../komorebi/src/window_manager.rs
|
||||
[`WindowManager::focus_workspace`]: ../../komorebi/src/window_manager.rs
|
||||
[`WindowManager::move_container_to_workspace`]: ../../komorebi/src/window_manager.rs
|
||||
[`WindowManager::monitor_workspace_index_by_name`]: ../../komorebi/src/window_manager.rs
|
||||
[`WindowManager::focus_monitor`]: ../../komorebi/src/window_manager.rs
|
||||
[`Monitor::focus_workspace`]: ../../komorebi/src/monitor.rs
|
||||
[`bridge.js`]: ../../komorebi/src/kwin/bridge.js
|
||||
[`kwin-api.d.ts`]: ../../komorebi/src/kwin/kwin-api.d.ts
|
||||
[`bridge.test.js`]: ../../komorebi/src/kwin/bridge.test.js
|
||||
|
||||
@@ -36,6 +36,74 @@ komorebic move-to-workspace 1
|
||||
komorebic send-to-workspace 2
|
||||
```
|
||||
|
||||
## Going round the workspaces
|
||||
|
||||
[`komorebic cycle-workspace`](../cli/cycle-workspace.md) shows the next or the previous workspace
|
||||
of the focused monitor, and wraps around at both ends;
|
||||
[`komorebic cycle-empty-workspace`](../cli/cycle-empty-workspace.md) shows the next or the previous
|
||||
one that has no window, if there is one.
|
||||
[`komorebic cycle-move-to-workspace`](../cli/cycle-move-to-workspace.md) and
|
||||
[`komorebic cycle-send-to-workspace`](../cli/cycle-send-to-workspace.md) take the focused window to
|
||||
the next or the previous workspace, with and without showing it.
|
||||
|
||||
```sh
|
||||
komorebic cycle-workspace next
|
||||
komorebic cycle-empty-workspace previous
|
||||
komorebic cycle-move-to-workspace next
|
||||
```
|
||||
|
||||
## The last workspace
|
||||
|
||||
Each monitor remembers which workspace was in front before the one in front now.
|
||||
[`komorebic focus-last-workspace`](../cli/focus-last-workspace.md) shows it again, so two in a row
|
||||
go back and forth between the two.
|
||||
[`komorebic move-to-last-workspace`](../cli/move-to-last-workspace.md) and
|
||||
[`komorebic send-to-last-workspace`](../cli/send-to-last-workspace.md) take the focused window
|
||||
there, with and without showing it.
|
||||
|
||||
## Names
|
||||
|
||||
[`komorebic workspace-name`](../cli/workspace-name.md) names a workspace, given by the index of its
|
||||
monitor and its own index, and
|
||||
[`komorebic ensure-named-workspaces`](../cli/ensure-named-workspaces.md) gives a monitor a workspace
|
||||
for each name it is given, in order. The name is komorebi's, for the commands that find a
|
||||
workspace by its name: KWin's desktop keeps the name it has.
|
||||
[`komorebic focus-named-workspace`](../cli/focus-named-workspace.md) shows the workspace with that
|
||||
name, on whichever monitor has it, and focuses that monitor. A name no workspace has changes
|
||||
nothing. `komorebic query focused-workspace-name` prints the name of the workspace in front, or its
|
||||
index when it has none.
|
||||
|
||||
```sh
|
||||
komorebic ensure-named-workspaces 0 web code mail
|
||||
komorebic focus-named-workspace mail
|
||||
```
|
||||
|
||||
## Adding and removing workspaces
|
||||
|
||||
[`komorebic new-workspace`](../cli/new-workspace.md) adds a workspace after the last one of the
|
||||
focused monitor and shows it, and [`komorebic ensure-workspaces`](../cli/ensure-workspaces.md)
|
||||
gives a monitor at least as many workspaces as it is told.
|
||||
[`komorebic close-workspace`](../cli/close-workspace.md) removes the workspace in front and shows
|
||||
the one before it, when the workspace has no window and no name and is not the monitor's last.
|
||||
|
||||
[`komorebic focus-workspaces`](../cli/focus-workspaces.md) shows the workspace with the same index
|
||||
on every monitor.
|
||||
|
||||
## The layout of another workspace
|
||||
|
||||
[`komorebic workspace-layout`](../cli/workspace-layout.md) and
|
||||
[`komorebic workspace-tiling`](../cli/workspace-tiling.md) set the layout of a workspace, and turn
|
||||
its tiling off or on, by the index of its monitor and its own index;
|
||||
[`komorebic named-workspace-layout`](../cli/named-workspace-layout.md) and
|
||||
[`komorebic named-workspace-tiling`](../cli/named-workspace-tiling.md) find it by its name. The
|
||||
focused workspace is tiled again at once, and another workspace the next time it is tiled, when it
|
||||
is shown at the latest.
|
||||
|
||||
```sh
|
||||
komorebic workspace-layout 0 1 columns
|
||||
komorebic named-workspace-tiling mail disable
|
||||
```
|
||||
|
||||
## Switching with KWin
|
||||
|
||||
Anything that switches KWin's desktop switches komorebi's workspace: the pager, KWin's own
|
||||
|
||||
Reference in new issue
Block a user