@@ -25,10 +25,10 @@ Gettext.bindtextdomain(UUID, GLib.get_home_dir() + '/.local/share/locale');
2525
2626// Define panel positions
2727const PANEL = {
28- TOP : 0 ,
29- BOTTOM : 1 ,
30- LEFT : 2 ,
31- RIGHT : 3
28+ TOP : 0 ,
29+ BOTTOM : 1 ,
30+ LEFT : 2 ,
31+ RIGHT : 3 ,
3232} ;
3333
3434function _ ( str ) {
@@ -49,7 +49,7 @@ class MyApplet extends Applet.TextIconApplet {
4949
5050 this . initialized = false ; // some callbacks are triggered multiple times at startup without values been changed
5151 this . mouseEntered = false ;
52- this . subMenuClosedRecently = false ; // to prevent the menu from being closed after the submenus have collapsed
52+ this . subMenuClosedRecently = false ; // to prevent the menu from being closed after the submenus have collapsed
5353 this . dragging = false ;
5454 this . dragPlaceholder = null ;
5555 this . dragPlaceholderParent = null ;
@@ -69,7 +69,9 @@ class MyApplet extends Applet.TextIconApplet {
6969 this . initIcons ( ) ;
7070 this . initLabel ( ) ;
7171
72- setTimeout ( ( ) => { this . initialized = true } , 500 ) ;
72+ setTimeout ( ( ) => {
73+ this . initialized = true ;
74+ } , 500 ) ;
7375 } catch ( e ) {
7476 global . logError ( e ) ;
7577 }
@@ -110,8 +112,18 @@ class MyApplet extends Applet.TextIconApplet {
110112 this . signalManager . connect ( this . actor , 'enter-event' , this . onMouseEnter , this ) ;
111113 this . signalManager . connect ( this . actor , 'leave-event' , this . onMouseLeave , this ) ;
112114
113- this . signalManager . connect ( this . menu , 'open-state-changed' , this . on_menu_state_changed , this ) ;
114- this . signalManager . connect ( global . window_manager , 'switch-workspace' , this . updateWorkspace , this ) ;
115+ this . signalManager . connect (
116+ this . menu ,
117+ 'open-state-changed' ,
118+ this . on_menu_state_changed ,
119+ this
120+ ) ;
121+ this . signalManager . connect (
122+ global . window_manager ,
123+ 'switch-workspace' ,
124+ this . updateWorkspace ,
125+ this
126+ ) ;
115127 this . signalManager . connect ( global . screen , 'workspace-added' , this . initWorkspaces , this ) ;
116128 this . signalManager . connect ( global . screen , 'workspace-removed' , this . initWorkspaces , this ) ;
117129 }
@@ -131,12 +143,15 @@ class MyApplet extends Applet.TextIconApplet {
131143 options [ _ ( 'All workspaces' ) ] = '-1' ;
132144 this . workspaces = new Array ( global . screen . get_n_workspaces ( ) ) ;
133145 for ( let i = 0 ; i < this . workspaces . length ; i ++ ) {
134- let workspaceName = Main . getWorkspaceName ( i )
146+ let workspaceName = Main . getWorkspaceName ( i ) ;
135147 this . workspaces [ i ] = workspaceName ;
136148 options [ workspaceName ] = '' + i ;
137149 }
138150 this . settings . setOptions ( 'bind-to-workspace' , options ) ;
139- if ( this . bindToWorkspace !== '-1' && this . workspaces [ parseInt ( this . bindToWorkspace ) ] === undefined ) {
151+ if (
152+ this . bindToWorkspace !== '-1' &&
153+ this . workspaces [ parseInt ( this . bindToWorkspace ) ] === undefined
154+ ) {
140155 this . settings . setValue ( 'bind-to-workspace' , '-1' ) ;
141156 }
142157
@@ -461,7 +476,7 @@ class MyApplet extends Applet.TextIconApplet {
461476 }
462477
463478 onMouseEnter ( event ) {
464- if ( ! this . openByHover ) return
479+ if ( ! this . openByHover ) return ;
465480 this . mouseEntered = true ;
466481 this . subMenuClosedRecently = false ;
467482
@@ -480,7 +495,7 @@ class MyApplet extends Applet.TextIconApplet {
480495 }
481496
482497 onMouseLeave ( event ) {
483- if ( ! this . openByHover ) return
498+ if ( ! this . openByHover ) return ;
484499 this . mouseEntered = false ;
485500
486501 this . leaveTimeoutID = setTimeout ( ( ) => {
@@ -494,12 +509,14 @@ class MyApplet extends Applet.TextIconApplet {
494509 }
495510
496511 checkMouseEntered ( ) {
497- if ( this . openByHover &&
512+ if (
513+ this . openByHover &&
498514 this . menu . isOpen &&
499515 ! this . menu . isContextOpen &&
500- ! this . mouseEntered &&
501- ! this . subMenuClosedRecently ) {
502- this . menu . close ( ) ;
516+ ! this . mouseEntered &&
517+ ! this . subMenuClosedRecently
518+ ) {
519+ this . menu . close ( ) ;
503520 }
504521 }
505522
@@ -624,7 +641,7 @@ class MyPopupMenu extends Applet.AppletPopupMenu {
624641 _init ( applet , orientation ) {
625642 try {
626643 super . _init ( applet , orientation ) ;
627-
644+
628645 this . applet = applet ;
629646 this . _menuAppItems = [ ] ;
630647 this . _menuGroupItems = [ ] ;
@@ -659,7 +676,7 @@ class MyPopupMenu extends Applet.AppletPopupMenu {
659676 }
660677 }
661678
662- _allocationChanged ( actor , pspec ) {
679+ _allocationChanged ( actor , pspec ) {
663680 if ( this . hotkeyTriggered ) {
664681 let posX = this . pointerX ;
665682 let posY = this . pointerY ;
@@ -675,25 +692,37 @@ class MyPopupMenu extends Applet.AppletPopupMenu {
675692 const panels = Main . panelManager . getPanelsInMonitor ( monitorIndex ) ;
676693 for ( const panel of panels ) {
677694 if ( ! panel . _hidden ) {
678- panelHeight [ panel . panelPosition ] = panel . height
695+ panelHeight [ panel . panelPosition ] = panel . height ;
679696 }
680697 }
681698
682699 if ( this . actorPlaced ) {
683700 // // Ensure the actor fits within the monitor's width and height
684- posX = Math . min ( posX , monitor . x + monitor . width - this . actor . width - panelHeight [ PANEL . RIGHT ] ) ;
685- posY = Math . min ( posY , monitor . y + monitor . height - this . actor . height - panelHeight [ PANEL . BOTTOM ] ) ;
701+ posX = Math . min (
702+ posX ,
703+ monitor . x + monitor . width - this . actor . width - panelHeight [ PANEL . RIGHT ]
704+ ) ;
705+ posY = Math . min (
706+ posY ,
707+ monitor . y + monitor . height - this . actor . height - panelHeight [ PANEL . BOTTOM ]
708+ ) ;
686709 } else {
687710 // Adjust X position to fit within the monitor, considering left and right panels
688- if ( posX - monitor . x + this . actor . width > monitor . width - panelHeight [ PANEL . RIGHT ] ) {
711+ if (
712+ posX - monitor . x + this . actor . width >
713+ monitor . width - panelHeight [ PANEL . RIGHT ]
714+ ) {
689715 posX -= this . actor . width ;
690716 }
691717 if ( posX < monitor . x + panelHeight [ PANEL . LEFT ] ) {
692718 posX = monitor . x + panelHeight [ PANEL . LEFT ] ;
693719 }
694720
695721 // Adjust Y position to fit within the monitor, considering top and bottom panels
696- if ( posY - monitor . y + this . actor . height > monitor . height - panelHeight [ PANEL . BOTTOM ] ) {
722+ if (
723+ posY - monitor . y + this . actor . height >
724+ monitor . height - panelHeight [ PANEL . BOTTOM ]
725+ ) {
697726 posY -= this . actor . height ;
698727 }
699728 if ( posY < monitor . y + panelHeight [ PANEL . TOP ] ) {
@@ -703,14 +732,18 @@ class MyPopupMenu extends Applet.AppletPopupMenu {
703732 // Update pointer positions and mark menu as placed
704733 this . pointerX = posX ;
705734 this . pointerY = posY ;
706- this . actorPlaced = true
735+ this . actorPlaced = true ;
707736 }
708737
709738 this . actor . set_position ( posX , posY ) ;
710- return
711- } ;
712-
713- if ( ! this . animating && ! this . sourceActor . is_finalized ( ) && this . sourceActor . get_stage ( ) != null ) {
739+ return ;
740+ }
741+
742+ if (
743+ ! this . animating &&
744+ ! this . sourceActor . is_finalized ( ) &&
745+ this . sourceActor . get_stage ( ) != null
746+ ) {
714747 let [ xPos , yPos ] = this . _calculatePosition ( ) ;
715748 this . actor . set_position ( xPos , yPos ) ;
716749 }
@@ -856,7 +889,7 @@ class MyPopupMenu extends Applet.AppletPopupMenu {
856889 }
857890
858891 onMouseEnter ( event ) {
859- if ( ! this . applet . openByHover ) return
892+ if ( ! this . applet . openByHover ) return ;
860893 this . applet . mouseEntered = true ;
861894 this . applet . subMenuClosedRecently = false ;
862895
@@ -867,7 +900,7 @@ class MyPopupMenu extends Applet.AppletPopupMenu {
867900 }
868901
869902 onMouseLeave ( event ) {
870- if ( ! this . applet . openByHover ) return
903+ if ( ! this . applet . openByHover ) return ;
871904 this . applet . mouseEntered = false ;
872905
873906 this . leaveTimeoutID = setTimeout ( ( ) => {
@@ -980,7 +1013,7 @@ class MyPopupSubMenuItem extends PopupMenu.PopupSubMenuMenuItem {
9801013
9811014 this . _children . unshift ( params ) ;
9821015 this . _signals . connect ( this . actor , 'destroy' , this . _removeChild . bind ( this , this . _icon ) ) ;
983-
1016+
9841017 this . actor . add_actor ( this . _icon ) ;
9851018 }
9861019
@@ -1153,7 +1186,7 @@ class MyPopupSubMenuItem extends PopupMenu.PopupSubMenuMenuItem {
11531186 let button = new St . Icon ( {
11541187 name : name ,
11551188 gicon : Gio . Icon . new_for_string (
1156- `${ this . applet . metadata . path } /icons/${ name } -symbolic.svg`
1189+ `${ this . applet . metadata . path } /../ icons/${ name } -symbolic.svg`
11571190 ) ,
11581191 icon_size : this . iconSize ,
11591192 icon_type : St . IconType . SYMBOLIC ,
@@ -1178,8 +1211,8 @@ class MyPopupSubMenuItem extends PopupMenu.PopupSubMenuMenuItem {
11781211 }
11791212
11801213 onMouseEnter ( event ) {
1181- if ( ! this . applet . openByHover ) return
1182-
1214+ if ( ! this . applet . openByHover ) return ;
1215+
11831216 if ( ! this . menu . isOpen && ! this . hoverTimeoutID ) {
11841217 this . hoverTimeoutID = setTimeout ( ( ) => {
11851218 if ( ! this . applet . menu . isContextOpen ) {
@@ -1195,7 +1228,7 @@ class MyPopupSubMenuItem extends PopupMenu.PopupSubMenuMenuItem {
11951228 }
11961229
11971230 onMouseLeave ( event ) {
1198- if ( ! this . applet . openByHover ) return
1231+ if ( ! this . applet . openByHover ) return ;
11991232
12001233 if ( this . hoverTimeoutID ) {
12011234 clearTimeout ( this . hoverTimeoutID ) ;
@@ -1466,7 +1499,7 @@ class MyPopupMenuItem extends PopupMenu.PopupIconMenuItem {
14661499 let button = new St . Icon ( {
14671500 name : name ,
14681501 gicon : Gio . Icon . new_for_string (
1469- `${ this . applet . metadata . path } /icons/${ name } -symbolic.svg`
1502+ `${ this . applet . metadata . path } /../ icons/${ name } -symbolic.svg`
14701503 ) ,
14711504 icon_size : this . iconSize ,
14721505 icon_type : St . IconType . SYMBOLIC ,
0 commit comments