DimmerApp is a Windows Forms application that dims all screens except the default screen when a specific window is active. The application runs in the system tray and provides options to show the main form or exit the application.
- Dim all screens except the default screen when a specific window is active.
- Configurable settings for window titles, color, and opacity of the overlay.
- Runs in the system tray with options to show the main form or exit the application.
- Edit configuration settings through a configuration editor.
- .NET Framework 4.8
- Visual Studio
- Download the latest Release.zip file
- Unzip the file to the location of your choice
- Run DimmerApp.exe
-
Clone the repository: git clone https://github.com/Matsonson/DimmerApp.git
-
Open the solution in Visual Studio.
-
Build the solution to restore the NuGet packages and compile the project.
- Run the application. It will start minimized to the system tray.
- Right-click the tray icon to show the main form or exit the application.
- Use the "Edit Config" button in the main form to open the configuration editor and modify settings.
- The application will automatically dim all screens except the default screen when a window with a specified title is active.
To run the app on startup, add shortcut to startup folder. (Win+R -> "shell:startup")
The configuration settings are stored in a config.json file. The settings include:
DefaultScreen: The screen that should not be dimmed.WindowTitles: An array of window titles to match.PartialMatch: A boolean indicating whether to use partial matching for window titles.Color: The color of the overlay.Opacity: The opacity of the overlay.
Example config.json:
{ "DefaultScreen": "\.\DISPLAY1", "WindowTitles": ["Home", "Work"], "PartialMatch": true, "Color": "#000000", "Opacity": 0.5 }
The MainForm class is the main form of the application. It initializes the NotifyIcon, context menu, and buttons. It also handles loading the configuration and starting the OverlayManager.
The OverlayManager class manages the overlay forms. It applies and clears overlays based on the active window title. It uses the Invoke method to ensure UI updates are performed on the UI thread.
The OverlayForm class represents the overlay form that dims the screen. It uses P/Invoke to set window styles.
The WindowChecker class provides methods to get the title of the active window using P/Invoke.
The AppConfig class represents the configuration settings for the application.