Skip to content

Commit 7412f8f

Browse files
committed
Add clickable control buttons in separate window (v0.6)
Major usability improvement - fully functional control buttons! New Features: - Separate ControlWindow with 4 clickable buttons - Positioned at bottom center inside the edge light ring - Buttons float above main window and are fully interactive - Semi-transparent with hover effect (0.6 to 1.0 opacity) - Rounded corners for modern look Buttons: - 🔅 Decrease Brightness (also Ctrl+Shift+Down) - 🔆 Increase Brightness (also Ctrl+Shift+Up) - 💡 Toggle Light (also Ctrl+Shift+L) - ✖ Exit Technical Implementation: - Created ControlWindow.xaml and ControlWindow.xaml.cs - Separate window allows clicks while main window stays click-through - ControlWindow positioned dynamically at main window center-bottom - Public methods (IncreaseBrightness, DecreaseBrightness, HandleToggle) allow ControlWindow to control MainWindow - Both windows close together - Removed old non-functional control panel from MainWindow Brightness Improvements: - Default opacity increased to 1.0 (full brightness) - Much brighter and whiter by default - Edge light now really stands out! Result: Users can now use BOTH hotkeys AND clickable buttons!
1 parent 1ab73bf commit 7412f8f

File tree

5 files changed

+119
-61
lines changed

5 files changed

+119
-61
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<Window x:Class="WindowsEdgeLight.ControlWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
Title="Controls"
5+
Height="60" Width="200"
6+
WindowStyle="None"
7+
AllowsTransparency="True"
8+
Background="Transparent"
9+
Topmost="True"
10+
ShowInTaskbar="False"
11+
ResizeMode="NoResize">
12+
13+
<Border Background="#80000000"
14+
CornerRadius="10"
15+
HorizontalAlignment="Center">
16+
<Border.Style>
17+
<Style TargetType="Border">
18+
<Setter Property="Opacity" Value="0.6"/>
19+
<Style.Triggers>
20+
<Trigger Property="IsMouseOver" Value="True">
21+
<Setter Property="Opacity" Value="1"/>
22+
</Trigger>
23+
</Style.Triggers>
24+
</Style>
25+
</Border.Style>
26+
27+
<StackPanel Orientation="Horizontal">
28+
<Button Content="🔅"
29+
Click="BrightnessDown_Click"
30+
Width="40" Height="40"
31+
Margin="5"
32+
FontSize="20"
33+
ToolTip="Decrease Brightness (Ctrl+Shift+Down)"/>
34+
35+
<Button Content="🔆"
36+
Click="BrightnessUp_Click"
37+
Width="40" Height="40"
38+
Margin="5"
39+
FontSize="20"
40+
ToolTip="Increase Brightness (Ctrl+Shift+Up)"/>
41+
42+
<Button Content="💡"
43+
Click="Toggle_Click"
44+
Width="40" Height="40"
45+
Margin="5"
46+
FontSize="20"
47+
ToolTip="Toggle Light (Ctrl+Shift+L)"/>
48+
49+
<Button Content=""
50+
Click="Close_Click"
51+
Width="40" Height="40"
52+
Margin="5"
53+
FontSize="16"
54+
ToolTip="Exit"/>
55+
</StackPanel>
56+
</Border>
57+
</Window>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System.Windows;
2+
3+
namespace WindowsEdgeLight;
4+
5+
public partial class ControlWindow : Window
6+
{
7+
private readonly MainWindow mainWindow;
8+
9+
public ControlWindow(MainWindow main)
10+
{
11+
InitializeComponent();
12+
mainWindow = main;
13+
}
14+
15+
private void BrightnessDown_Click(object sender, RoutedEventArgs e)
16+
{
17+
mainWindow.DecreaseBrightness();
18+
}
19+
20+
private void BrightnessUp_Click(object sender, RoutedEventArgs e)
21+
{
22+
mainWindow.IncreaseBrightness();
23+
}
24+
25+
private void Toggle_Click(object sender, RoutedEventArgs e)
26+
{
27+
mainWindow.HandleToggle();
28+
}
29+
30+
private void Close_Click(object sender, RoutedEventArgs e)
31+
{
32+
System.Windows.Application.Current.Shutdown();
33+
}
34+
}

