├── .gitignore ├── LICENSE ├── MinimalisticView.sln ├── MinimalisticView ├── .editorconfig ├── Extensions.cs ├── Key.snk ├── MinimalisticView.cs ├── MinimalisticView.csproj ├── NonClientMouseTracker.cs ├── OptionPage.cs ├── Properties │ └── AssemblyInfo.cs ├── Resources │ ├── Icon.png │ ├── MinimalisticView.ico │ └── Preview.png ├── StyleOverrides.xaml ├── VSPackage.resx ├── packages.config └── source.extension.vsixmanifest └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # Visual Studio code coverage results 114 | *.coverage 115 | *.coveragexml 116 | 117 | # NCrunch 118 | _NCrunch_* 119 | .*crunch*.local.xml 120 | nCrunchTemp_* 121 | 122 | # MightyMoose 123 | *.mm.* 124 | AutoTest.Net/ 125 | 126 | # Web workbench (sass) 127 | .sass-cache/ 128 | 129 | # Installshield output folder 130 | [Ee]xpress/ 131 | 132 | # DocProject is a documentation generator add-in 133 | DocProject/buildhelp/ 134 | DocProject/Help/*.HxT 135 | DocProject/Help/*.HxC 136 | DocProject/Help/*.hhc 137 | DocProject/Help/*.hhk 138 | DocProject/Help/*.hhp 139 | DocProject/Help/Html2 140 | DocProject/Help/html 141 | 142 | # Click-Once directory 143 | publish/ 144 | 145 | # Publish Web Output 146 | *.[Pp]ublish.xml 147 | *.azurePubxml 148 | # TODO: Comment the next line if you want to checkin your web deploy settings 149 | # but database connection strings (with potential passwords) will be unencrypted 150 | *.pubxml 151 | *.publishproj 152 | 153 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 154 | # checkin your Azure Web App publish settings, but sensitive information contained 155 | # in these scripts will be unencrypted 156 | PublishScripts/ 157 | 158 | # NuGet Packages 159 | *.nupkg 160 | # The packages folder can be ignored because of Package Restore 161 | **/packages/* 162 | # except build/, which is used as an MSBuild target. 163 | !**/packages/build/ 164 | # Uncomment if necessary however generally it will be regenerated when needed 165 | #!**/packages/repositories.config 166 | # NuGet v3's project.json files produces more ignoreable files 167 | *.nuget.props 168 | *.nuget.targets 169 | 170 | # Microsoft Azure Build Output 171 | csx/ 172 | *.build.csdef 173 | 174 | # Microsoft Azure Emulator 175 | ecf/ 176 | rcf/ 177 | 178 | # Windows Store app package directories and files 179 | AppPackages/ 180 | BundleArtifacts/ 181 | Package.StoreAssociation.xml 182 | _pkginfo.txt 183 | 184 | # Visual Studio cache files 185 | # files ending in .cache can be ignored 186 | *.[Cc]ache 187 | # but keep track of directories ending in .cache 188 | !*.[Cc]ache/ 189 | 190 | # Others 191 | ClientBin/ 192 | ~$* 193 | *~ 194 | *.dbmdl 195 | *.dbproj.schemaview 196 | *.jfm 197 | *.pfx 198 | *.publishsettings 199 | node_modules/ 200 | orleans.codegen.cs 201 | 202 | # Since there are multiple workflows, uncomment next line to ignore bower_components 203 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 204 | #bower_components/ 205 | 206 | # RIA/Silverlight projects 207 | Generated_Code/ 208 | 209 | # Backup & report files from converting an old project file 210 | # to a newer Visual Studio version. Backup files are not needed, 211 | # because we have git ;-) 212 | _UpgradeReport_Files/ 213 | Backup*/ 214 | UpgradeLog*.XML 215 | UpgradeLog*.htm 216 | 217 | # SQL Server files 218 | *.mdf 219 | *.ldf 220 | 221 | # Business Intelligence projects 222 | *.rdl.data 223 | *.bim.layout 224 | *.bim_*.settings 225 | 226 | # Microsoft Fakes 227 | FakesAssemblies/ 228 | 229 | # GhostDoc plugin setting file 230 | *.GhostDoc.xml 231 | 232 | # Node.js Tools for Visual Studio 233 | .ntvs_analysis.dat 234 | 235 | # Visual Studio 6 build log 236 | *.plg 237 | 238 | # Visual Studio 6 workspace options file 239 | *.opt 240 | 241 | # Visual Studio LightSwitch build output 242 | **/*.HTMLClient/GeneratedArtifacts 243 | **/*.DesktopClient/GeneratedArtifacts 244 | **/*.DesktopClient/ModelManifest.xml 245 | **/*.Server/GeneratedArtifacts 246 | **/*.Server/ModelManifest.xml 247 | _Pvt_Extensions 248 | 249 | # Paket dependency manager 250 | .paket/paket.exe 251 | paket-files/ 252 | 253 | # FAKE - F# Make 254 | .fake/ 255 | 256 | # JetBrains Rider 257 | .idea/ 258 | *.sln.iml 259 | 260 | # CodeRush 261 | .cr/ 262 | 263 | # Python Tools for Visual Studio (PTVS) 264 | __pycache__/ 265 | *.pyc 266 | 267 | # Cake - Uncomment if you are using it 268 | # tools/ 269 | /packages 270 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Roman Semenov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MinimalisticView.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26430.13 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MinimalisticView", "MinimalisticView\MinimalisticView.csproj", "{E5165602-DA47-4B0E-B95C-3161384E8D60}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {E5165602-DA47-4B0E-B95C-3161384E8D60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {E5165602-DA47-4B0E-B95C-3161384E8D60}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {E5165602-DA47-4B0E-B95C-3161384E8D60}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {E5165602-DA47-4B0E-B95C-3161384E8D60}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /MinimalisticView/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | [*.cs] 3 | indent_style = tab 4 | indent_size = 4 -------------------------------------------------------------------------------- /MinimalisticView/Extensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Windows; 6 | using System.Windows.Media; 7 | 8 | namespace MinimalisticView 9 | { 10 | public static class Extensions 11 | { 12 | public static T LoadResourceValue(string xamlName) 13 | { 14 | return (T)((object)Application.LoadComponent(new Uri(Assembly.GetExecutingAssembly().GetName().Name + ";component/" + xamlName, UriKind.Relative))); 15 | } 16 | 17 | public static DependencyObject GetVisualOrLogicalParent(this DependencyObject sourceElement) 18 | { 19 | if (sourceElement is Visual) 20 | return VisualTreeHelper.GetParent(sourceElement) ?? LogicalTreeHelper.GetParent(sourceElement); 21 | return LogicalTreeHelper.GetParent(sourceElement); 22 | } 23 | 24 | public static IEnumerable FindDescendants(this DependencyObject obj) where T : class 25 | { 26 | List descendants = new List(); 27 | obj.TraverseVisualTree((Action)(child => descendants.Add(child))); 28 | return (IEnumerable)descendants; 29 | } 30 | 31 | public static void TraverseVisualTree(this DependencyObject obj, Action action) where T : class 32 | { 33 | for (int childIndex = 0; childIndex < VisualTreeHelper.GetChildrenCount(obj); ++childIndex) { 34 | DependencyObject child = VisualTreeHelper.GetChild(obj, childIndex); 35 | T obj1 = child as T; 36 | Action action1 = action; 37 | child.TraverseVisualTreeReverse(action1); 38 | if ((object)obj1 != null) 39 | action(obj1); 40 | } 41 | } 42 | 43 | public static void TraverseVisualTreeReverse(this DependencyObject obj, Action action) where T : class 44 | { 45 | for (int childIndex = VisualTreeHelper.GetChildrenCount(obj) - 1; childIndex >= 0; --childIndex) { 46 | DependencyObject child = VisualTreeHelper.GetChild(obj, childIndex); 47 | T obj1 = child as T; 48 | Action action1 = action; 49 | child.TraverseVisualTreeReverse(action1); 50 | if ((object)obj1 != null) 51 | action(obj1); 52 | } 53 | } 54 | 55 | public static FrameworkElement FindElement(this Visual v, string name) 56 | { 57 | if (v == null) 58 | return null; 59 | for (var i = 0; i < VisualTreeHelper.GetChildrenCount(v); ++i) 60 | { 61 | var child = VisualTreeHelper.GetChild(v, i) as Visual; 62 | if (child != null) 63 | { 64 | var e = child as FrameworkElement; 65 | if (e != null && e.Name == name) 66 | return e; 67 | } 68 | var result = FindElement(child, name); 69 | if (result != null) 70 | return result; 71 | } 72 | return null; 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /MinimalisticView/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/poma/MinimalisticView/f57336a163c14c42f3b0cca2a99b51402e1ec597/MinimalisticView/Key.snk -------------------------------------------------------------------------------- /MinimalisticView/MinimalisticView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Diagnostics; 5 | using System.Linq; 6 | using System.Runtime.InteropServices; 7 | using System.Windows; 8 | using System.Windows.Automation; 9 | using System.Windows.Controls; 10 | using System.Windows.Input; 11 | using Microsoft.VisualStudio.PlatformUI; 12 | using Microsoft.VisualStudio.Shell; 13 | using Microsoft.VisualStudio.Shell.Interop; 14 | using System.Windows.Threading; 15 | using System.Threading; 16 | using Task = System.Threading.Tasks.Task; 17 | 18 | namespace MinimalisticView 19 | { 20 | [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] 21 | [InstalledProductRegistration("#110", "#112", "2.2", IconResourceID = 400)] // Info on this package for Help/About 22 | [Guid(MinimalisticView.PackageGuidString)] 23 | [ProvideAutoLoad(UIContextGuids.NoSolution, PackageAutoLoadFlags.BackgroundLoad)] 24 | [ProvideAutoLoad(UIContextGuids.SolutionExists, PackageAutoLoadFlags.BackgroundLoad)] 25 | // todo: ensure that it correctly handles localized "Environment" category 26 | [ProvideOptionPage(typeof(OptionPage), "Environment", "MinimalisticView", 0, 0, true, new[] { "MinimalisticView", "menu", "tab", "title", "hide" })] 27 | public sealed partial class MinimalisticView : AsyncPackage 28 | { 29 | public const string PackageGuidString = "a06e17e0-8f3f-4625-ac80-b80e2b4a0699"; 30 | 31 | private bool _isMenuVisible; 32 | public bool IsMenuVisible 33 | { 34 | get { 35 | return _isMenuVisible; 36 | } 37 | set { 38 | if (_isMenuVisible == value) 39 | return; 40 | _isMenuVisible = value; 41 | UpdateMenuHeight(); 42 | UpdateTitleHeight(); 43 | } 44 | } 45 | 46 | private FrameworkElement _menuBar; 47 | public FrameworkElement MenuBar 48 | { 49 | get { 50 | return _menuBar; 51 | } 52 | set { 53 | _menuBar = value; 54 | UpdateMenuHeight(); 55 | AddElementHandlers(_menuBar); 56 | } 57 | } 58 | 59 | private FrameworkElement _titleBar; 60 | public FrameworkElement TitleBar 61 | { 62 | get { 63 | return _titleBar; 64 | } 65 | set { 66 | _titleBar = value; 67 | UpdateTitleHeight(); 68 | AddElementHandlers(_titleBar); 69 | } 70 | } 71 | 72 | private FrameworkElement _feedbackPanel; 73 | public FrameworkElement FeedbackPanel 74 | { 75 | get { 76 | return _feedbackPanel; 77 | } 78 | set { 79 | _feedbackPanel = value; 80 | UpdateFeedbackVisibility(); 81 | } 82 | } 83 | 84 | private OptionPage _options; 85 | public OptionPage Options 86 | { 87 | get { 88 | if (_options == null) { 89 | _options = (OptionPage)GetDialogPage(typeof(OptionPage)); 90 | } 91 | return _options; 92 | } 93 | } 94 | 95 | private ResourceDictionary _resourceOverrides; 96 | public ResourceDictionary ResourceOverrides { 97 | get { 98 | if (_resourceOverrides == null) { 99 | _resourceOverrides = Extensions.LoadResourceValue("StyleOverrides.xaml"); 100 | } 101 | return _resourceOverrides; 102 | } 103 | } 104 | 105 | private NonClientMouseTracker _nonClientTracker; 106 | private Window _mainWindow; 107 | private DispatcherTimer _mouseEnterTimer; 108 | private DispatcherTimer _mouseLeaveTimer; 109 | 110 | 111 | void UpdateMenuHeight() 112 | { 113 | UpdateElementHeight(_menuBar); 114 | } 115 | 116 | void UpdateTitleHeight() 117 | { 118 | if (!Options.HideMenuOnly) { 119 | UpdateElementHeight(_titleBar, Options.CollapsedTitleHeight); 120 | } else { 121 | _titleBar.ClearValue(FrameworkElement.HeightProperty); 122 | } 123 | } 124 | 125 | void UpdateFeedbackVisibility() 126 | { 127 | if (_feedbackPanel != null) { 128 | _feedbackPanel.Visibility = Options.HideFeedback ? Visibility.Collapsed : Visibility.Visible; 129 | } 130 | } 131 | 132 | void UpdateElementHeight(FrameworkElement element, double collapsedHeight = 0) 133 | { 134 | if (element == null) { 135 | return; 136 | } 137 | if (IsMenuVisible || !Options.TitleBarAutoHide) { 138 | element.ClearValue(FrameworkElement.HeightProperty); 139 | } else { 140 | element.Height = collapsedHeight; 141 | } 142 | } 143 | 144 | void AddElementHandlers(FrameworkElement element) 145 | { 146 | if (element == null) { 147 | return; 148 | } 149 | element.IsKeyboardFocusWithinChanged += OnContainerFocusChanged; 150 | element.MouseEnter += OnIsMouseOverChanged; 151 | element.MouseLeave += OnIsMouseOverChanged; 152 | } 153 | 154 | private void OnContainerFocusChanged(object sender, DependencyPropertyChangedEventArgs e) 155 | { 156 | IsMenuVisible = IsAggregateFocusInMenuContainer(); 157 | } 158 | 159 | private void PopupLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) 160 | { 161 | if (IsMenuVisible && MenuBar != null && !IsAggregateFocusInMenuContainer()) { 162 | IsMenuVisible = false; 163 | } 164 | } 165 | 166 | private async void OnIsMouseOverChanged(object sender, MouseEventArgs e) 167 | { 168 | await System.Threading.Tasks.Task.Delay(1); // Workaround for mouse transition issues between client and non-client area (when both areas have IsMouseOver set to false) 169 | var IsMouseOver = (_menuBar?.IsMouseOver ?? false) || (!Options.HideMenuOnly && (_nonClientTracker.IsMouseOver || (_titleBar?.IsMouseOver ?? false))); 170 | 171 | // reset timers 172 | if (IsMouseOver) { 173 | _mouseLeaveTimer.IsEnabled = false; 174 | } else { 175 | _mouseEnterTimer.IsEnabled = false; 176 | } 177 | 178 | if (IsMenuVisible && !IsMouseOver) { 179 | _mouseLeaveTimer.IsEnabled = true; 180 | } 181 | if (!IsMenuVisible && IsMouseOver) { 182 | _mouseEnterTimer.IsEnabled = true; 183 | } 184 | } 185 | 186 | private bool IsAggregateFocusInMenuContainer() 187 | { 188 | if (MenuBar.IsKeyboardFocusWithin || (TitleBar.IsKeyboardFocusWithin && !Options.HideMenuOnly)) 189 | return true; 190 | for (DependencyObject sourceElement = (DependencyObject)Keyboard.FocusedElement; sourceElement != null; sourceElement = sourceElement.GetVisualOrLogicalParent()) { 191 | if (sourceElement == MenuBar || (sourceElement == TitleBar && !Options.HideMenuOnly)) 192 | return true; 193 | } 194 | return false; 195 | } 196 | 197 | private void _mouseEnterTimer_Tick(object sender, EventArgs e) 198 | { 199 | _mouseEnterTimer.IsEnabled = false; 200 | IsMenuVisible = true; 201 | } 202 | 203 | private void _mouseLeaveTimer_Tick(object sender, EventArgs e) 204 | { 205 | _mouseLeaveTimer.IsEnabled = false; 206 | if (!IsAggregateFocusInMenuContainer()) { 207 | IsMenuVisible = false; 208 | } 209 | } 210 | 211 | /// 212 | /// Initializes a new instance of the class. 213 | /// 214 | public MinimalisticView() 215 | { 216 | // Inside this method you can place any initialization code that does not require 217 | // any Visual Studio service because at this point the package object is created but 218 | // not sited yet inside Visual Studio environment. The place to do all the other 219 | // initialization is the Initialize method. 220 | } 221 | 222 | /// 223 | /// Initialization of the package; this method is called right after the package is sited, so this is the place 224 | /// where you can put all the initialization code that rely on services provided by VisualStudio. 225 | /// 226 | protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) 227 | { 228 | await base.InitializeAsync(cancellationToken, progress); 229 | await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); 230 | 231 | _mainWindow = Application.Current.MainWindow; 232 | if (_mainWindow == null) { 233 | Trace.TraceError("mainWindow is null"); 234 | return; 235 | } 236 | if (Options.HideTabs) { 237 | Application.Current.Resources.MergedDictionaries.Add(ResourceOverrides); 238 | } 239 | _mainWindow.LayoutUpdated += DetectLayoutElements; 240 | _nonClientTracker = new NonClientMouseTracker(_mainWindow); 241 | _nonClientTracker.MouseEnter += () => OnIsMouseOverChanged(null, null); 242 | _nonClientTracker.MouseLeave += () => OnIsMouseOverChanged(null, null); 243 | EventManager.RegisterClassHandler(typeof(UIElement), UIElement.LostKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(PopupLostKeyboardFocus)); 244 | _mouseEnterTimer = new DispatcherTimer { IsEnabled = false, Interval = TimeSpan.FromMilliseconds(Options.MouseEnterDelay) }; 245 | _mouseLeaveTimer = new DispatcherTimer { IsEnabled = false, Interval = TimeSpan.FromMilliseconds(Options.MouseLeaveDelay) }; 246 | _mouseEnterTimer.Tick += _mouseEnterTimer_Tick; 247 | _mouseLeaveTimer.Tick += _mouseLeaveTimer_Tick; 248 | Options.PropertyChanged += OptionsChanged; 249 | } 250 | 251 | private void OptionsChanged(object sender, PropertyChangedEventArgs e) 252 | { 253 | switch (e.PropertyName) { 254 | case nameof(Options.CollapsedTitleHeight): 255 | UpdateElementHeight(_titleBar, Options.CollapsedTitleHeight); 256 | break; 257 | case nameof(Options.TitleBarAutoHide): 258 | case nameof(Options.HideMenuOnly): 259 | UpdateMenuHeight(); 260 | UpdateTitleHeight(); 261 | break; 262 | case nameof(Options.HideFeedback): 263 | UpdateFeedbackVisibility(); 264 | break; 265 | case nameof(Options.HideTabs): 266 | var dics = Application.Current.Resources.MergedDictionaries; 267 | if (Options.HideTabs && !dics.Contains(ResourceOverrides)) { 268 | dics.Add(ResourceOverrides); 269 | } 270 | if (!Options.HideTabs && dics.Contains(ResourceOverrides)) { 271 | dics.Remove(ResourceOverrides); 272 | } 273 | break; 274 | case nameof(Options.MouseEnterDelay): 275 | _mouseEnterTimer.Interval = TimeSpan.FromMilliseconds(Options.MouseEnterDelay); 276 | break; 277 | case nameof(Options.MouseLeaveDelay): 278 | _mouseLeaveTimer.Interval = TimeSpan.FromMilliseconds(Options.MouseLeaveDelay); 279 | break; 280 | } 281 | } 282 | 283 | private void DetectLayoutElements(object sender, EventArgs e) 284 | { 285 | if (MenuBar == null) { 286 | foreach (var descendant in _mainWindow.FindDescendants()) { 287 | if (AutomationProperties.GetAutomationId(descendant) == "MenuBar") { 288 | FrameworkElement frameworkElement = descendant; 289 | var parent = descendant.GetVisualOrLogicalParent(); 290 | if (parent != null) 291 | frameworkElement = parent.GetVisualOrLogicalParent() as DockPanel ?? frameworkElement; 292 | MenuBar = frameworkElement; 293 | break; 294 | } 295 | } 296 | } 297 | if (TitleBar == null) { 298 | var titleBar = _mainWindow.FindDescendants().FirstOrDefault(); 299 | if (titleBar != null) { 300 | TitleBar = titleBar; 301 | } 302 | } 303 | if (FeedbackPanel == null) { 304 | FeedbackPanel = Application.Current.MainWindow.FindElement("FrameControlContainerBorder"); 305 | } 306 | if (TitleBar != null && MenuBar != null) { 307 | _mainWindow.LayoutUpdated -= DetectLayoutElements; 308 | } 309 | } 310 | } 311 | } 312 | -------------------------------------------------------------------------------- /MinimalisticView/MinimalisticView.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 15.0 6 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 7 | 8 | 9 | true 10 | 11 | 12 | 13 | 14 | 14.0 15 | publish\ 16 | true 17 | Disk 18 | false 19 | Foreground 20 | 7 21 | Days 22 | false 23 | false 24 | true 25 | 0 26 | 1.0.0.%2a 27 | false 28 | false 29 | true 30 | 31 | 32 | 33 | true 34 | 35 | 36 | Key.snk 37 | 38 | 39 | 40 | Debug 41 | AnyCPU 42 | 2.0 43 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 44 | {E5165602-DA47-4B0E-B95C-3161384E8D60} 45 | Library 46 | Properties 47 | MinimalisticView 48 | MinimalisticView 49 | v4.6 50 | true 51 | true 52 | true 53 | true 54 | true 55 | false 56 | 57 | 58 | true 59 | full 60 | false 61 | bin\Debug\ 62 | DEBUG;TRACE 63 | prompt 64 | 4 65 | 66 | 67 | pdbonly 68 | true 69 | bin\Release\ 70 | TRACE 71 | prompt 72 | 4 73 | 74 | 75 | 76 | 77 | 78 | 79 | Component 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | Designer 89 | 90 | 91 | 92 | 93 | Always 94 | true 95 | 96 | 97 | 98 | Always 99 | true 100 | 101 | 102 | 103 | 104 | ..\packages\Microsoft.VisualStudio.Shell.15.0.15.0.26201\lib\Microsoft.VisualStudio.Shell.15.0.dll 105 | 106 | 107 | ..\packages\Microsoft.VisualStudio.Shell.Framework.15.0.26201\lib\net45\Microsoft.VisualStudio.Shell.Framework.dll 108 | 109 | 110 | ..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.Shell.Interop.8.0.dll 111 | True 112 | 113 | 114 | False 115 | C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Microsoft.VisualStudio.Shell.UI.Internal.dll 116 | 117 | 118 | C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Microsoft.VisualStudio.Shell.ViewManager.dll 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | true 131 | VSPackage 132 | 133 | 134 | 135 | 136 | MSBuild:Compile 137 | Designer 138 | 139 | 140 | 141 | 142 | 143 | 144 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 145 | 146 | 147 | 148 | 149 | 150 | 157 | -------------------------------------------------------------------------------- /MinimalisticView/NonClientMouseTracker.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Windows; 4 | using Microsoft.VisualStudio.Shell; 5 | using System.Diagnostics; 6 | using System.Windows.Interop; 7 | 8 | namespace MinimalisticView 9 | { 10 | public sealed partial class MinimalisticView : AsyncPackage 11 | { 12 | public class NonClientMouseTracker 13 | { 14 | private const int WM_NCHITTEST = 0x0084; 15 | private const int WM_NCMOUSEMOVE = 0x00a0; 16 | private const int WM_NCMOUSELEAVE = 0x02a2; 17 | 18 | private const int HTCAPTION = 2; 19 | 20 | [Flags] 21 | public enum TMEFlags : uint 22 | { 23 | TME_CANCEL = 0x80000000, 24 | TME_HOVER = 0x00000001, 25 | TME_LEAVE = 0x00000002, 26 | TME_NONCLIENT = 0x00000010, 27 | TME_QUERY = 0x40000000, 28 | } 29 | 30 | [StructLayout(LayoutKind.Sequential)] 31 | public struct TRACKMOUSEEVENT 32 | { 33 | public Int32 cbSize; // using Int32 instead of UInt32 is safe here, and this avoids casting the result of Marshal.SizeOf() 34 | [MarshalAs(UnmanagedType.U4)] 35 | public TMEFlags dwFlags; 36 | public IntPtr hWnd; 37 | public UInt32 dwHoverTime; 38 | 39 | public TRACKMOUSEEVENT(TMEFlags dwFlags, IntPtr hWnd, UInt32 dwHoverTime) 40 | { 41 | this.cbSize = Marshal.SizeOf(typeof(TRACKMOUSEEVENT)); 42 | this.dwFlags = dwFlags; 43 | this.hWnd = hWnd; 44 | this.dwHoverTime = dwHoverTime; 45 | } 46 | } 47 | 48 | [DllImport("user32.dll")] 49 | static extern int TrackMouseEvent(ref TRACKMOUSEEVENT lpEventTrack); 50 | 51 | public event Action MouseEnter; 52 | public event Action MouseLeave; 53 | public bool IsMouseOver { get; set; } 54 | 55 | private IntPtr _handle; 56 | 57 | public NonClientMouseTracker(Window wnd) 58 | { 59 | _handle = new WindowInteropHelper(wnd).Handle; 60 | HwndSource.FromHwnd(_handle).AddHook(new HwndSourceHook(WndProc)); 61 | } 62 | 63 | private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) 64 | { 65 | if (msg == WM_NCMOUSEMOVE) { 66 | if ((int)wParam == HTCAPTION) { 67 | if (!IsMouseOver) { 68 | IsMouseOver = true; 69 | SetTrackMouseEvent(); 70 | OnMouseEnter(); 71 | } 72 | } 73 | } else if (msg == WM_NCMOUSELEAVE) { 74 | IsMouseOver = false; 75 | OnMouseLeave(); 76 | } 77 | 78 | return IntPtr.Zero; 79 | } 80 | 81 | private void SetTrackMouseEvent() 82 | { 83 | var tme = new TRACKMOUSEEVENT(TMEFlags.TME_NONCLIENT | TMEFlags.TME_LEAVE, _handle, 0); 84 | TrackMouseEvent(ref tme); 85 | } 86 | 87 | protected void OnMouseEnter() 88 | { 89 | MouseEnter?.Invoke(); 90 | } 91 | 92 | protected void OnMouseLeave() 93 | { 94 | MouseLeave?.Invoke(); 95 | } 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /MinimalisticView/OptionPage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.VisualStudio.Shell; 3 | using System.ComponentModel; 4 | 5 | namespace MinimalisticView 6 | { 7 | public class OptionPage : DialogPage, INotifyPropertyChanged 8 | { 9 | bool _hideTabs = false; 10 | [DisplayName("Hide tabs")] 11 | [Description("Whether to hide tab bar")] 12 | public bool HideTabs 13 | { 14 | get { 15 | return _hideTabs; 16 | } 17 | set { 18 | if (_hideTabs == value) { 19 | return; 20 | } 21 | 22 | _hideTabs = value; 23 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(HideTabs))); 24 | } 25 | } 26 | 27 | bool _titleBarAutoHide = true; 28 | [DisplayName("Hide title and menu bars")] 29 | [Description("You can access menu bar using hotkeys such as Alt or Ctrl-Q")] 30 | public bool TitleBarAutoHide 31 | { 32 | get { 33 | return _titleBarAutoHide; 34 | } 35 | set { 36 | if (_titleBarAutoHide == value) { 37 | return; 38 | } 39 | 40 | _titleBarAutoHide = value; 41 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(TitleBarAutoHide))); 42 | } 43 | } 44 | 45 | bool _hideMenuOnly = false; 46 | [DisplayName("Hide menu only")] 47 | [Description("Hide menu bar but leave title bar visible")] 48 | public bool HideMenuOnly 49 | { 50 | get { 51 | return _hideMenuOnly; 52 | } 53 | set { 54 | if (_hideMenuOnly == value) { 55 | return; 56 | } 57 | 58 | _hideMenuOnly = value; 59 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(HideMenuOnly))); 60 | } 61 | } 62 | 63 | bool _hideFeedback = true; 64 | [DisplayName("Hide feedback button")] 65 | [Description("Hide Feedback button panel")] 66 | public bool HideFeedback 67 | { 68 | get { 69 | return _hideFeedback; 70 | } 71 | set { 72 | if (_hideFeedback == value) { 73 | return; 74 | } 75 | 76 | _hideFeedback = value; 77 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(HideFeedback))); 78 | } 79 | } 80 | 81 | int _collapsedTitleHeight = 2; 82 | [DisplayName("Collapsed title height")] 83 | [Description("Height of collapsed title bar. If set to zero removes it completely but menu cannot expand on mouse over.")] 84 | public int CollapsedTitleHeight 85 | { 86 | get { 87 | return _collapsedTitleHeight; 88 | } 89 | set { 90 | if (_collapsedTitleHeight == value) { 91 | return; 92 | } 93 | 94 | _collapsedTitleHeight = Math.Max(value, 0); 95 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CollapsedTitleHeight))); 96 | } 97 | } 98 | 99 | int _mouseEnterDelay = 0; 100 | [DisplayName("Mouse enter delay")] 101 | [Description("Delay after mouse enters collapsed menu and before menu pops up")] 102 | public int MouseEnterDelay 103 | { 104 | get { 105 | return _mouseEnterDelay; 106 | } 107 | set { 108 | if (_mouseEnterDelay == value) { 109 | return; 110 | } 111 | 112 | _mouseEnterDelay = Math.Max(value, 0); 113 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(MouseEnterDelay))); 114 | } 115 | } 116 | 117 | int _mouseLeaveDelay = 0; 118 | [DisplayName("Mouse leave delay")] 119 | [Description("Delay after mouse leaves menu and before menu collapses back")] 120 | public int MouseLeaveDelay 121 | { 122 | get { 123 | return _mouseLeaveDelay; 124 | } 125 | set { 126 | if (_mouseLeaveDelay == value) { 127 | return; 128 | } 129 | 130 | _mouseLeaveDelay = Math.Max(value, 0); 131 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(MouseLeaveDelay))); 132 | } 133 | } 134 | public event PropertyChangedEventHandler PropertyChanged; 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /MinimalisticView/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MinimalisticView")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MinimalisticView")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("2.3.0.0")] 33 | [assembly: AssemblyFileVersion("2.3.0.0")] 34 | -------------------------------------------------------------------------------- /MinimalisticView/Resources/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/poma/MinimalisticView/f57336a163c14c42f3b0cca2a99b51402e1ec597/MinimalisticView/Resources/Icon.png -------------------------------------------------------------------------------- /MinimalisticView/Resources/MinimalisticView.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/poma/MinimalisticView/f57336a163c14c42f3b0cca2a99b51402e1ec597/MinimalisticView/Resources/MinimalisticView.ico -------------------------------------------------------------------------------- /MinimalisticView/Resources/Preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/poma/MinimalisticView/f57336a163c14c42f3b0cca2a99b51402e1ec597/MinimalisticView/Resources/Preview.png -------------------------------------------------------------------------------- /MinimalisticView/StyleOverrides.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /MinimalisticView/VSPackage.resx: -------------------------------------------------------------------------------- 1 |  2 | 12 | 13 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | text/microsoft-resx 120 | 121 | 122 | 2.0 123 | 124 | 125 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 126 | 127 | 128 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 129 | 130 | 131 | 132 | MinimalisticView Extension 133 | 134 | 135 | MinimalisticView Visual Studio Extension Detailed Info 136 | 137 | 138 | Resources\MinimalisticView.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 139 | 140 | -------------------------------------------------------------------------------- /MinimalisticView/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MinimalisticView/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Hide Main Menu, Title Bar, and Tabs 6 | Hides main menu and title bar when not in use, can also hide tabs. Menu and title behave as a single panel and are shown on mouse over or alt/ctrl-q shortcuts. Has configurable options. 7 | https://marketplace.visualstudio.com/items?itemName=Poma.MinimalisticView 8 | Resources\Icon.png 9 | Resources\Preview.png 10 | TabStrip, menu, tabs, hide menu, collapse, hide, Main Menu, Title Bar, titlebar, hide tabs, hide title 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MinimalisticView 2 | 3 | ❗ **Looking for maintainers.** I use Visual Studio pretty rarely nowdays, would be cool if someone takes over the support of this plugin. 4 | 5 | [VS Marketplace page](https://marketplace.visualstudio.com/items?itemName=Poma.MinimalisticView) 6 | 7 | This extension hides Menu bar, Title bar, and Tab Well. Menu and title bar are in auto-hide mode and are accessible if you press "Alt" or "Ctrl-Q" hotkey or hover mouse over window top. Tabs can also be hidden and you can easily switch between them using Ctrl-Tab or Ctrl-, and other navigation hotkeys. 8 | 9 | You can configure setting in Options -> Environment -> MinimalisticView 10 | 11 | An extension for programmers who don't use mouse when writing code and want to get rid of unneeded panels that are taking up space and distracting from code. 12 | 13 | If you are interested in extension please rate or review it - if enough people are interested I will develop more options and usability features. So far looks like nobody else uses it. 14 | 15 | ![vs](https://poma.gallery.vsassets.io/_apis/public/gallery/publisher/Poma/extension/MinimalisticView/2.2/assetbyname/270471/1/2304362F12Fvs.png) 16 | 17 | --------------------------------------------------------------------------------