[gnome-shell-extensions] launch-new-instance: New extension



commit b673e1624acdc2bf19f14c936f7ef56c990e0f66
Author: Gabriel Rossetti <rossetti gabriel gmail com>
Date:   Fri Jan 18 18:17:53 2013 +0100

    launch-new-instance: New extension
    
    https://bugzilla.gnome.org/show_bug.cgi?id=692030

 configure.ac                                    |    5 ++-
 extensions/launch-new-instance/Makefile.am      |    3 ++
 extensions/launch-new-instance/extension.js     |   37 +++++++++++++++++++++++
 extensions/launch-new-instance/metadata.json.in |   10 ++++++
 extensions/launch-new-instance/stylesheet.css   |    1 +
 5 files changed, 54 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 803506f..536ba3d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,7 +27,7 @@ fi
 AC_SUBST([SHELL_VERSION])
 
 dnl keep this in alphabetic order
-CLASSIC_EXTENSIONS="apps-menu places-menu alternate-tab default-min-max static-workspaces"
+CLASSIC_EXTENSIONS="apps-menu places-menu alternate-tab default-min-max launch-new-instance static-workspaces"
 DEFAULT_EXTENSIONS="$CLASSIC_EXTENSIONS alternative-status-menu drive-menu windowsNavigator workspace-indicator"
 ALL_EXTENSIONS="$DEFAULT_EXTENSIONS auto-move-windows example native-window-placement systemMonitor user-theme xrandr-indicator"
 AC_SUBST(CLASSIC_EXTENSIONS, [$CLASSIC_EXTENSIONS])
@@ -71,7 +71,7 @@ for e in $enable_extensions; do
 					[AC_MSG_WARN([gnome-desktop-3.0 not found, disabling xrandr-indicator])])
 			;;
 dnl		keep this in alphabetic order
-		alternate-tab|alternative-status-menu|apps-menu|auto-move-windows|default-min-max|drive-menu|example|native-window-placement|places-menu|static-workspaces|user-theme|windowsNavigator|workspace-indicator)
+		alternate-tab|alternative-status-menu|apps-menu|auto-move-windows|default-min-max|drive-menu|example|launch-new-instance|native-window-placement|places-menu|static-workspaces|user-theme|windowsNavigator|workspace-indicator)
 			ENABLED_EXTENSIONS="$ENABLED_EXTENSIONS $e"
 			;;
 		*)
@@ -91,6 +91,7 @@ AC_CONFIG_FILES([
   extensions/default-min-max/Makefile
   extensions/drive-menu/Makefile
   extensions/example/Makefile
+  extensions/launch-new-instance/Makefile
   extensions/native-window-placement/Makefile
   extensions/places-menu/Makefile
   extensions/static-workspaces/Makefile
diff --git a/extensions/launch-new-instance/Makefile.am b/extensions/launch-new-instance/Makefile.am
new file mode 100644
index 0000000..fe31600
--- /dev/null
+++ b/extensions/launch-new-instance/Makefile.am
@@ -0,0 +1,3 @@
+EXTENSION_ID = launch-new-instance
+
+include ../../extension.mk
diff --git a/extensions/launch-new-instance/extension.js b/extensions/launch-new-instance/extension.js
new file mode 100644
index 0000000..ea0f392
--- /dev/null
+++ b/extensions/launch-new-instance/extension.js
@@ -0,0 +1,37 @@
+const Main = imports.ui.main;
+const AppDisplay = imports.ui.appDisplay;
+
+var _onActivateOriginal = null;
+var _activateResultOriginal = null;
+
+function _onActivate(event) {
+
+  this.emit('launching');
+
+  if (this._onActivateOverride) {
+    this._onActivateOverride(event);
+  } else {
+    this.app.open_new_window(-1);
+  }
+  Main.overview.hide();
+}
+
+function _activateResult(app) {
+  app.open_new_window(-1);
+}
+
+function init() {
+}
+
+function enable() {
+  _onActivateOriginal = AppDisplay.AppWellIcon.prototype._onActivate;
+  AppDisplay.AppWellIcon.prototype._onActivate = _onActivate;
+
+  _activateResultOriginal = AppDisplay.AppSearchProvider.prototype.activateResult;
+  AppDisplay.AppSearchProvider.prototype.activateResult = _activateResult;
+}
+
+function disable() {
+  AppDisplay.AppWellIcon.prototype._onActivate = _onActivateOriginal;
+  AppDisplay.AppSearchProvider.prototype.activateResult = _activateResultOriginal;
+}
diff --git a/extensions/launch-new-instance/metadata.json.in b/extensions/launch-new-instance/metadata.json.in
new file mode 100644
index 0000000..7f740fc
--- /dev/null
+++ b/extensions/launch-new-instance/metadata.json.in
@@ -0,0 +1,10 @@
+{
+"extension-id": "@extension_id@",
+"uuid": "@uuid@",
+"settings-schema": "@gschemaname@",
+"gettext-domain": "@gettext_domain@",
+"name": "Launch new instance",
+"description": "Always launch a new instance",
+"shell-version": [ "@shell_current@" ],
+"url": "@url@"
+}
diff --git a/extensions/launch-new-instance/stylesheet.css b/extensions/launch-new-instance/stylesheet.css
new file mode 100644
index 0000000..25134b6
--- /dev/null
+++ b/extensions/launch-new-instance/stylesheet.css
@@ -0,0 +1 @@
+/* This extensions requires no special styling */



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