///| Show the desktop (Super+D by default; the shortcut lives in the shortcut table). /// /// Minimizes every visible window of the active workspace and remembers them; the shortcut again /// (while nothing is on screen) brings them back in their old stacking order with the one that /// was on top focused. Opening or restoring a window in between starts over: the next time /// clears the screen again. Neither the key press nor its release reaches a client. ///| /// evdev codes of the Super keys. let key_lsuper : UInt32 = 125 ///| let key_rsuper : UInt32 = 126 ///| /// Minimize all visible windows of the active workspace, or restore the ones Super+D hid. pub fn ChandraCompositor::toggle_show_desktop( self : ChandraCompositor, ) -> Unit { let visible = self.wm.stacking_order() if visible.length() == 0 { // Nothing on screen: bring back what we hid (bottom to top, so the old top ends up on top). let hidden = self.desktop_hidden self.desktop_hidden = [] let mut top : UInt64? = None for wid in hidden { match self.wm.windows.get(wid) { Some(r) => if r.minimized { self.apply_actions( self.wm.handle_request( wid, @wm.WindowRequest::Minimize(false), self.work_area, ), ) top = Some(wid) } None => () } } match top { Some(wid) => self.activate_window(wid) None => () } } else { for wid in visible { self.apply_actions( self.wm.handle_request( wid, @wm.WindowRequest::Minimize(true), self.work_area, ), ) } self.desktop_hidden = visible self.set_kbd_focus(None) } self.damage.mark_full() } ///| /// True while Super+D has windows hidden that another Super+D would bring back. pub fn ChandraCompositor::desktop_shown(self : ChandraCompositor) -> Bool { self.desktop_hidden.length() > 0 && self.wm.stacking_order().length() == 0 }