@@ -7,7 +7,7 @@ import St from 'gi://St' // eslint-disable-line no-unused-vars
77import { Button as PanelMenuButton } from 'resource:///org/gnome/shell/ui/panelMenu.js'
88import { PopupSeparatorMenuItem } from 'resource:///org/gnome/shell/ui/popupMenu.js'
99import { trySpawnCommandLine } from 'resource:///org/gnome/shell/misc/util.js'
10- import { Extension , gettext as _ } from 'resource:///org/gnome/shell/extensions/extension.js'
10+ import { gettext as _ } from 'resource:///org/gnome/shell/extensions/extension.js'
1111
1212import {
1313 SYSTEM_MONITOR_COMMAND ,
@@ -66,12 +66,10 @@ export default class RunCatIndicator extends PanelMenuButton {
6666 GObject . registerClass ( this )
6767 }
6868
69- get extension ( ) {
70- return Extension . lookupByURL ( import . meta. url )
71- }
69+ #extension = null
7270
7371 /** @type {Gio.Settings } */
74- #gioSettings = this . extension . getSettings ( )
72+ #gioSettings
7573
7674 /** @type {{ icon: St.Icon, label: St.Label, labelBox: St.BoxLayout, box: St.BoxLayout } } */
7775 #widgets
@@ -94,9 +92,12 @@ export default class RunCatIndicator extends PanelMenuButton {
9492 /** @type {{ idle: Generator, active: Generator } } */
9593 #icons
9694
97- constructor ( ) {
95+ constructor ( extension ) {
9896 super ( null )
9997
98+ this . #extension = extension
99+ this . #gioSettings = this . #extension. getSettings ( )
100+
100101 this . #initSettingsListeners( )
101102 this . #initUi( )
102103 this . #initIcons( )
@@ -128,17 +129,17 @@ export default class RunCatIndicator extends PanelMenuButton {
128129
129130 #initIcons( ) {
130131 this . #icons = {
131- idle : spritesGenerator ( this . extension . path , 'idle' ) ,
132- active : spritesGenerator ( this . extension . path , 'active' ) ,
132+ idle : spritesGenerator ( this . # extension. path , 'idle' ) ,
133+ active : spritesGenerator ( this . # extension. path , 'active' ) ,
133134 }
134135
135136 const [ sprite ] = this . #icons. idle . next ( ) . value
136137 this . #widgets. icon . set_gicon ( sprite )
137138 }
138139
139140 #initUi( ) {
140- this . #builder = new Gtk . Builder ( { translation_domain : this . extension . uuid } )
141- this . #builder. add_from_file ( `${ this . extension . path } /resources/ui/extension.ui` )
141+ this . #builder = new Gtk . Builder ( { translation_domain : this . # extension. uuid } )
142+ this . #builder. add_from_file ( `${ this . # extension. path } /resources/ui/extension.ui` )
142143
143144 this . #widgets = {
144145 icon : /** @type {St.Icon } */ ( this . #builder. get_object ( 'icon' ) ) ,
@@ -163,7 +164,7 @@ export default class RunCatIndicator extends PanelMenuButton {
163164 this . menu . addMenuItem ( new PopupSeparatorMenuItem ( ) )
164165 this . menu . addAction ( _ ( 'Settings' ) , ( ) => {
165166 try {
166- this . extension . openPreferences ( )
167+ this . # extension. openPreferences ( )
167168 } catch ( e ) {
168169 logError ( e )
169170 }
0 commit comments