@@ -143,7 +143,14 @@ class LGS extends Applet.IconApplet {
143143 } ) ;
144144 itemWatchXSE . connect (
145145 "activate" ,
146- ( ) => Util . spawnCommandLineAsync ( "bash -c '" + WATCHXSE_SCRIPT + "'" )
146+ ( ) => {
147+ if ( this . menu . isOpen ) this . menu . close ( ) ;
148+ let to = setTimeout ( ( ) => {
149+ Util . spawnCommandLineAsync ( "bash -c '" + WATCHXSE_SCRIPT + "'" ) ;
150+ clearTimeout ( to ) ;
151+ } ,
152+ 300 ) ;
153+ }
147154 ) ;
148155
149156 this . menu . addMenuItem ( itemWatchXSE ) ;
@@ -156,7 +163,11 @@ class LGS extends Applet.IconApplet {
156163 "activate" ,
157164 ( ) => {
158165 if ( this . menu . isOpen ) this . menu . close ( ) ;
159- restartCinnamon ( true )
166+ let to = setTimeout ( ( ) => {
167+ restartCinnamon ( true ) ;
168+ clearTimeout ( to ) ;
169+ } ,
170+ 300 ) ;
160171 }
161172 ) ;
162173
@@ -178,7 +189,11 @@ class LGS extends Applet.IconApplet {
178189 } ) ;
179190 s . connect ( "activate" , ( ) => {
180191 if ( this . menu . isOpen ) this . menu . close ( ) ;
181- reloadExtension ( applet , Type . APPLET )
192+ let to = setTimeout ( ( ) => {
193+ reloadExtension ( applet , Type . APPLET ) ;
194+ clearTimeout ( to ) ;
195+ } ,
196+ 300 ) ;
182197 } ) ;
183198 this . subMenuReloadApplets . menu . addMenuItem ( s )
184199 }
@@ -193,7 +208,11 @@ class LGS extends Applet.IconApplet {
193208 } ) ;
194209 s . connect ( "activate" , ( ) => {
195210 if ( this . menu . isOpen ) this . menu . close ( ) ;
196- reloadExtension ( desklet , Type . DESKLET )
211+ let to = setTimeout ( ( ) => {
212+ reloadExtension ( desklet , Type . DESKLET ) ;
213+ clearTimeout ( to ) ;
214+ } ,
215+ 300 ) ;
197216 } ) ;
198217 this . subMenuReloadDesklets . menu . addMenuItem ( s )
199218 }
@@ -208,7 +227,11 @@ class LGS extends Applet.IconApplet {
208227 } ) ;
209228 s . connect ( "activate" , ( ) => {
210229 if ( this . menu . isOpen ) this . menu . close ( ) ;
211- reloadExtension ( extension , Type . EXTENSION )
230+ let to = setTimeout ( ( ) => {
231+ reloadExtension ( extension , Type . EXTENSION ) ;
232+ clearTimeout ( to ) ;
233+ } ,
234+ 300 ) ;
212235 } ) ;
213236 this . subMenuReloadExtensions . menu . addMenuItem ( s )
214237 }
@@ -229,7 +252,11 @@ class LGS extends Applet.IconApplet {
229252 } ) ;
230253 s . connect ( "activate" , ( ) => {
231254 if ( this . menu . isOpen ) this . menu . close ( ) ;
232- Util . spawnCommandLineAsync ( 'bash -c "cinnamon-settings applets %s"' . format ( applet ) )
255+ let to = setTimeout ( ( ) => {
256+ Util . spawnCommandLineAsync ( 'bash -c "cinnamon-settings applets %s"' . format ( applet ) ) ;
257+ clearTimeout ( to ) ;
258+ } ,
259+ 300 ) ;
233260 } ) ;
234261 this . subMenuSettingsApplets . menu . addMenuItem ( s )
235262 }
@@ -244,7 +271,11 @@ class LGS extends Applet.IconApplet {
244271 } ) ;
245272 s . connect ( "activate" , ( ) => {
246273 if ( this . menu . isOpen ) this . menu . close ( ) ;
247- Util . spawnCommandLineAsync ( 'bash -c "cinnamon-settings desklets %s"' . format ( desklet ) )
274+ let to = setTimeout ( ( ) => {
275+ Util . spawnCommandLineAsync ( 'bash -c "cinnamon-settings desklets %s"' . format ( desklet ) ) ;
276+ clearTimeout ( to ) ;
277+ } ,
278+ 300 ) ;
248279 } ) ;
249280 this . subMenuSettingsDesklets . menu . addMenuItem ( s )
250281 }
@@ -259,7 +290,11 @@ class LGS extends Applet.IconApplet {
259290 } ) ;
260291 s . connect ( "activate" , ( ) => {
261292 if ( this . menu . isOpen ) this . menu . close ( ) ;
262- Util . spawnCommandLineAsync ( 'bash -c "cinnamon-settings extensions %s"' . format ( extension ) )
293+ let to = setTimeout ( ( ) => {
294+ Util . spawnCommandLineAsync ( 'bash -c "cinnamon-settings extensions %s"' . format ( extension ) ) ;
295+ clearTimeout ( to ) ;
296+ } ,
297+ 300 ) ;
263298 } ) ;
264299 this . subMenuSettingsExtensions . menu . addMenuItem ( s )
265300 }
@@ -280,7 +315,11 @@ class LGS extends Applet.IconApplet {
280315 } ) ;
281316 s . connect ( "activate" , ( ) => {
282317 if ( this . menu . isOpen ) this . menu . close ( ) ;
283- Util . spawnCommandLineAsync ( 'bash -c "xdg-open %s/applets/%s/"' . format ( SPICES_DIR , applet ) )
318+ let to = setTimeout ( ( ) => {
319+ Util . spawnCommandLineAsync ( 'bash -c "xdg-open %s/applets/%s/"' . format ( SPICES_DIR , applet ) ) ;
320+ clearTimeout ( to ) ;
321+ } ,
322+ 300 ) ;
284323 } ) ;
285324 this . subMenuCodeApplets . menu . addMenuItem ( s )
286325 }
@@ -295,7 +334,11 @@ class LGS extends Applet.IconApplet {
295334 } ) ;
296335 s . connect ( "activate" , ( ) => {
297336 if ( this . menu . isOpen ) this . menu . close ( ) ;
298- Util . spawnCommandLineAsync ( 'bash -c "xdg-open %s/desklets/%s/"' . format ( SPICES_DIR , desklet ) )
337+ let to = setTimeout ( ( ) => {
338+ Util . spawnCommandLineAsync ( 'bash -c "xdg-open %s/desklets/%s/"' . format ( SPICES_DIR , desklet ) ) ;
339+ clearTimeout ( to ) ;
340+ } ,
341+ 300 ) ;
299342 } ) ;
300343 this . subMenuCodeDesklets . menu . addMenuItem ( s )
301344 }
@@ -310,15 +353,24 @@ class LGS extends Applet.IconApplet {
310353 } ) ;
311354 s . connect ( "activate" , ( ) => {
312355 if ( this . menu . isOpen ) this . menu . close ( ) ;
313- Util . spawnCommandLineAsync ( 'bash -c "xdg-open %s/extensions/%s/"' . format ( SPICES_DIR , extension ) )
356+ let to = setTimeout ( ( ) => {
357+ Util . spawnCommandLineAsync ( 'bash -c "xdg-open %s/extensions/%s/"' . format ( SPICES_DIR , extension ) ) ;
358+ clearTimeout ( to ) ;
359+ } ,
360+ 300 ) ;
314361 } ) ;
315362 this . subMenuCodeExtensions . menu . addMenuItem ( s )
316363 }
317364
318365 } ; // End of makeMenu
319366
320367 on_applet_middle_clicked ( event ) {
321- Util . spawnCommandLineAsync ( "bash -c '" + WATCHXSE_SCRIPT + "'" )
368+ if ( this . menu . isOpen ) this . menu . close ( ) ;
369+ let to = setTimeout ( ( ) => {
370+ Util . spawnCommandLineAsync ( "bash -c '" + WATCHXSE_SCRIPT + "'" ) ;
371+ clearTimeout ( to ) ;
372+ } ,
373+ 300 ) ;
322374 }
323375} // End of class LGS
324376
0 commit comments