How to set a button setting via extension?
- From: Bazon Bloch <bazonbloch arcor de>
- To: gnome-shell-list <gnome-shell-list gnome org>
- Subject: How to set a button setting via extension?
- Date: Sat, 16 Nov 2013 06:57:13 +0100
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);
},
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]