Results 1 to 6 of 6

Thread: How to modify a Gnome Shell Extension?

  1. #1
    Join Date
    Mar 2006
    Location
    europe/germany
    Beans
    230
    Distro
    Ubuntu 12.04 Precise Pangolin

    How to modify a Gnome Shell Extension?

    Hello!

    I'd like prevent Gnome-Shell from changing the workspace when clicking on an icon in the applauncher when a window is opened on another workspace. I'd prefer to have a new window on the momentary workspace instead.

    A step to that could be the Dash Click Fix Extension:
    With that extension, a click on the applauncher always opens a new window.

    So my question is:
    How is it possible to open a new window only, when there is no window from this program on the current workspace?

    Momentary, the code for the extension is this (stored in ~/.local/share/gnome-shell/extensions/DashClickFix@evotex.ch):
    Code:
    /**
     * Desc: this extension "fixes" the dash's default behavior when you 
     *       click on an icon. The defualt is to launch the app if none is 
     *       running and to switch to the current instance if it is already 
     *       running. This extension changes that to instead of switching to 
     *       it if it is already running it always launches a new instance.
     * 
     * Author: Gabriel Rossetti
     * Date: 2011-12-08
     * Version: 1.0
     */
    const Main = imports.ui.main;
    const AppDisplay = imports.ui.appDisplay;
    const Shell = imports.gi.Shell;
    const Clutter = imports.gi.Clutter;
    
    
    var _original = null;
    
    /**
     * The new version of the function, this always lanches a new version of 
     * the app regardless of if it is already running or not.
     * 
     * @param event the current event
     */
    function _onActivate(event) {
      this.emit('launching');
    
      if (this._onActivateOverride) {
        this._onActivateOverride(event);
      } else {
        this.app.open_new_window(-1);
      }
      Main.overview.hide();
    }
    
    /**
     * Initialize the extension
     */
    function init() {
      _original = AppDisplay.AppWellIcon.prototype._onActivate;
    }
    
    /**
     * Enable the extension
     */
    function enable() {
      AppDisplay.AppWellIcon.prototype._onActivate = _onActivate;
    }
    
    /**
     * Disable the extension
     */
    function disable() {
      
      AppDisplay.AppWellIcon.prototype._onActivate = _original;
    }
    Has anybody an idea?
    How to modify or how to find out how to modify?
    I got no experience in writing Gnome-Shell-Extensions so far.

    Thanks!
    Last edited by Bazon; June 10th, 2012 at 12:24 PM.

  2. #2
    Join Date
    Mar 2006
    Location
    europe/germany
    Beans
    230
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How to modify a Gnome Shell Extension?

    No one has an idea?

  3. #3
    Join Date
    Mar 2006
    Location
    europe/germany
    Beans
    230
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How to modify a Gnome Shell Extension?

    Not even an idea where else to ask?
    or a link where to start reading?

  4. #4
    Join Date
    Jun 2006
    Location
    Brisbane Australia
    Beans
    713

    Re: How to modify a Gnome Shell Extension?

    I've played around with my own gnome-shell extensions and I just started at the recommended place which is https://live.gnome.org/GnomeShell/Extensions and then followed the links from there, particularly Finbarr Murphy's "Musings" posts referenced there.

  5. #5
    Join Date
    Mar 2006
    Location
    europe/germany
    Beans
    230
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How to modify a Gnome Shell Extension?

    Thank you very much!
    I'll see, where I can get with that...

  6. #6
    Join Date
    Mar 2006
    Location
    europe/germany
    Beans
    230
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How to modify a Gnome Shell Extension?

    It took some time to get started, but following the links here, looking in other Gnome-Shell-Extensions (in ~/.local/share/gnome-shell/extensions/) and in Gnome-Shell's original Code (in /usr/share/gnome-shell/js/ui) I'm ready now:

    https://extensions.gnome.org/extensi...ation-on-dash/

    It's for Gnome-Shell 3.4, if you want to try it on another Version of Gnome-Shell, just send me a PM, I'm also interested in knowing on which Versions it works.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •