Re: How to set a button setting via extension?



maybe this one: https://extensions.gnome.org/extension/5/alternative-status-menu/


Am 16.11.2013 06:57, schrieb Bazon Bloch:
Hello,

in /usr/share/gnome-shell/js/ui/status/system.js I prefer to have
        this._altSwitcher = new AltSwitcher(this._suspendAction, this._powerOffAction);
in line 352 instead of the default
        this._altSwitcher = new AltSwitcher(this._powerOffAction, this._suspendAction);

as my switching of that setting breaks with every Gnome-Shell update, I'd like to have that set by an extension.
My problems starting this are:

1. IMHO, the cleanest way would be to address that button and change its settings. But:
    (a) what does "this" stands for here? I tried PanelMenu.SystemIndicator._altSwitcher (with PanelMenu = imports.ui.panelMenu), but didn't reach it that way.
    (b) Is there a way at all to change from (this._powerOffAction, this._suspendAction) to (this._suspendAction, this._powerOffAction) for an existing button?

2. If 1 doesn't work, what would be the best way?
    (a) Try to monkeypatch the _createSubMenu() function in the indicator class? or
    (b) Remove the old button and create a new one in its place instead? (how?)

thanks,
Bazon

reference:
I'm talking about /usr/share/gnome-shell/js/ui/status/system.js:
....
const PanelMenu = imports.ui.panelMenu;
...
const Indicator = new Lang.Class({
    Name: 'SystemIndicator',
    Extends: PanelMenu.SystemIndicator,

    _createSubMenu: function() {
        let item;
        ...
        item = new PopupMenu.PopupBaseMenuItem({ reactive: false,
                                                 can_focus: false });
        ...

        this._suspendAction = this._createActionButton('media-playback-pause-symbolic', _("Suspend"));
        this._suspendAction.connect('clicked', Lang.bind(this, this._onSuspendClicked));

        this._powerOffAction = this._createActionButton('system-shutdown-symbolic', _("Power Off"));
        this._powerOffAction.connect('clicked', Lang.bind(this, this._onPowerOffClicked));

        this._altSwitcher = new AltSwitcher(this._suspendAction, this._powerOffAction);
        item.actor.add(this._altSwitcher.actor, { expand: true, x_fill: false });

        this._actionsItem = item;
        this.menu.addMenuItem(item);
    },
});


_______________________________________________
gnome-shell-list mailing list
gnome-shell-list gnome org
https://mail.gnome.org/mailman/listinfo/gnome-shell-list


-- 
00:56 <soreau> Maybe Canonical is just a division of Microsoft hired to try and take down Linux
00:56 <RAOF> Our secret is out!!!!!111111


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