Skip to content

Commit a50b806

Browse files
authored
Merge pull request #15 from shanselman/copilot/add-toolbar-hide-option
Add option to hide controls toolbar via tray menu
2 parents 9f04c45 + 1e06ae3 commit a50b806

File tree

2 files changed

+54
-4
lines changed

2 files changed

+54
-4
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ A lightweight WPF application that adds a customizable glowing edge light effect
1212
- **Customizable Brightness**: Adjust opacity with easy-to-use controls
1313
- **Adjustable Color Temperature**: Shift the edge light from cooler (blue-ish) to warmer (amber) tones
1414
- **Toggle On/Off**: Quickly enable or disable the edge light effect
15+
- **Hideable Controls**: Hide the control toolbar for a cleaner look, restore via tray menu
1516
- **Always On Top**: Stays visible above all other windows
1617
- **Keyboard Shortcuts**:
1718
- `Ctrl+Shift+L` - Toggle light on/off
@@ -77,13 +78,15 @@ The executable will be in `bin\Release\net10.0-windows\win-x64\publish\WindowsEd
7778

7879
1. Launch `WindowsEdgeLight.exe`
7980
2. The edge light will appear around your primary monitor
80-
3. Hover over the top-right corner to reveal controls:
81+
3. Control toolbar appears at the bottom center with these buttons:
8182
- 🔅 **Decrease Brightness** - Reduces opacity
8283
- 🔆 **Increase Brightness** - Increases opacity
8384
- 🌡️ **Cooler Color** - Shifts the glow towards a cooler, blue-ish white
84-
-**Warmer Color** - Shifts the glow towards a warmer, amber tone
85-
- �💡 **Toggle Light** - Turn the effect on/off
85+
- 🔥 **Warmer Color** - Shifts the glow towards a warmer, amber tone
86+
- 💡 **Toggle Light** - Turn the effect on/off
87+
- 🖥️ **Switch Monitor** - Move to next monitor (if multiple monitors)
8688
-**Exit** - Close the application
89+
4. Hide the control toolbar for a cleaner look using the tray menu (right-click tray icon → "Hide Controls")
8790

8891
### Keyboard Shortcuts
8992

WindowsEdgeLight/MainWindow.xaml.cs

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)