dock extension patch



Hello,

I'm back with a patch for dock extension, ready for 3.4 version ;)
It lets user choosing the dock's monitor with a gsetting key (monitor)

I never got an answer on the bug I submitted (664318), then I'll try to
get feedback on the list.

Regards,

-- 
Bastien Durel
>From a705cd6690d8aed7dc0ee38c1fdd0b7bb8100295 Mon Sep 17 00:00:00 2001
From: Bastien Durel <bastien durel org>
Date: Wed, 25 Apr 2012 18:20:32 +0200
Subject: [PATCH] Let user choose the monitor where to show dock

---
 extensions/dock/extension.js                       |   28 +++++++++++++++++++-
 .../org.gnome.shell.extensions.dock.gschema.xml.in |    5 ++++
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/extensions/dock/extension.js b/extensions/dock/extension.js
index 3b8036f..ccf7ac3 100644
--- a/extensions/dock/extension.js
+++ b/extensions/dock/extension.js
@@ -35,6 +35,7 @@ const DOCK_SIZE_KEY = 'size';
 const DOCK_HIDE_KEY = 'autohide';
 const DOCK_EFFECTHIDE_KEY = 'hide-effect';
 const DOCK_AUTOHIDE_ANIMATION_TIME_KEY = 'hide-effect-duration';
+const DOCK_MONITOR_KEY = 'monitor';
 
 // Keep enums in sync with GSettings schemas
 const PositionMode = {
@@ -57,7 +58,10 @@ function hideDock_size () {
     if (!this._hideable)
         return;
 
-    let monitor = Main.layoutManager.primaryMonitor
+    let monitor = Main.layoutManager.primaryMonitor;
+    if (this._displayMonitor > -1 && this._displayMonitor < Main.layoutManager.monitors.length) {
+      monitor = Main.layoutManager.monitors[this._displayMonitor];
+    }
     let position_x = monitor.x;
     let height = (this._nicons)*(this._item_size + this._spacing) + 2*this._spacing;
     let width = this._item_size + 4*this._spacing;
@@ -87,6 +91,9 @@ function hideDock_size () {
 
 function showDock_size () {
     let monitor = Main.layoutManager.primaryMonitor;
+    if (this._displayMonitor > -1 && this._displayMonitor < Main.layoutManager.monitors.length) {
+      monitor = Main.layoutManager.monitors[this._displayMonitor];
+    }
     let height = (this._nicons)*(this._item_size + this._spacing) + 2*this._spacing;
     let width = this._item_size + 4*this._spacing;
     let position_x = monitor.x;
@@ -137,6 +144,9 @@ function hideDock_scale () {
 
     this._item_size = this._settings.get_int(DOCK_SIZE_KEY);
     let monitor = Main.layoutManager.primaryMonitor;
+    if (this._displayMonitor > -1 && this._displayMonitor < Main.layoutManager.monitors.length) {
+      monitor = Main.layoutManager.monitors[this._displayMonitor];
+    }
     let cornerX = 0;
     let height = this._nicons*(this._item_size + this._spacing) + 2*this._spacing;
     let width = this._item_size + 4*this._spacing;
@@ -166,6 +176,9 @@ function hideDock_scale () {
 function showDock_scale () {
     this._item_size = this._settings.get_int(DOCK_SIZE_KEY);
     let monitor = Main.layoutManager.primaryMonitor;
+    if (this._displayMonitor > -1 && this._displayMonitor < Main.layoutManager.monitors.length) {
+      monitor = Main.layoutManager.monitors[this._displayMonitor];
+    }
     let position_x = monitor.x;
     let height = this._nicons*(this._item_size + this._spacing) + 2*this._spacing;
     let width = this._item_size + 4*this._spacing;
@@ -193,6 +206,9 @@ function showDock_scale () {
 
 function showEffectAddItem_scale () {
     let monitor = Main.layoutManager.primaryMonitor;
+    if (this._displayMonitor > -1 && this._displayMonitor < Main.layoutManager.monitors.length) {
+      monitor = Main.layoutManager.monitors[this._displayMonitor];
+    }
     let height = this._nicons*(this._item_size + this._spacing) + 2*this._spacing;
     let width = this._item_size + 4*this._spacing;
 
@@ -214,6 +230,9 @@ function hideDock_move () {
 
     this._item_size = this._settings.get_int(DOCK_SIZE_KEY);
     let monitor = Main.layoutManager.primaryMonitor;
+    if (this._displayMonitor > -1 && this._displayMonitor < Main.layoutManager.monitors.length) {
+      monitor = Main.layoutManager.monitors[this._displayMonitor];
+    }
     let cornerX = 0;
     let height = this._nicons*(this._item_size + this._spacing) + 2*this._spacing;
     let width = this._item_size + 4*this._spacing;
@@ -242,6 +261,9 @@ function hideDock_move () {
 function showDock_move () {
     this._item_size = this._settings.get_int(DOCK_SIZE_KEY);
     let monitor = Main.layoutManager.primaryMonitor;
+    if (this._displayMonitor > -1 && this._displayMonitor < Main.layoutManager.monitors.length) {
+      monitor = Main.layoutManager.monitors[this._displayMonitor];
+    }
     let position_x = monitor.x;
     let height = this._nicons*(this._item_size + this._spacing) + 2*this._spacing;
     let width = this._item_size + 4*this._spacing;
@@ -268,6 +290,9 @@ function showDock_move () {
 
 function showEffectAddItem_move () {
         let monitor = Main.layoutManager.primaryMonitor;
+        if (this._displayMonitor > -1 && this._displayMonitor < Main.layoutManager.monitors.length) {
+          monitor = Main.layoutManager.monitors[this._displayMonitor];
+        }
         let height = this._nicons*(this._item_size + this._spacing) + 2*this._spacing;
         let width = this._item_size + 4*this._spacing;
 
@@ -294,6 +319,7 @@ const Dock = new Lang.Class({
         this._settings = Convenience.getSettings();
         this._hidden = false;
         this._hideable = this._settings.get_boolean(DOCK_HIDE_KEY);
+        this._displayMonitor = this._settings.get_int(DOCK_MONITOR_KEY);
 
         this._spacing = 4;
         this._item_size = this._settings.get_int(DOCK_SIZE_KEY);
diff --git a/extensions/dock/org.gnome.shell.extensions.dock.gschema.xml.in b/extensions/dock/org.gnome.shell.extensions.dock.gschema.xml.in
index 7f4caab..4a8b5f4 100644
--- a/extensions/dock/org.gnome.shell.extensions.dock.gschema.xml.in
+++ b/extensions/dock/org.gnome.shell.extensions.dock.gschema.xml.in
@@ -34,5 +34,10 @@
       <_summary>Autohide duration</_summary>
       <_description>Sets the time duration of the autohide effect.</_description>
     </key>
+    <key type="i" name="monitor">
+      <default>-1</default>
+      <_summary>Monitor</_summary>
+      <_description>Sets monitor to display dock in.</_description>
+    </key>
   </schema>
 </schemalist>
-- 
1.7.9.5



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