@@ -33,6 +33,9 @@ public partial class MainWindow : Window
3333
3434 private NotifyIcon ? notifyIcon ;
3535 private ControlWindow ? controlWindow ;
36+ // Tracks whether the control window should be visible (controls initial visibility and toggle state)
37+ private bool isControlWindowVisible = true ;
38+ private ToolStripMenuItem ? toggleControlsMenuItem ;
3639
3740 private class MonitorWindowContext
3841 {
@@ -172,11 +175,20 @@ private void SetupNotifyIcon()
172175 contextMenu . Items . Add ( new ToolStripSeparator ( ) ) ;
173176 contextMenu . Items . Add ( "🖥️ Switch Monitor" , null , ( s , e ) => MoveToNextMonitor ( ) ) ;
174177 contextMenu . Items . Add ( "🖥️🖥️ Toggle All Monitors" , null , ( s , e ) => ToggleAllMonitors ( ) ) ;
178+ contextMenu . Items . Add ( new ToolStripSeparator ( ) ) ;
179+
180+ // Add toggle controls menu item - text will be set by UpdateTrayMenuToggleControlsText
181+ toggleControlsMenuItem = new ToolStripMenuItem ( "🎛️ Hide Controls" , null , ( s , e ) => ToggleControlsVisibility ( ) ) ;
182+ contextMenu . Items . Add ( toggleControlsMenuItem ) ;
183+
175184 contextMenu . Items . Add ( new ToolStripSeparator ( ) ) ;
176185 contextMenu . Items . Add ( "✖ Exit" , null , ( s , e ) => System . Windows . Application . Current . Shutdown ( ) ) ;
177186
178187 notifyIcon . ContextMenuStrip = contextMenu ;
179188 notifyIcon . DoubleClick += ( s , e ) => ShowHelp ( ) ;
189+
190+ // Set initial menu text based on current state
191+ UpdateTrayMenuToggleControlsText ( ) ;
180192 }
181193
182194 private void ShowHelp ( )
@@ -467,7 +479,12 @@ private void CreateControlWindow()
467479 {
468480 controlWindow = new ControlWindow ( this ) ;
469481 RepositionControlWindow ( ) ;
470- controlWindow . Show ( ) ;
482+
483+ // Only show if controls are supposed to be visible
484+ if ( isControlWindowVisible )
485+ {
486+ controlWindow . Show ( ) ;
487+ }
471488 }
472489
473490 private void CreateFrameGeometry ( )
@@ -637,6 +654,36 @@ public void HandleToggle()
637654 ToggleLight ( ) ;
638655 }
639656
657+ public void ToggleControlsVisibility ( )
658+ {
659+ isControlWindowVisible = ! isControlWindowVisible ;
660+
661+ // Apply visibility change if control window exists
662+ if ( controlWindow != null )
663+ {
664+ if ( isControlWindowVisible )
665+ {
666+ controlWindow . Show ( ) ;
667+ }
668+ else
669+ {
670+ controlWindow . Hide ( ) ;
671+ }
672+ }
673+ // Note: If controlWindow doesn't exist yet, isControlWindowVisible state
674+ // is preserved and will be applied when CreateControlWindow() is called
675+
676+ UpdateTrayMenuToggleControlsText ( ) ;
677+ }
678+
679+ private void UpdateTrayMenuToggleControlsText ( )
680+ {
681+ if ( toggleControlsMenuItem != null )
682+ {
683+ toggleControlsMenuItem . Text = isControlWindowVisible ? "🎛️ Hide Controls" : "🎛️ Show Controls" ;
684+ }
685+ }
686+
640687 public void IncreaseBrightness ( )
641688 {
642689 currentOpacity = Math . Min ( MaxOpacity , currentOpacity + OpacityStep ) ;
0 commit comments