[gnome-shell] windowMenu: Add option to move different monitor



commit 43fc598bd594211eadc589e89367c2a0c5a70c5d
Author: acgtyrant <acgtyrant gmail com>
Date:   Tue Mar 24 11:19:46 2015 +0800

    windowMenu: Add option to move different monitor
    
    The window menu has all those workspace related options, but with multiple
    monitors, it is much more interesting to quickly move a window 'over' to the
    other monitor.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=633994

 js/ui/windowMenu.js |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/windowMenu.js b/js/ui/windowMenu.js
index 3d378fa..a314821 100644
--- a/js/ui/windowMenu.js
+++ b/js/ui/windowMenu.js
@@ -115,6 +115,39 @@ const WindowMenu = new Lang.Class({
             }
         }
 
+        let screen = global.screen;
+        let nMonitors = screen.get_n_monitors();
+        if (nMonitors > 1) {
+          this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
+
+          let monitorIndex = window.get_monitor();
+
+          let upMonitorIndex = screen.get_monitor_neighbor_index(monitorIndex, Meta.ScreenDirection.UP);
+          if (upMonitorIndex != -1) {
+            this.addAction(_("Move to Monitor Up"), Lang.bind(this, function(event) {
+              window.move_to_monitor(upMonitorIndex);
+            }));
+          }
+          let downMonitorIndex = screen.get_monitor_neighbor_index(monitorIndex, Meta.ScreenDirection.DOWN);
+          if (downMonitorIndex != -1) {
+            this.addAction(_("Move to Monitor Down"), Lang.bind(this, function(event) {
+              window.move_to_monitor(downMonitorIndex);
+            }));
+          }
+          let leftMonitorIndex = screen.get_monitor_neighbor_index(monitorIndex, Meta.ScreenDirection.LEFT);
+          if (leftMonitorIndex != -1) {
+            this.addAction(_("Move to Monitor Left"), Lang.bind(this, function(event) {
+              window.move_to_monitor(leftMonitorIndex);
+            }));
+          }
+          let rightMonitorIndex = screen.get_monitor_neighbor_index(monitorIndex, 
Meta.ScreenDirection.RIGHT);
+          if (rightMonitorIndex != -1) {
+            this.addAction(_("Move to Monitor Right"), Lang.bind(this, function(event) {
+              window.move_to_monitor(rightMonitorIndex);
+            }));
+          }
+        }
+
         this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
 
         item = this.addAction(_("Close"), Lang.bind(this, function(event) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]