/// <summary> /// Create an empty virtual desktop with no windows assigned to it. /// </summary> /// <returns>The newly created virtual desktop.</returns> public VirtualDesktop CreateEmptyDesktop() { var newDesktop = new VirtualDesktop(); _availableDesktops.Add( newDesktop ); return newDesktop; }
public DesktopManager() { // Determine which windows shouldn't be managed by the desktop manager. _ignoreWindows = WindowManager.GetWindows().Where( w => !IsValidWindow( w ) ).ToList(); _startupDesktop = new VirtualDesktop( GetOpenWindows() ); CurrentDesktop = _startupDesktop; _availableDesktops.Add( CurrentDesktop ); }
public VirtualDesktop CreateDesktopFromSession( StoredSession session ) { // The startup desktop contains all windows open at startup. // Windows from previously stored sessions shouldn't be assigned to this startup desktop, so remove them. // TODO: Batch these 'hide window' operations together using RepositionWindowInfo? session.OpenWindows.ForEach( w => _startupDesktop.RemoveWindow( w ) ); var restored = new VirtualDesktop( session ); _availableDesktops.Add( restored ); return restored; }
internal StoredSession( VirtualDesktop desktop ) { OpenWindows = desktop.Windows; }
/// <summary> /// Merges two desktops together and returns the new desktop. /// </summary> /// <returns>A new virtual desktop which has windows of both passed desktops assigned to it.</returns> public VirtualDesktop Merge( VirtualDesktop desktop1, VirtualDesktop desktop2 ) { _availableDesktops.Remove( desktop1 ); _availableDesktops.Remove( desktop2 ); var newDesktop = new VirtualDesktop( desktop1.Windows.Concat( desktop2.Windows ) ); _availableDesktops.Add( newDesktop ); return newDesktop; }
/// <summary> /// Switch to the given virtual desktop. /// </summary> /// <param name="desktop">The desktop to switch to.</param> public void SwitchToDesktop( VirtualDesktop desktop ) { if ( CurrentDesktop == desktop ) { return; } UpdateWindowAssociations(); // Hide windows and show those from the new desktop. CurrentDesktop.Hide(); desktop.Show(); CurrentDesktop = desktop; }