mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-24 18:31:22 +01:00
feat(wm): add noop cross-monitor-move-behaviour
This commit adds a new "NoOp" MoveBehaviour for users who don't want any moves to happen across monitor boundaries. The toggle-cross-monitor-move-behaviour will only toggle between Swap and Insert, and will do nothing if NoOp is the selected MoveBehaviour. resolve #667
This commit is contained in:
@@ -283,6 +283,8 @@ pub enum MoveBehaviour {
|
||||
Swap,
|
||||
/// Insert the window container into the focused workspace on the adjacent monitor
|
||||
Insert,
|
||||
/// Do nothing if trying to move a window container in the direction of an adjacent monitor
|
||||
NoOp,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
|
||||
@@ -1187,6 +1187,7 @@ impl WindowManager {
|
||||
MoveBehaviour::Insert => {
|
||||
self.cross_monitor_move_behaviour = MoveBehaviour::Swap;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
SocketMessage::CrossMonitorMoveBehaviour(behaviour) => {
|
||||
|
||||
@@ -1333,6 +1333,11 @@ impl WindowManager {
|
||||
// If there is nowhere to move on the current workspace, try to move it onto the monitor
|
||||
// in that direction if there is one
|
||||
None => {
|
||||
// Don't do anything if the user has set the MoveBehaviour to NoOp
|
||||
if matches!(self.cross_monitor_move_behaviour, MoveBehaviour::NoOp) {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let target_monitor_idx = self
|
||||
.monitor_idx_in_direction(direction)
|
||||
.ok_or_else(|| anyhow!("there is no container or monitor in this direction"))?;
|
||||
|
||||
Reference in New Issue
Block a user