-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathextension.js
More file actions
27 lines (23 loc) · 1.04 KB
/
extension.js
File metadata and controls
27 lines (23 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import * as Extension from 'resource:///org/gnome/shell/extensions/extension.js';
import * as TopBarView from './ui/TopBarView.js';
import * as QuickSettingsView from './ui/QuickSettingsView.js';
export default class GpuSelector extends Extension.Extension {
enable() {
let all_settings = this.getSettings();
if (all_settings.get_boolean("force-topbar-view") !== true) {
this._indicator = new QuickSettingsView.QuickSettingsIndicator(this);
this._indicator.quickSettingsItems.push(new QuickSettingsView.QuickSettingsToggle(this));
Main.panel.statusArea.quickSettings.addExternalIndicator(this._indicator);
} else {
this._indicator = new TopBarView.TopBarView(this);
Main.panel.addToStatusArea("GPU_SELECTOR", this._indicator, 1);
}
this._indicator.enable();
}
disable() {
this._indicator.disable();
this._indicator.destroy();
this._indicator = null;
}
}