mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-15 21:32:26 +01:00
feat(process_command): toggle-monocle acts while a window is maximized
komorebi for Windows does not ignore it while a window is maximized: the monocle of the tiles that are left comes on and goes off, and the window stays maximized. Match it, and drop toggle-monocle from the commands that are about the tiles.
This commit is contained in:
1 parent
b3dc2ed903
commit
3e7451f132
3 files changed
+28
-9
No files matched your search
@@ -122,9 +122,10 @@
|
||||
//! or restores it and puts it back in its tile ([`WindowManager::toggle_maximize`]). A window
|
||||
//! the user maximizes leaves the layout the same way
|
||||
//! ([`WindowManager::adopt_maximize_change`]). While a window is maximized, by either, the
|
||||
//! messages about the tiles (**MoveWindow**, **CycleMoveWindow**, the stack messages, the
|
||||
//! resize, promote and preselect messages, **ToggleLock**, **ToggleFloat**, **ToggleMonocle**
|
||||
//! and the ones that send a container to another monitor or workspace) are ignored.
|
||||
//! messages about the tiles (**MoveWindow**, **CycleMoveWindow**, the unstack and cycle messages,
|
||||
//! the resize, promote and preselect messages, **ToggleLock** and the ones that send a container
|
||||
//! to another monitor or workspace) are ignored. **ToggleFloat**, **StackWindow** and
|
||||
//! **ToggleMonocle** are not: see `is_layout_command`.
|
||||
//! - **WorkspacePadding** and **ContainerPadding** set the paddings of a workspace given by the
|
||||
//! index of its monitor and its own, **NamedWorkspacePadding** and
|
||||
//! **NamedWorkspaceContainerPadding** those of the workspace with a name
|
||||
@@ -335,11 +336,12 @@ pub fn listen_for_commands(wm: Arc<Mutex<WindowManager>>) {
|
||||
/// locking, the monocle, and sending containers to other monitors and workspaces), which a
|
||||
/// maximized window has left
|
||||
///
|
||||
/// Two commands that look like them are not here, because komorebi for Windows does not ignore
|
||||
/// Three commands that look like them are not here, because komorebi for Windows does not ignore
|
||||
/// them either (`maximizing.user` in the end-to-end suite has them as what both ports do):
|
||||
/// `toggle-float` floats the maximized window, which ends the maximize
|
||||
/// ([`Workspace::new_floating_window`](crate::workspace::Workspace::new_floating_window)), and
|
||||
/// `stack left` and `stack right` stack the tiles that are left.
|
||||
/// ([`Workspace::new_floating_window`](crate::workspace::Workspace::new_floating_window)),
|
||||
/// `stack left` and `stack right` stack the tiles that are left, and `toggle-monocle` turns the
|
||||
/// monocle of the tiles that are left on, with the window staying maximized.
|
||||
fn is_layout_command(message: &SocketMessage) -> bool {
|
||||
matches!(
|
||||
message,
|
||||
@@ -359,7 +361,6 @@ fn is_layout_command(message: &SocketMessage) -> bool {
|
||||
| SocketMessage::PromoteFocus
|
||||
| SocketMessage::PromoteWindow(_)
|
||||
| SocketMessage::ToggleLock
|
||||
| SocketMessage::ToggleMonocle
|
||||
| SocketMessage::MoveContainerToLastWorkspace
|
||||
| SocketMessage::SendContainerToLastWorkspace
|
||||
| SocketMessage::MoveContainerToMonitorNumber(_)
|
||||
|
||||
@@ -186,7 +186,6 @@ fn while_a_window_is_maximized_what_is_about_the_tiles_does_nothing() {
|
||||
SocketMessage::SendContainerToMonitorNumber(1),
|
||||
SocketMessage::Promote,
|
||||
SocketMessage::ToggleLock,
|
||||
SocketMessage::ToggleMonocle,
|
||||
SocketMessage::PreselectDirection(OperationDirection::Left),
|
||||
] {
|
||||
send(&fake, &mut wm, message);
|
||||
|
||||
@@ -117,7 +117,6 @@ fn nothing_that_is_about_the_layout_happens_while_a_window_is_maximized() {
|
||||
SocketMessage::UnstackWindow,
|
||||
SocketMessage::StackAll,
|
||||
SocketMessage::Promote,
|
||||
SocketMessage::ToggleMonocle,
|
||||
SocketMessage::ToggleLock,
|
||||
SocketMessage::SendContainerToWorkspaceNumber(1),
|
||||
SocketMessage::MoveContainerToWorkspaceNumber(1),
|
||||
@@ -269,3 +268,23 @@ fn stack_left_stacks_the_tiles_that_are_left_while_a_window_is_maximized() {
|
||||
assert_eq!(workspace.maximized_window.map(|w| w.id), Some(30_092));
|
||||
assert_eq!(workspace.containers().len(), 1, "the two tiles are stacked");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn toggle_monocle_turns_the_monocle_of_the_tiles_that_are_left_on_while_a_window_is_maximized() {
|
||||
let (fake, mut wm) = tiled(30_111, 3);
|
||||
user_maximizes(&fake, &mut wm, 30_112, true);
|
||||
|
||||
command(&fake, &mut wm, SocketMessage::ToggleMonocle);
|
||||
|
||||
let workspace = wm.focused_workspace().unwrap();
|
||||
assert!(workspace.monocle_container.is_some());
|
||||
assert_eq!(workspace.maximized_window.map(|w| w.id), Some(30_112));
|
||||
assert!(fake.is_maximized(30_112));
|
||||
|
||||
command(&fake, &mut wm, SocketMessage::ToggleMonocle);
|
||||
|
||||
let workspace = wm.focused_workspace().unwrap();
|
||||
assert!(workspace.monocle_container.is_none());
|
||||
assert_eq!(workspace.containers().len(), 2);
|
||||
assert_eq!(workspace.maximized_window.map(|w| w.id), Some(30_112));
|
||||
}
|
||||
Reference in new issue
Block a user