Fedora Linux Support Community & Resources Center
Prev Previous Post   Next Post Next
  #1  
Old 8th February 2012, 03:01 AM
HMSS013 Offline
Registered User
 
Join Date: Nov 2006
Posts: 511
linuxfirefox
Turn AutoHide Shell Extension "Upside-Down"

is it possibly to tweak FP Murphys AutoHide Gnome Shell extension to work with Reflection?

...just to tweak the code so it hides downward instead of upward? so it can be used at the bottom of the screen...

Code:
//
//  Copyright (c) 2011 Finnbarr P. Murphy.  All rights reserved.
//
//

const Lang = imports.lang;
const Shell = imports.gi.Shell;
const St = imports.gi.St;
const Main = imports.ui.main;
const Tweener = imports.ui.tweener;

// change these to suit your own tastes and your system
const PANEL_HEIGHT = 25;
const AUTOHIDE_ANIMATION_TIME = 0.4;
const TIME_DELTA = 1500;


function AutoHide() {
    this._init()
}
 
AutoHide.prototype = {
    _init: function() {
        this._buttonEvent = 0;
        this._leaveEvent = 0;
        this._enterEvent = 0;

        this._hidden = false;
        this._hidetime = 0;
        this._hideable = true;
    },

    _hidePanel: function() {
        if (Main.overview.visible || this._hideable == false) return;

        Tweener.addTween(Main.panel.actor,
                     { height: 1,
                       time: AUTOHIDE_ANIMATION_TIME,
                       transition: 'easeOutQuad'
                     });

        let params = { y: 0,
                       time: AUTOHIDE_ANIMATION_TIME,
                       transition: 'easeOutQuad'
                     };

        Tweener.addTween(Main.panel._leftCorner.actor, params);
        Tweener.addTween(Main.panel._rightCorner.actor, params);

        params = { opacity: 0,
                   time: AUTOHIDE_ANIMATION_TIME - 0.1,
                   transition: 'easeOutQuad'
                 };

        Tweener.addTween(Main.panel._leftBox, params);
        Tweener.addTween(Main.panel._centerBox, params);
        Tweener.addTween(Main.panel._rightBox, params);

        this._hidden = true;
    },

    _showPanel: function() {
        if (this._hidden == false) return;

        let params = { y: PANEL_HEIGHT - 1,
                       time: AUTOHIDE_ANIMATION_TIME + 0.1,
                       transition: 'easeOutQuad'
                     };
 
        Tweener.addTween(Main.panel._leftCorner.actor, params);
        Tweener.addTween(Main.panel._rightCorner.actor, params);

        Tweener.addTween(Main.panel.actor,
                     { height: PANEL_HEIGHT,
                       time: AUTOHIDE_ANIMATION_TIME,
                       transition: 'easeOutQuad'
                     });

        params = { opacity: 255,
                   time: AUTOHIDE_ANIMATION_TIME+0.2,
                   transition: 'easeOutQuad'
                 };

        Tweener.addTween(Main.panel._leftBox, params);
        Tweener.addTween(Main.panel._centerBox, params);
        Tweener.addTween(Main.panel._rightBox, params);

        this._hidden = false;
    },

    _toggleChrome: function(bool) {
        let mlm = Main.layoutManager;
        mlm.removeChrome(mlm.panelBox);
        mlm.addChrome(mlm.panelBox, { affectsStruts: bool });
    },

    _toggleHideable: function(actor, event) {
        let ticks = event.get_time();
 
        if (this._hidetime == 0) {
            this._hidetime = ticks;
            return;
        }

        if ((ticks - this._hidetime) > TIME_DELTA) {
            this._hidetime = 0;
            return;
        }

        if (this._hideable == true) {
            this._hideable = false;
            this._toggleChrome(true);
        } else {
            this._hideable = true;
            this._toggleChrome(false);
        }

        this._hidetime = 0;
    },
 
    enable: function() {
        this._leaveEvent = Main.panel.actor.connect('leave-event', 
                                Lang.bind(Main.panel, this._hidePanel));
        this._enterEvent = Main.panel.actor.connect('enter-event', 
                                Lang.bind(Main.panel, this._showPanel));
        this._buttonEvent = Main.panel.actor.connect('button-release-event', 
                                Lang.bind(Main.panel, this._toggleHideable));

        this._toggleChrome(false);
        this._hideable = true;
        this._hidePanel();
    },
 
    disable: function() {
        if (this._buttonEvent) {
            Main.panel.actor.disconnect(this._buttonEvent);
            this._buttonEvent = 0;
        }
        if (this._leaveEvent) {
            Main.panel.actor.disconnect(this._leaveEvent);
            this._leaveEvent = 0;
        }
        if (this._enterEvent) {
            Main.panel.actor.disconnect(this._enterEvent);
            this._enterEvent = 0;
        }

        this._toggleChrome(true);
        this._hideable = true;
        this._showPanel();
    }

};
 
function init() {
    return new AutoHide();
}
Reply With Quote
 

Tags
autohide, extension, shell, turn, upsidedown

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Metacity and "Xlib: extension "SHAPE" missing on display ":0.0". debu_sagii Using Fedora 0 29th August 2007 05:53 PM
xlib:extension "xfree86-misc" missing on display ":0:0" Sicily1918 Using Fedora 4 3rd January 2007 08:30 PM
Fglrx driver install - "direct rendering: No", Xlib: extension "XFree86-DRI" missing Squeaks Hardware & Laptops 9 21st October 2006 12:10 PM
error message say; Xlib: extension "XFree86-DRI" missing on display ":0.0". sturmkim Using Fedora 3 1st October 2006 04:40 AM
error: Xlib: extension "XFree86-DRI" missing on display ":0.0" ride153 Using Fedora 9 18th April 2005 02:10 PM


Current GMT-time: 09:07 (Friday, 31-10-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Suratgarh Instagram Photos - Hatfield - Bangui Travel Photos on Instagram