-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9721709
commit ee5a187
Showing
4 changed files
with
85 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const GObject = imports.gi.GObject; | ||
const PanelMenu = imports.ui.panelMenu; | ||
const Main = imports.ui.main; | ||
|
||
const AggregateMenu = Main.panel.statusArea.aggregateMenu; | ||
|
||
const SystemMenu = GObject.registerClass( | ||
class SystemMenu extends PanelMenu.SystemIndicator { | ||
|
||
_init() { | ||
super._init(); | ||
|
||
// Create extension's sub menu | ||
this.subMenu = new PopupMenu.PopupSubMenuMenuItem(Me.metadata.name, true); | ||
this.subMenu.icon.gicon = extensionIcon; | ||
|
||
// Places the extension's sub menu after the battery sub menu if it exists, | ||
// otherwise places the extension's sub menu at the first spot. (Change later? First spot might be bad idea) | ||
const menuItems = AggregateMenu.menu._getMenuItems(); | ||
const subMenuIndex = AggregateMenu._power ? (menuItems.indexOf(AggregateMenu._power.menu) + 1) : 0; | ||
AggregateMenu.menu.addMenuItem(this.subMenu, subMenuIndex); | ||
|
||
addOptionsToMenu(this.subMenu.menu); | ||
} | ||
|
||
destroy() { | ||
this.subMenu.destroy(); | ||
super.destroy(); | ||
} | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const GObject = imports.gi.GObject; | ||
const Main = imports.ui.main; | ||
|
||
const UIQuickSettings = imports.ui.quickSettings; | ||
const QuickSettingsMenu = Main.panel.statusArea.quickSettings; // GNOME 43 System Menu | ||
|
||
const SystemMenu = GObject.registerClass( | ||
class QSystemMenu extends UIQuickSettings.SystemIndicator { | ||
|
||
_init() { | ||
super._init(); | ||
|
||
// Create extension's sub menu | ||
this.toggleMenu = new UIQuickSettings.QuickMenuToggle({ | ||
label: "IdeaPad", // Not enough space for full name :( | ||
gicon: extensionIcon | ||
}); | ||
|
||
this.toggleMenu.menu.setHeader(extensionIcon, Me.metadata.name); | ||
|
||
// Since this "toggle" menu isn't being used as a toggle button | ||
// clicking should just open the menu. | ||
this.toggleMenu.connect("clicked", () => { | ||
this.toggleMenu.menu.open(); | ||
}) | ||
|
||
QuickSettingsMenu.menu.addItem(this.toggleMenu); | ||
|
||
addOptionsToMenu(this.toggleMenu.menu); | ||
} | ||
|
||
destroy() { | ||
this.toggleMenu.destroy(); | ||
super.destroy(); | ||
} | ||
} | ||
); |