troyready/quarterwindows

Moving windows on a multi monitor setup

mmoo-Leon-Sanders opened this issue · 1 comments

When tilling all windows move to the primary monitor
I modified the moveWindow function as follows which works on my four monitor setup

moveWindow(location) {
		let activeMonitorIndex = global.display.get_current_monitor();
		global.get_window_actors().every((w) => {
			if (w.meta_window.has_focus()) {
				let windowMonitorIndex = w.meta_window.get_monitor();
				if (windowMonitorIndex === activeMonitorIndex) {
					var monitorGeometry = Meta.is_wayland_compositor() ?
						global.workspace_manager.get_active_workspace().get_work_area_for_monitor(windowMonitorIndex) :
						global.display.get_monitor_geometry(windowMonitorIndex);
					var monitorUpperLeftX = monitorGeometry.x;
					var monitorUpperLeftY = monitorGeometry.y;
					var monitorHalfWidth = Math.floor(monitorGeometry.width / 2);
					var monitorHalfHeight = Math.floor(monitorGeometry.height / 2);
.....

Thanks for the contribution @mmoo-Leon-Sanders !

I did a test with this on a multi-monitor X11 session and it appears to restrict movement to the primary display. That is, I tried:

  • Opening a terminal on my primary display
  • Using quarterwindows shortcut to move it to a corner (ctrl+super+j)
  • Then moved the window to another display with the gnome shortcut (shift+super+left)
  • Then tried another quarterwindows shortcut (ctrl+super+u) and it wouldn't respond

Not sure if this is different on wayland or if one would need to move the mouse too to set a new activeMonitor? Open to further thoughts on this.