mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-04-25 10:08:33 +02: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,
|
Swap,
|
||||||
/// Insert the window container into the focused workspace on the adjacent monitor
|
/// Insert the window container into the focused workspace on the adjacent monitor
|
||||||
Insert,
|
Insert,
|
||||||
|
/// Do nothing if trying to move a window container in the direction of an adjacent monitor
|
||||||
|
NoOp,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
|
|||||||
@@ -1187,6 +1187,7 @@ impl WindowManager {
|
|||||||
MoveBehaviour::Insert => {
|
MoveBehaviour::Insert => {
|
||||||
self.cross_monitor_move_behaviour = MoveBehaviour::Swap;
|
self.cross_monitor_move_behaviour = MoveBehaviour::Swap;
|
||||||
}
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SocketMessage::CrossMonitorMoveBehaviour(behaviour) => {
|
SocketMessage::CrossMonitorMoveBehaviour(behaviour) => {
|
||||||
|
|||||||
@@ -1338,6 +1338,11 @@ impl WindowManager {
|
|||||||
// If there is nowhere to move on the current workspace, try to move it onto the monitor
|
// If there is nowhere to move on the current workspace, try to move it onto the monitor
|
||||||
// in that direction if there is one
|
// in that direction if there is one
|
||||||
None => {
|
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
|
let target_monitor_idx = self
|
||||||
.monitor_idx_in_direction(direction)
|
.monitor_idx_in_direction(direction)
|
||||||
.ok_or_else(|| anyhow!("there is no container or monitor in this direction"))?;
|
.ok_or_else(|| anyhow!("there is no container or monitor in this direction"))?;
|
||||||
|
|||||||
Reference in New Issue
Block a user