File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed
cosmic-applet-minimize/src Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -212,17 +212,27 @@ impl cosmic::Application for Minimize {
212212 return iced:: window:: maximize ( self . core . main_window_id ( ) . unwrap ( ) , true ) ;
213213 }
214214 ToplevelUpdate :: Remove ( handle) => {
215- let prev_was_empty = self . apps . is_empty ( ) ;
215+ let prev_size = self . apps . len ( ) ;
216216 self . apps
217217 . retain ( |a| a. toplevel_info . foreign_toplevel != handle) ;
218218 self . apps . shrink_to_fit ( ) ;
219- let changed = prev_was_empty != self . apps . is_empty ( ) ;
220- if self . apps . is_empty ( ) && changed {
221- // hide the window
222- return iced:: window:: minimize (
223- self . core . main_window_id ( ) . unwrap ( ) ,
224- true ,
219+ if prev_size != self . apps . len ( ) {
220+ let destroy_tooltip_task = cosmic:: task:: message (
221+ cosmic:: Action :: Cosmic ( cosmic:: app:: Action :: Surface (
222+ surface:: Action :: DestroyTooltipPopup ,
223+ ) ) ,
225224 ) ;
225+ if self . apps . is_empty ( ) {
226+ return Task :: batch ( vec ! [
227+ destroy_tooltip_task,
228+ iced:: window:: minimize(
229+ self . core. main_window_id( ) . unwrap( ) ,
230+ true ,
231+ ) ,
232+ ] ) ;
233+ } else {
234+ return destroy_tooltip_task;
235+ }
226236 }
227237 }
228238 } ,
You can’t perform that action at this time.
0 commit comments