WindowsEdgeLight/MainWindow.xaml

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<!-- Edge Light Frame with Rounded Inner and Outer Edges using Path -->
2525
<Path x:Name="EdgeLightBorder"
2626
Margin="20"
27-
Opacity="0.95"
27+
Opacity="1.0"
2828
Stretch="None"
2929
HorizontalAlignment="Stretch"
3030
VerticalAlignment="Stretch">
@@ -41,58 +41,5 @@
4141
<BlurEffect Radius="8"/>
4242
</Path.Effect>
4343
</Path>
44-
45-
<!-- Control Panel (Top-Right Corner) -->
46-
<StackPanel x:Name="ControlPanel"
47-
HorizontalAlignment="Right"
48-
VerticalAlignment="Top"
49-
Margin="20"
50-
Orientation="Horizontal"
51-
IsHitTestVisible="True"
52-
Background="#40000000"
53-
Opacity="0.3">
54-
<StackPanel.Style>
55-
<Style TargetType="StackPanel">
56-
<Setter Property="Opacity" Value="0.3"/>
57-
<Style.Triggers>
58-
<Trigger Property="IsMouseOver" Value="True">
59-
<Setter Property="Opacity" Value="1"/>
60-
</Trigger>
61-
</Style.Triggers>
62-
</Style>
63-
</StackPanel.Style>
64-
65-
<Button x:Name="BrightnessDownButton"
66-
Content="🔅"
67-
Click="BrightnessDown_Click"
68-
Width="40" Height="40"
69-
Margin="5"
70-
FontSize="20"
71-
ToolTip="Decrease Brightness"/>
72-
73-
<Button x:Name="BrightnessUpButton"
74-
Content="🔆"
75-
Click="BrightnessUp_Click"
76-
Width="40" Height="40"
77-
Margin="5"
78-
FontSize="20"
79-
ToolTip="Increase Brightness"/>
80-
81-
<Button x:Name="ToggleButton"
82-
Content="💡"
83-
Click="Toggle_Click"
84-
Width="40" Height="40"
85-
Margin="5"
86-
FontSize="20"
87-
ToolTip="Toggle Light (Ctrl+Shift+L)"/>
88-
89-
<Button x:Name="CloseButton"
90-
Content=""
91-
Click="Close_Click"
92-
Width="40" Height="40"
93-
Margin="5"
94-
FontSize="16"
95-
ToolTip="Exit"/>
96-
</StackPanel>
9744
</Grid>
9845
</Window>

WindowsEdgeLight/MainWindow.xaml.cs

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ namespace WindowsEdgeLight;
1111
public partial class MainWindow : Window
1212
{
1313
private bool isLightOn = true;
14-
private double currentOpacity = 0.95;
14+
private double currentOpacity = 1.0; // Full brightness by default
1515
private const double OpacityStep = 0.15;
1616
private const double MinOpacity = 0.2;
1717
private const double MaxOpacity = 1.0;
1818

1919
private NotifyIcon? notifyIcon;
20+
private ControlWindow? controlWindow;
2021

2122
// Global hotkey IDs
2223
private const int HOTKEY_TOGGLE = 1;
@@ -101,7 +102,7 @@ private void ShowHelp()
101102
• Right-click taskbar icon for menu
102103
103104
Created by Scott Hanselman
104-
Version 0.5";
105+
Version 0.6";
105106

106107
System.Windows.MessageBox.Show(helpMessage, "Windows Edge Light - Help",
107108
MessageBoxButton.OK, MessageBoxImage.Information);
@@ -138,6 +139,7 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
138139
{
139140
SetupWindow();
140141
CreateFrameGeometry();
142+
CreateControlWindow();
141143

142144
var hwnd = new WindowInteropHelper(this).Handle;
143145
int extendedStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
@@ -153,6 +155,17 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
153155
source.AddHook(HwndHook);
154156
}
155157

158+
private void CreateControlWindow()
159+
{
160+
controlWindow = new ControlWindow(this);
161+
162+
// Position at bottom center of main window
163+
controlWindow.Left = this.Left + (this.Width - controlWindow.Width) / 2;
164+
controlWindow.Top = this.Top + this.Height - controlWindow.Height - 100;
165+
166+
controlWindow.Show();
167+
}
168+
156169
private void CreateFrameGeometry()
157170
{
158171
// Get actual dimensions (accounting for margin)
@@ -220,6 +233,8 @@ protected override void OnClosed(EventArgs e)
220233
notifyIcon.Dispose();
221234
}
222235

236+
controlWindow?.Close();
237+
223238
base.OnClosed(e);
224239
}
225240

@@ -248,13 +263,18 @@ private void ToggleLight()
248263
EdgeLightBorder.Visibility = isLightOn ? Visibility.Visible : Visibility.Collapsed;
249264
}
250265

251-
private void IncreaseBrightness()
266+
public void HandleToggle()
267+
{
268+
ToggleLight();
269+
}
270+
271+
public void IncreaseBrightness()
252272
{
253273
currentOpacity = Math.Min(MaxOpacity, currentOpacity + OpacityStep);
254274
EdgeLightBorder.Opacity = currentOpacity;
255275
}
256276

257-
private void DecreaseBrightness()
277+
public void DecreaseBrightness()
258278
{
259279
currentOpacity = Math.Max(MinOpacity, currentOpacity - OpacityStep);
260280
EdgeLightBorder.Opacity = currentOpacity;

WindowsEdgeLight/WindowsEdgeLight.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
<ApplicationIcon>ringlight_cropped.ico</ApplicationIcon>
1111

1212
<!-- Assembly Information -->
13-
<AssemblyVersion>0.5.0.0</AssemblyVersion>
14-
<FileVersion>0.5.0.0</FileVersion>
15-
<Version>0.5</Version>
13+
<AssemblyVersion>0.6.0.0</AssemblyVersion>
14+
<FileVersion>0.6.0.0</FileVersion>
15+
<Version>0.6</Version>
1616
<Authors>Scott Hanselman</Authors>
1717
<Company>Scott Hanselman</Company>
1818
<Product>Windows Edge Light</Product>

0 commit comments

Comments
 (0)