private void OnNewWindowSelected(WindowSelectListElement element) { TheBarManager.I.MinimizeApp(WindowSelectApp.I.appKey); TheBarManager.I.CloseApp(appKey); DPDesktopOverlay dpBase; if (!element.isDesktop) { dpBase = OverlayManager.I.NewDPWindowOverlay(element.window); } else { dpBase = OverlayManager.I.NewDPMonitorOverlay(element.monitor); } DPLayoutManager.ApplyState(dpBase, stateToApply); TheBarManager.I.AddOpenApp(dpBase.dpAppParent); //Show DPLayoutManager.SyncNewDPAppVisibility(stateToApply, dpBase, true); }
private IEnumerator BuildWindowList(bool forceRefresh = false) { windowsLoaded = false; yield return(new WaitForSeconds(0.1f)); foreach (Transform child in windowsRectTransform) { Destroy(child.gameObject); } windowElements.Clear(); int i = 1; //TODO: Proper detection of no DDA if (UDDManager.monitors.Count <= 0) { DPSettings.config.useDDA = false; } if (DPSettings.config.useDDA) { //Spawn desktops: foreach (UDDMonitor monitor in UDDManager.monitors) { WindowSelectListElement element = Instantiate(windowListElementPF, windowsRectTransform).GetComponent <WindowSelectListElement>(); element.icon.texture = desktopIcon; element.isDesktop = true; element.desktopIndex = i - 1; element.monitor = monitor; element.title.SetText("Display " + i); i++; } //Spawn the spacer //Instantiate(_spacerPF, _windowsRectTransform); } //Spawn the windows //.Log("Spawning windows"); List <UwcWindow> sortedWindows = UwcManager.windows.Values.OrderBy(x => x.title).ToList(); foreach (UwcWindow window in sortedWindows) { if (window.title == "") { continue; } if (window.title.Contains("DISPLAY")) { continue; } if (window.title == "Microsoft Text Input Application") { continue; } bool shouldSkip = false; //Don't spawn existing windows: /*foreach (DPOverlayBase dpBase in OverlayManager.I.overlays) { * if (dpBase is DPDesktopOverlay renderDP) { * if (renderDP.isTargetingWindow && renderDP.window == window) { * shouldSkip = true; * break; * } * } * }*/ if (shouldSkip) { continue; } WindowSelectListElement element = Instantiate(windowListElementPF, windowsRectTransform).GetComponent <WindowSelectListElement>(); //element.exists = true; element.window = window; element.title.SetText(window.title); element.icon.texture = window.iconTexture; windowElements.Add(element); } windowsLoaded = true; yield break; }