forge
Explore
Log in

Don't you dare go Hollow

Implemented move-window-to-monitor and move-column-to-monitor

Browse files at this commit

50a99f635648c9de0d63d59dc5b7ea8d92cbe1faAnnika HannigParent: 993c5ce
niri-config/src/lib.rsmodified+42 -0
@@ -1575,12 +1575,14 @@ pub enum Action {
1575 MoveWindowToMonitorUp,1575 MoveWindowToMonitorUp,
1576 MoveWindowToMonitorPrevious,1576 MoveWindowToMonitorPrevious,
1577 MoveWindowToMonitorNext,1577 MoveWindowToMonitorNext,
1578+ MoveWindowToMonitor(#[knuffel(argument)] String),
1578 MoveColumnToMonitorLeft,1579 MoveColumnToMonitorLeft,
1579 MoveColumnToMonitorRight,1580 MoveColumnToMonitorRight,
1580 MoveColumnToMonitorDown,1581 MoveColumnToMonitorDown,
1581 MoveColumnToMonitorUp,1582 MoveColumnToMonitorUp,
1582 MoveColumnToMonitorPrevious,1583 MoveColumnToMonitorPrevious,
1583 MoveColumnToMonitorNext,1584 MoveColumnToMonitorNext,
1585+ MoveColumnToMonitor(#[knuffel(argument)] String),
1584 SetWindowWidth(#[knuffel(argument, str)] SizeChange),1586 SetWindowWidth(#[knuffel(argument, str)] SizeChange),
1585 #[knuffel(skip)]1587 #[knuffel(skip)]
1586 SetWindowWidthById {1588 SetWindowWidthById {
@@ -1778,12 +1780,14 @@ impl From<niri_ipc::Action> for Action {
1778 niri_ipc::Action::MoveWindowToMonitorUp {} => Self::MoveWindowToMonitorUp,1780 niri_ipc::Action::MoveWindowToMonitorUp {} => Self::MoveWindowToMonitorUp,
1779 niri_ipc::Action::MoveWindowToMonitorPrevious {} => Self::MoveWindowToMonitorPrevious,1781 niri_ipc::Action::MoveWindowToMonitorPrevious {} => Self::MoveWindowToMonitorPrevious,
1780 niri_ipc::Action::MoveWindowToMonitorNext {} => Self::MoveWindowToMonitorNext,1782 niri_ipc::Action::MoveWindowToMonitorNext {} => Self::MoveWindowToMonitorNext,
1783+ niri_ipc::Action::MoveWindowToMonitor { output } => Self::MoveWindowToMonitor(output),
1781 niri_ipc::Action::MoveColumnToMonitorLeft {} => Self::MoveColumnToMonitorLeft,1784 niri_ipc::Action::MoveColumnToMonitorLeft {} => Self::MoveColumnToMonitorLeft,
1782 niri_ipc::Action::MoveColumnToMonitorRight {} => Self::MoveColumnToMonitorRight,1785 niri_ipc::Action::MoveColumnToMonitorRight {} => Self::MoveColumnToMonitorRight,
1783 niri_ipc::Action::MoveColumnToMonitorDown {} => Self::MoveColumnToMonitorDown,1786 niri_ipc::Action::MoveColumnToMonitorDown {} => Self::MoveColumnToMonitorDown,
1784 niri_ipc::Action::MoveColumnToMonitorUp {} => Self::MoveColumnToMonitorUp,1787 niri_ipc::Action::MoveColumnToMonitorUp {} => Self::MoveColumnToMonitorUp,
1785 niri_ipc::Action::MoveColumnToMonitorPrevious {} => Self::MoveColumnToMonitorPrevious,1788 niri_ipc::Action::MoveColumnToMonitorPrevious {} => Self::MoveColumnToMonitorPrevious,
1786 niri_ipc::Action::MoveColumnToMonitorNext {} => Self::MoveColumnToMonitorNext,1789 niri_ipc::Action::MoveColumnToMonitorNext {} => Self::MoveColumnToMonitorNext,
1790+ niri_ipc::Action::MoveColumnToMonitor { output } => Self::MoveColumnToMonitor(output),
1787 niri_ipc::Action::SetWindowWidth { id: None, change } => Self::SetWindowWidth(change),1791 niri_ipc::Action::SetWindowWidth { id: None, change } => Self::SetWindowWidth(change),
1788 niri_ipc::Action::SetWindowWidth {1792 niri_ipc::Action::SetWindowWidth {
1789 id: Some(id),1793 id: Some(id),
@@ -3774,6 +3778,8 @@ mod tests {
3774 Mod+Shift+H { focus-monitor-left; }3778 Mod+Shift+H { focus-monitor-left; }
3775 Mod+Shift+O { focus-monitor "eDP-1"; }3779 Mod+Shift+O { focus-monitor "eDP-1"; }
3776 Mod+Ctrl+Shift+L { move-window-to-monitor-right; }3780 Mod+Ctrl+Shift+L { move-window-to-monitor-right; }
3781+ Mod+Ctrl+Alt+O { move-window-to-monitor "eDP-1"; }
3782+ Mod+Ctrl+Alt+P { move-column-to-monitor "DP-1"; }
3777 Mod+Comma { consume-window-into-column; }3783 Mod+Comma { consume-window-into-column; }
3778 Mod+1 { focus-workspace 1; }3784 Mod+1 { focus-workspace 1; }
3779 Mod+Shift+1 { focus-workspace "workspace-1"; }3785 Mod+Shift+1 { focus-workspace "workspace-1"; }
@@ -4643,6 +4649,42 @@ mod tests {
4643 allow_inhibiting: true,4649 allow_inhibiting: true,
4644 hotkey_overlay_title: None,4650 hotkey_overlay_title: None,
4645 },4651 },
4652+ Bind {
4653+ key: Key {
4654+ trigger: Keysym(
4655+ XK_o,
4656+ ),
4657+ modifiers: Modifiers(
4658+ CTRL | ALT | COMPOSITOR,
4659+ ),
4660+ },
4661+ action: MoveWindowToMonitor(
4662+ "eDP-1",
4663+ ),
4664+ repeat: true,
4665+ cooldown: None,
4666+ allow_when_locked: false,
4667+ allow_inhibiting: true,
4668+ hotkey_overlay_title: None,
4669+ },
4670+ Bind {
4671+ key: Key {
4672+ trigger: Keysym(
4673+ XK_p,
4674+ ),
4675+ modifiers: Modifiers(
4676+ CTRL | ALT | COMPOSITOR,
4677+ ),
4678+ },
4679+ action: MoveColumnToMonitor(
4680+ "DP-1",
4681+ ),
4682+ repeat: true,
4683+ cooldown: None,
4684+ allow_when_locked: false,
4685+ allow_inhibiting: true,
4686+ hotkey_overlay_title: None,
4687+ },
4646 Bind {4688 Bind {
4647 key: Key {4689 key: Key {
4648 trigger: Keysym(4690 trigger: Keysym(
niri-ipc/src/lib.rsmodified+12 -0
@@ -475,6 +475,12 @@ pub enum Action {
475 MoveWindowToMonitorPrevious {},475 MoveWindowToMonitorPrevious {},
476 /// Move the focused window to the next monitor.476 /// Move the focused window to the next monitor.
477 MoveWindowToMonitorNext {},477 MoveWindowToMonitorNext {},
478+ /// Move the focused window to a specific monitor.
479+ MoveWindowToMonitor {
480+ /// The target output name.
481+ #[cfg_attr(feature = "clap", arg())]
482+ output: String,
483+ },
478 /// Move the focused column to the monitor to the left.484 /// Move the focused column to the monitor to the left.
479 MoveColumnToMonitorLeft {},485 MoveColumnToMonitorLeft {},
480 /// Move the focused column to the monitor to the right.486 /// Move the focused column to the monitor to the right.
@@ -487,6 +493,12 @@ pub enum Action {
487 MoveColumnToMonitorPrevious {},493 MoveColumnToMonitorPrevious {},
488 /// Move the focused column to the next monitor.494 /// Move the focused column to the next monitor.
489 MoveColumnToMonitorNext {},495 MoveColumnToMonitorNext {},
496+ /// Move the focused column to a specific monitor.
497+ MoveColumnToMonitor {
498+ /// The target output name.
499+ #[cfg_attr(feature = "clap", arg())]
500+ output: String,
501+ },
490 /// Change the width of a window.502 /// Change the width of a window.
491 #[cfg_attr(503 #[cfg_attr(
492 feature = "clap",504 feature = "clap",
src/input/mod.rsmodified+18 -0
@@ -1449,6 +1449,15 @@ impl State {
1449 }1449 }
1450 }1450 }
1451 }1451 }
1452+ Action::MoveWindowToMonitor(output) => {
1453+ if let Some(output) = self.niri.output_by_name_match(&output).cloned() {
1454+ self.niri.layout.move_to_output(None, &output, None);
1455+ self.niri.layout.focus_output(&output);
1456+ if !self.maybe_warp_cursor_to_focus_centered() {
1457+ self.move_cursor_to_output(&output);
1458+ }
1459+ }
1460+ }
1452 Action::MoveColumnToMonitorLeft => {1461 Action::MoveColumnToMonitorLeft => {
1453 if let Some(output) = self.niri.output_left() {1462 if let Some(output) = self.niri.output_left() {
1454 self.niri.layout.move_column_to_output(&output);1463 self.niri.layout.move_column_to_output(&output);
@@ -1503,6 +1512,15 @@ impl State {
1503 }1512 }
1504 }1513 }
1505 }1514 }
1515+ Action::MoveColumnToMonitor(output) => {
1516+ if let Some(output) = self.niri.output_by_name_match(&output).cloned() {
1517+ self.niri.layout.move_column_to_output(&output);
1518+ self.niri.layout.focus_output(&output);
1519+ if !self.maybe_warp_cursor_to_focus_centered() {
1520+ self.move_cursor_to_output(&output);
1521+ }
1522+ }
1523+ }
1506 Action::SetColumnWidth(change) => {1524 Action::SetColumnWidth(change) => {
1507 self.niri.layout.set_column_width(change);1525 self.niri.layout.set_column_width(change);
1508 }1526 }