mirror of
https://github.com/YaLTeR/niri.git
synced 2025-10-06 00:23:14 +02:00
Implemented move-window-to-monitor and move-column-to-monitor
This commit is contained in:
committed by
Ivan Molodetskikh
parent
993c5ce8af
commit
50a99f6356
@@ -1575,12 +1575,14 @@ pub enum Action {
|
||||
MoveWindowToMonitorUp,
|
||||
MoveWindowToMonitorPrevious,
|
||||
MoveWindowToMonitorNext,
|
||||
MoveWindowToMonitor(#[knuffel(argument)] String),
|
||||
MoveColumnToMonitorLeft,
|
||||
MoveColumnToMonitorRight,
|
||||
MoveColumnToMonitorDown,
|
||||
MoveColumnToMonitorUp,
|
||||
MoveColumnToMonitorPrevious,
|
||||
MoveColumnToMonitorNext,
|
||||
MoveColumnToMonitor(#[knuffel(argument)] String),
|
||||
SetWindowWidth(#[knuffel(argument, str)] SizeChange),
|
||||
#[knuffel(skip)]
|
||||
SetWindowWidthById {
|
||||
@@ -1778,12 +1780,14 @@ impl From<niri_ipc::Action> for Action {
|
||||
niri_ipc::Action::MoveWindowToMonitorUp {} => Self::MoveWindowToMonitorUp,
|
||||
niri_ipc::Action::MoveWindowToMonitorPrevious {} => Self::MoveWindowToMonitorPrevious,
|
||||
niri_ipc::Action::MoveWindowToMonitorNext {} => Self::MoveWindowToMonitorNext,
|
||||
niri_ipc::Action::MoveWindowToMonitor { output } => Self::MoveWindowToMonitor(output),
|
||||
niri_ipc::Action::MoveColumnToMonitorLeft {} => Self::MoveColumnToMonitorLeft,
|
||||
niri_ipc::Action::MoveColumnToMonitorRight {} => Self::MoveColumnToMonitorRight,
|
||||
niri_ipc::Action::MoveColumnToMonitorDown {} => Self::MoveColumnToMonitorDown,
|
||||
niri_ipc::Action::MoveColumnToMonitorUp {} => Self::MoveColumnToMonitorUp,
|
||||
niri_ipc::Action::MoveColumnToMonitorPrevious {} => Self::MoveColumnToMonitorPrevious,
|
||||
niri_ipc::Action::MoveColumnToMonitorNext {} => Self::MoveColumnToMonitorNext,
|
||||
niri_ipc::Action::MoveColumnToMonitor { output } => Self::MoveColumnToMonitor(output),
|
||||
niri_ipc::Action::SetWindowWidth { id: None, change } => Self::SetWindowWidth(change),
|
||||
niri_ipc::Action::SetWindowWidth {
|
||||
id: Some(id),
|
||||
@@ -3774,6 +3778,8 @@ mod tests {
|
||||
Mod+Shift+H { focus-monitor-left; }
|
||||
Mod+Shift+O { focus-monitor "eDP-1"; }
|
||||
Mod+Ctrl+Shift+L { move-window-to-monitor-right; }
|
||||
Mod+Ctrl+Alt+O { move-window-to-monitor "eDP-1"; }
|
||||
Mod+Ctrl+Alt+P { move-column-to-monitor "DP-1"; }
|
||||
Mod+Comma { consume-window-into-column; }
|
||||
Mod+1 { focus-workspace 1; }
|
||||
Mod+Shift+1 { focus-workspace "workspace-1"; }
|
||||
@@ -4643,6 +4649,42 @@ mod tests {
|
||||
allow_inhibiting: true,
|
||||
hotkey_overlay_title: None,
|
||||
},
|
||||
Bind {
|
||||
key: Key {
|
||||
trigger: Keysym(
|
||||
XK_o,
|
||||
),
|
||||
modifiers: Modifiers(
|
||||
CTRL | ALT | COMPOSITOR,
|
||||
),
|
||||
},
|
||||
action: MoveWindowToMonitor(
|
||||
"eDP-1",
|
||||
),
|
||||
repeat: true,
|
||||
cooldown: None,
|
||||
allow_when_locked: false,
|
||||
allow_inhibiting: true,
|
||||
hotkey_overlay_title: None,
|
||||
},
|
||||
Bind {
|
||||
key: Key {
|
||||
trigger: Keysym(
|
||||
XK_p,
|
||||
),
|
||||
modifiers: Modifiers(
|
||||
CTRL | ALT | COMPOSITOR,
|
||||
),
|
||||
},
|
||||
action: MoveColumnToMonitor(
|
||||
"DP-1",
|
||||
),
|
||||
repeat: true,
|
||||
cooldown: None,
|
||||
allow_when_locked: false,
|
||||
allow_inhibiting: true,
|
||||
hotkey_overlay_title: None,
|
||||
},
|
||||
Bind {
|
||||
key: Key {
|
||||
trigger: Keysym(
|
||||
|
@@ -475,6 +475,12 @@ pub enum Action {
|
||||
MoveWindowToMonitorPrevious {},
|
||||
/// Move the focused window to the next monitor.
|
||||
MoveWindowToMonitorNext {},
|
||||
/// Move the focused window to a specific monitor.
|
||||
MoveWindowToMonitor {
|
||||
/// The target output name.
|
||||
#[cfg_attr(feature = "clap", arg())]
|
||||
output: String,
|
||||
},
|
||||
/// Move the focused column to the monitor to the left.
|
||||
MoveColumnToMonitorLeft {},
|
||||
/// Move the focused column to the monitor to the right.
|
||||
@@ -487,6 +493,12 @@ pub enum Action {
|
||||
MoveColumnToMonitorPrevious {},
|
||||
/// Move the focused column to the next monitor.
|
||||
MoveColumnToMonitorNext {},
|
||||
/// Move the focused column to a specific monitor.
|
||||
MoveColumnToMonitor {
|
||||
/// The target output name.
|
||||
#[cfg_attr(feature = "clap", arg())]
|
||||
output: String,
|
||||
},
|
||||
/// Change the width of a window.
|
||||
#[cfg_attr(
|
||||
feature = "clap",
|
||||
|
@@ -1449,6 +1449,15 @@ impl State {
|
||||
}
|
||||
}
|
||||
}
|
||||
Action::MoveWindowToMonitor(output) => {
|
||||
if let Some(output) = self.niri.output_by_name_match(&output).cloned() {
|
||||
self.niri.layout.move_to_output(None, &output, None);
|
||||
self.niri.layout.focus_output(&output);
|
||||
if !self.maybe_warp_cursor_to_focus_centered() {
|
||||
self.move_cursor_to_output(&output);
|
||||
}
|
||||
}
|
||||
}
|
||||
Action::MoveColumnToMonitorLeft => {
|
||||
if let Some(output) = self.niri.output_left() {
|
||||
self.niri.layout.move_column_to_output(&output);
|
||||
@@ -1503,6 +1512,15 @@ impl State {
|
||||
}
|
||||
}
|
||||
}
|
||||
Action::MoveColumnToMonitor(output) => {
|
||||
if let Some(output) = self.niri.output_by_name_match(&output).cloned() {
|
||||
self.niri.layout.move_column_to_output(&output);
|
||||
self.niri.layout.focus_output(&output);
|
||||
if !self.maybe_warp_cursor_to_focus_centered() {
|
||||
self.move_cursor_to_output(&output);
|
||||
}
|
||||
}
|
||||
}
|
||||
Action::SetColumnWidth(change) => {
|
||||
self.niri.layout.set_column_width(change);
|
||||
}
|
||||
|
Reference in New Issue
Block a user