string ILayout.LayoutSymbol() { if (layoutAxis == LayoutAxis.Monocle) { return("[" + workspace.GetWindowsCount() + "]"); } var master = "[]"; var stackCount = workspace.GetWindowsCount() - masterAreaWindowsCount; if (masterAreaWindowsCount > 1) { master = GetAreaSymbol(masterAreaWindowsCount, masterAreaAxis); } var stack = GetAreaSymbol(stackCount, stackAreaAxis); switch (layoutAxis) { case LayoutAxis.LeftToRight: case LayoutAxis.TopToBottom: return(master + (master == "[]" ? "" : "]") + stack); case LayoutAxis.RightToLeft: case LayoutAxis.BottomToTop: return(stack + (master == "[]" ? "" : "[") + master); } throw new Exception("Unreachable code... reached!"); }
private void SetWorkspaceLabelColor(Workspace workspace) { var workspaceLabel = workspaceLabels[workspace.id - 1]; if (workspace.IsCurrentWorkspace && isShown) { workspaceLabel.BackColor = highlightedBackgroundColor; workspaceLabel.ForeColor = highlightedForegroundColor; } else if (workspace.IsWorkspaceVisible && isShown) { workspaceLabel.BackColor = highlightedInactiveBackgroundColor; workspaceLabel.ForeColor = highlightedInactiveForegroundColor; } else { var count = workspace.GetWindowsCount(); if (count > 9) { count = 9; } workspaceLabel.BackColor = normalBackgroundColor[count]; workspaceLabel.ForeColor = normalForegroundColor[count]; } }
private void ShowHideWindows(Workspace oldWorkspace, Workspace newWorkspace, bool setForeground) { var winPosInfo = NativeMethods.BeginDeferWindowPos(newWorkspace.GetWindowsCount() + oldWorkspace.GetWindowsCount()); var showWindows = newWorkspace.GetWindows(); foreach (var window in showWindows.Where(Utilities.WindowIsNotHung)) { winPosInfo = window.GetOwnedWindows().Aggregate(winPosInfo, (current, hWnd) => NativeMethods.DeferWindowPos(current, hWnd, IntPtr.Zero, 0, 0, 0, 0, NativeMethods.SWP.SWP_NOACTIVATE | NativeMethods.SWP.SWP_NOMOVE | NativeMethods.SWP.SWP_NOSIZE | NativeMethods.SWP.SWP_NOZORDER | NativeMethods.SWP.SWP_NOOWNERZORDER | NativeMethods.SWP.SWP_SHOWWINDOW)); if (window.redrawOnShow) { window.Redraw(); } } var hideWindows = oldWorkspace.sharedWindowsCount > 0 && newWorkspace.sharedWindowsCount > 0 ? oldWorkspace.GetWindows().Except(showWindows) : oldWorkspace.GetWindows(); // if the window is not visible we shouldn't add it to hiddenApplications as EVENT_OBJECT_HIDE won't be sent foreach (var window in hideWindows.Where(Utilities.IsVisibleAndNotHung)) { hiddenApplications.Add(window.hWnd); winPosInfo = window.GetOwnedWindows().Aggregate(winPosInfo, (current, hWnd) => NativeMethods.DeferWindowPos(current, hWnd, IntPtr.Zero, 0, 0, 0, 0, NativeMethods.SWP.SWP_NOACTIVATE | NativeMethods.SWP.SWP_NOMOVE | NativeMethods.SWP.SWP_NOSIZE | NativeMethods.SWP.SWP_NOZORDER | NativeMethods.SWP.SWP_NOOWNERZORDER | NativeMethods.SWP.SWP_HIDEWINDOW)); } NativeMethods.EndDeferWindowPos(winPosInfo); // activates the topmost non-minimized window if (setForeground) { DoForTopmostWindowForWorkspace(newWorkspace, ForceForegroundWindow); } }
private void SetWorkspaceLabelColor(Workspace workspace) { var workspaceLabel = workspaceLabels[workspace.id - 1]; if (workspace.IsCurrentWorkspace) { workspaceLabel.BackColor = highlightedBackgroundColor; workspaceLabel.ForeColor = highlightedForegroundColor; } else if (workspace.IsWorkspaceVisible) { workspaceLabel.BackColor = highlightedInactiveBackgroundColor; workspaceLabel.ForeColor = highlightedInactiveForegroundColor; } else { var count = workspace.GetWindowsCount(); if (count > 9) { count = 9; } workspaceLabel.BackColor = normalBackgroundColor[count]; workspaceLabel.ForeColor = normalForegroundColor[count]; } }