Skip to content

Commit

Permalink
Add manual sync feature, and change left click to trigger it
Browse files Browse the repository at this point in the history
  • Loading branch information
HunterZ committed Sep 25, 2017
1 parent 8eeb970 commit 5be7a67
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ I have an Alienware 17R3 laptop and have been using AlienFX WinTheme to sync the
## Usage
Simply launch UniLight and forget about it. Configure Windows to launch it at startup if you want.

UniLight appears as a system tray icon that looks like a color wheel, and polls the Windows accent color at a rate of 1Hz (to minimize CPU usage). On startup and whenever any changes are detected, it calls the LightFX/AlienFX and Logitech Gaming LED APIs to set all RGB LEDs to the current accent color.
UniLight appears as a system tray icon that looks like a color wheel, and listens for changes to accent color or other conditions that may affect LED color synchronization. On startup and whenever any relevant changes are detected, it calls the LightFX/AlienFX and Logitech Gaming LED APIs to set all RGB LEDs to the current accent color.

Hovering the mouse cursor over the UniLight tray icon will produce a tooltip containing status information, including the current and last accent colors, and whether they were successfully applied to Alienware and/or Logitech devices.

Right-clicking the tray icon will bring up an about/exit menu, while left-clicking brings up the About popup.
Right-clicking the tray icon will bring up a context menu with self-explanatory selections, while left-clicking performs a manual color synchronization.

## System Requirements
I'm not 100% sure about these. I tried to implement the Alienware and Logitech API access in such a way that it will fail gracefully if either API is not supported on your system. UniLight will also attempt to re-apply the color on every color change, so that there is some hope of avoiding a restart if relevant peripherals are (re)connected after UniLight has already been launched. I haven't tried to make it any more aggressive because I have to poll both APIs (neither provides a notification callback mechanism) and I don't want UniLight to have a noticeable performance impact on gaming or other tasks.

UniLight should load the AlienFX and/or Logitech Gaming LED DLLs that you have installed as part of Alienware Command Center (minimum version unknown; I'm currently on 4.5.19) and Logitech Gaming Software (version 8.55 or higher required for LED support), respectively. Also, the binary distribution of this program is 32-bit for maximum compatibility (I'm running it on 64-bit systems, so I know it works there).

As of version 1.1, UniLight is completely event-driven and no longer polls the Windows accent color on a timer. The result should be extremely minimal CPU usage.

## Tools used
This project was created with Microsoft Visual Studio Community 2015, Alienware AlienFX 1.0 SDK (formerly Dell LightFX), and Logitech Gaming LED SDK.

Expand Down
13 changes: 8 additions & 5 deletions UniLight/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ typedef struct _iobuf FILE;
#include <fcntl.h>
*/
#define ID_TRAY_APP_ICON 1001
#define ID_TRAY_EXIT 1002
#define ID_TRAY_SYNC 1002
#define ID_TRAY_ABOUT 1003
#define ID_TRAY_EXIT 1004
#define WM_SYSICON (WM_USER + 1)

namespace
Expand Down Expand Up @@ -135,7 +136,7 @@ LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM
// check for mouse actions
if (lParam == WM_LBUTTONUP)
{
ShowAbout(hwnd);
GetAndUpdateColor();
}
else if (lParam == WM_RBUTTONUP)
{
Expand All @@ -147,8 +148,9 @@ LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM
const UINT clicked(TrackPopupMenu(Hmenu, TPM_RETURNCMD | TPM_NONOTIFY, curPoint.x, curPoint.y, 0, hwnd, NULL));
switch (clicked)
{
case ID_TRAY_EXIT: PostQuitMessage(0); break; // quit the application
case ID_TRAY_ABOUT: ShowAbout(hwnd); break; // show about menu
case ID_TRAY_SYNC: GetAndUpdateColor(); break; // manual color sync
case ID_TRAY_ABOUT: ShowAbout(hwnd); break; // show about menu
case ID_TRAY_EXIT: PostQuitMessage(0); break; // quit the application
}
}
}
Expand Down Expand Up @@ -185,8 +187,9 @@ int WINAPI WinMain(HINSTANCE hThisInstance,

// setup right-click popup menu
Hmenu = CreatePopupMenu();
AppendMenu(Hmenu, MF_STRING, ID_TRAY_SYNC, TEXT("Synchronize manually"));
SetMenuDefaultItem(Hmenu, ID_TRAY_SYNC, FALSE);
AppendMenu(Hmenu, MF_STRING, ID_TRAY_ABOUT, TEXT("About UniLight..."));
SetMenuDefaultItem(Hmenu, ID_TRAY_ABOUT, FALSE);
AppendMenu(Hmenu, MF_STRING, ID_TRAY_EXIT, TEXT("Exit"));

// create window prototype
Expand Down

0 comments on commit 5be7a67

Please sign in to comment.