#Requires AutoHotkey v2.0 #SingleInstance Force ; Enable Per-Monitor v2 DPI awareness before any GUI or tray icon is created if !DllCall("SetProcessDpiAwarenessContext", "Ptr", -4, "Ptr") { DllCall("SetProcessDPIAware") } ;@Ahk2Exe-SetMainIcon assets\OLED Engine.ico Persistent ListLines False ProcessSetPriority("BelowNormal") ; Opt out of Windows power throttling (EcoQoS) and timer coalescing so the 40-120 ms timers stay on time with Settings closed try { oledThrottleCfg := Buffer(12, 0) NumPut("UInt", 1, oledThrottleCfg, 0) ; Version NumPut("UInt", 0x5, oledThrottleCfg, 4) ; ControlMask: EXECUTION_SPEED (0x1) | IGNORE_TIMER_RESOLUTION (0x4) NumPut("UInt", 0, oledThrottleCfg, 8) ; StateMask 0 = throttling OFF for both DllCall("kernel32\SetProcessInformation", "Ptr", DllCall("kernel32\GetCurrentProcess", "Ptr"), "Int", 4, "Ptr", oledThrottleCfg.Ptr, "UInt", 12) DllCall("winmm\timeBeginPeriod", "UInt", 1) } SetWinDelay(-1) SetControlDelay(-1) #Include %A_ScriptDir%\scripts\App Automation.ahk #Include %A_ScriptDir%\scripts\Updater.ahk Browser_Dim_Fade_Ms := 350 BrowserPreviewFadeMs := 350 ; ############################################################################## ; ## @CHANGELOG - DEV LOG OF WHAT'S NEW / CHANGED / FIXED ## ; ## (search this file for "@CHANGELOG" to jump here) ## ; ############################################################################## ; ------------------------------------------------------------------------------ ; RELEASE 1.1.0 (next) - APP_VERSION below still says 1.0.0 until this is released ; NEW Presets section in the tray menu: switch presets quickly without opening Settings. (separate chat, date not recorded) ; FIX Secondary monitors that were dimmed / blacked out MANUALLY now wake on mouse movement. (separate chat, date not recorded) ; FIX Cursor flashing and desktop icons not hiding during / after a blackout - see BUILD hide-fix-4 below. (2026-11-26) ; CHANGE Lower background disk / CPU use - see BUILD perf-1 below. (2026-11-26) ; ------------------------------------------------------------------------------ ; BUILD perf-1 (2026-11-26) less background work (disk writes, display-driver queries) ; CHANGE Settings window no longer polls the display driver (HDR state, every 750 ms) while it is minimized or hidden. ; That poll also wiped the 5 s HDR cache, so the idle loop re-queried the driver too. [perf-1] (where: SyncLiveHdrIndicators) ; CHANGE HDR state is re-read from Windows every 30 s (was 5 s). Display / HDR changes are still picked up at once through ; the display-change message and through the script's own HDR toggles. [perf-1] (where: IsPrimaryDisplayHdrEnabled) ; CHANGE OLED-care stats are saved every 5 minutes (was 30 s) and on exit / reload. A crash can lose at most 5 min of stats. ; [perf-1] (where: TickOledCare) ; CHANGE Tray tooltip text is only set when it actually changes (was every second). [perf-1] (where: UpdateTrayRefreshVisuals) ; TODO Not touched on purpose: the window scan that detects playing video (GetMoviePlayingMonitors, every 0.7 s) and the ; desktop-icon rename check (IsDesktopHoldActive). They drive auto-dim, so they cannot be limited to Settings / tray. ; Measure first (frametime capture with the script closed vs running), then throttle if needed. ; ------------------------------------------------------------------------------ ; BUILD hide-fix-4 (2026-11-26) cursor flash + desktop icons not hiding ; FIX Idle hide of the cursor and desktop icons never ran while Monitor 1 was in a MANUAL ; blackout: CheckIdleActivity returned early in that branch. It now runs the hide logic there ; too (unless automation is paused). (where: CheckIdleActivity) ; FIX CursorHideGuard judged "is the cursor still blank?" by reading bitmap pixels. If Windows keeps ; the replaced cursor in another format, that test always failed and the guard re-applied the ; blank cursors again and again (visible flicker). Now it compares cursor handles, logs every ; re-apply, and after 3 tries backs off to one try per 10 s. (where: HideSystemCursors, CursorHideGuard) ; FIX The Settings colour eyedropper ended with SPI_SETCURSORS, which put the real cursors back even ; while they were meant to be hidden. It now re-blanks them at once, and the guard stands down ; while the eyedropper is active. (where: SetEyedropperSystemCursor) ; FIX Cursor hide/show was only re-checked every 120 ms (every 1 s during competitive games), so the ; pointer could show on a black screen. The 40 ms wake poll now re-checks too, and a busy flag ; stops two timers overlapping a hide/restore. (where: FastWakePoll, UpdateCursorVisibility) ; CHANGE Hidden desktop icons are re-asserted every 100 ms (was 500 ms) and immediately after the ; Settings window closes. (where: ICON_ENFORCE_MS, CloseSettingsGui) ; NEW BUILD_ID constant, printed in the startup log and in Ctrl+Alt+H; diagnostics also show how ; often the cursor guard had to re-apply. (where: section 1, ShowHideDiagnostics) ; NEW This @CHANGELOG block. ; KNOWN-ISSUE Not tested on a live Windows session when written. If the flash or the icons come back, ; turn on Debug_Log_Enabled and press Ctrl+Alt+H WHILE it is happening; send both to the next chat. ; KNOWN-ISSUE scripts\App Automation.ahk and scripts\Updater.ahk were not part of this review. ; ; BUILD hide-fix-3 (date not recorded; reconstructed from code comments) ; NEW Ctrl+Alt+H hide diagnostics. NEW CursorHideGuard (re-blank cursors if Windows restores them). ; FIX Stale rename / context-menu "hold" no longer keeps icons visible after 30 s idle. ; CHANGE Typing no longer brings the hidden cursor back (only real mouse movement / clicks do). ; FIX Help cursor (32651) added to the list of cursors that get blanked. ; ------------------------------------------------------------------------------ ; ############################################################################## ; ## ## ; ## PART 1: USER SETTINGS (EDIT HERE) ## ; ## ## ; ## - Every adjustable setting is grouped below by monitor and feature. ## ; ## - After editing, save this file and click "Reload Script" in the tray. ## ; ## - Changes made in the Settings window also update these lines. ## ; ## ## ; ############################################################################## ; ============================================================================== ; [1] MONITOR 1 (PRIMARY DISPLAY) & INTERFACE ; ============================================================================== Primary_Auto_Enabled := false ; [true / false] Enable automatic Monitor 1 idle dim / blackout OLED_HDR_SDR_Mode_Enabled := true ; [true / false] true = Separate HDR & SDR profiles, false = Unified profile Active_HDR_Mode := false ; [true / false] Tracks / sets Monitor 1 HDR vs SDR display output state Comp_Game_Auto_SDR_Enabled := true ; [true / false] Switch Monitor 1 to SDR when a competitive game starts Primary_Dim_Percent := 100 ; [Percent 0-100] SDR / Unified dim level (100 = pure #000000 blackout, 0 = off) Primary_HDR_Dim_Percent := 100 ; [Percent 0-100] HDR dim level (100 = pure #000000 blackout, 0 = off) Primary_Fade_Ms := 350 ; [Milliseconds] Smooth fade speed for Monitor 1 (0 = instant) ; --- Display Care, Sounds, Theme & Debug Log --- UI_Dark_Mode := true ; [true / false] true = Dark Mode, false = Light Mode Debug_Log_Enabled := false ; [true / false] Default OFF; write live state/context/HDR/dim telemetry to log file Debug_Log_Path := "" ; [File path] Custom log file path (blank = logs\debug.log next to the app) Sound_Volume_Step := 1 ; 0, 1, 2, 3 (4 click positions total) UI_Custom_Color := "" ; [Blank or RRGGBB hex] Custom background color for the menu / Settings UI (blank = plain Dark or Light mode) OLED_Refresh_Reminder_Enabled := false ; [true / false] Optional toggle for manual OSD pixel refresh reminders OLED_Refresh_Reminder_Days := 8 ; [Days] Days part of reminder interval OLED_Refresh_Reminder_Hours := 0 ; [Hours] Hours part of reminder interval OLED_Refresh_Reminder_Minutes := 0 ; [Minutes 0-59] Minutes part of reminder interval OLED_Refresh_Popup_Monitor := 1 ; [Monitor 1-5] Target monitor for pixel refresh popup (defaults to main monitor) OLED_Refresh_Alert_Style := "Popup" ; ["Popup" / "Notification"] Alert mode for pixel refresh reminder OLED_Refresh_Popup_Sound := "Calm Rise" ; ["None" / "Soft Chime" / "Gentle Bell" / "Glass Drop" / "Calm Rise" / "Calm Fall" / "Windows Default" / "Windows Notify" / "Windows Ding"] Sound for the Popup alert Dim_Sound_Enabled := false ; [true / false] Play a sound when a monitor dims or blacks out Wake_Sound_Enabled := false ; [true / false] Play a sound when a monitor wakes Dim_Sound_Name := "Gentle Bell" ; [Sound name, same list as above] Sound played on dim / blackout Wake_Sound_Name := "Calm Rise" ; [Sound name, same list as above] Sound played on wake ; --- Monitor 1 SDR / Unified Idle Delays --- Primary_SDR_Desktop_Sec := 5 ; [Seconds] Monitor 1 idle delay on Desktop Primary_SDR_Normal_Sec := 35 ; [Seconds] Monitor 1 idle delay in Standard Games Primary_SDR_Comp_Sec := 45 ; [Seconds] Monitor 1 idle delay in Competitive Games Primary_SDR_Paused_Sec := 5 ; [Seconds] Monitor 1 idle delay when a Video is PAUSED ; --- Monitor 1 HDR Idle Delays (Used when Separate HDR & SDR Profiles is ON and in HDR) --- Primary_HDR_Desktop_Sec := 15 ; [Seconds] Monitor 1 idle delay on Desktop in HDR Primary_HDR_Normal_Sec := 23 ; [Seconds] Monitor 1 idle delay in Standard Games in HDR Primary_HDR_Comp_Sec := 23 ; [Seconds] Monitor 1 idle delay in Competitive Games in HDR Primary_HDR_Paused_Sec := 5 ; [Seconds] Monitor 1 idle delay when a Video is PAUSED in HDR ; ============================================================================== ; [2] ADDITIONAL MONITORS (PER-MONITOR DELAYS, DIM LEVELS & HDR PROFILES) ; ============================================================================== ; --- Monitor 2 --- Extra_Auto_Enabled := false ; [true / false] Enable automatic idle dim / blackout on Monitor 2 Extra_HDR_SDR_Mode_Enabled := false ; [true / false] true = Separate HDR & SDR profiles (when HDR supported), false = Unified Extra_Comp_Game_Auto_SDR := false ; [true / false] Switch Monitor 2 to SDR when a competitive game starts Extra_Dim_Percent := 73 ; [Percent 0-100] Monitor 2 SDR / Unified dim level (100 = pure #000000 blackout) Extra_HDR_Dim_Percent := 73 ; [Percent 0-100] Monitor 2 HDR dim level (100 = pure #000000 blackout) Extra_Fade_Ms := 437 ; [Milliseconds] Smooth fade speed for Monitor 2 (0 = instant) Extra_SDR_Desktop_Sec := 5 ; [Seconds] Monitor 2 SDR idle delay on Desktop Extra_SDR_Normal_Sec := 5 ; [Seconds] Monitor 2 SDR idle delay in Standard Games Extra_SDR_Comp_Sec := 5 ; [Seconds] Monitor 2 SDR idle delay in Competitive Games Extra_SDR_Paused_Sec := 10 ; [Seconds] Monitor 2 SDR idle delay when a Video is PAUSED Extra_HDR_Desktop_Sec := 15 ; [Seconds] Monitor 2 HDR idle delay on Desktop in HDR Extra_HDR_Normal_Sec := 5 ; [Seconds] Monitor 2 HDR idle delay in Standard Games in HDR Extra_HDR_Comp_Sec := 5 ; [Seconds] Monitor 2 HDR idle delay in Competitive Games in HDR Extra_HDR_Paused_Sec := 10 ; [Seconds] Monitor 2 HDR idle delay when a Video is PAUSED in HDR Extra_Game_Carryover_Enabled := true ; [true / false] true = Monitors 2-5 use their Game delays while a game runs on ANOTHER monitor (their Live Status says so); false = every monitor only uses its own window ; --- Monitor 3 --- Mon3_Auto_Enabled := false Mon3_HDR_SDR_Mode_Enabled := false Mon3_Comp_Game_Auto_SDR := false Mon3_Dim_Percent := 73 Mon3_HDR_Dim_Percent := 73 Mon3_Fade_Ms := 300 Mon3_SDR_Desktop_Sec := 15 Mon3_SDR_Normal_Sec := 5 Mon3_SDR_Comp_Sec := 5 Mon3_SDR_Paused_Sec := 10 Mon3_HDR_Desktop_Sec := 15 Mon3_HDR_Normal_Sec := 5 Mon3_HDR_Comp_Sec := 5 Mon3_HDR_Paused_Sec := 10 ; --- Monitor 4 --- Mon4_Auto_Enabled := false Mon4_HDR_SDR_Mode_Enabled := false Mon4_Comp_Game_Auto_SDR := false Mon4_Dim_Percent := 73 Mon4_HDR_Dim_Percent := 73 Mon4_Fade_Ms := 300 Mon4_SDR_Desktop_Sec := 15 Mon4_SDR_Normal_Sec := 5 Mon4_SDR_Comp_Sec := 5 Mon4_SDR_Paused_Sec := 10 Mon4_HDR_Desktop_Sec := 15 Mon4_HDR_Normal_Sec := 5 Mon4_HDR_Comp_Sec := 5 Mon4_HDR_Paused_Sec := 10 ; --- Monitor 5 --- Mon5_Auto_Enabled := false Mon5_HDR_SDR_Mode_Enabled := false Mon5_Comp_Game_Auto_SDR := false Mon5_Dim_Percent := 73 Mon5_HDR_Dim_Percent := 73 Mon5_Fade_Ms := 300 Mon5_SDR_Desktop_Sec := 15 Mon5_SDR_Normal_Sec := 5 Mon5_SDR_Comp_Sec := 5 Mon5_SDR_Paused_Sec := 10 Mon5_HDR_Desktop_Sec := 15 Mon5_HDR_Normal_Sec := 5 Mon5_HDR_Comp_Sec := 5 Mon5_HDR_Paused_Sec := 10 ; ============================================================================== ; [3] DESKTOP ICONS, CURSOR & STARTUP ; ============================================================================== Desktop_Hide_Enabled := false ; [true / false] Fade desktop icons on idle Cursor_Hide_Enabled := false ; [true / false] Hide the mouse cursor on idle Desktop_Idle_Sec := 2 ; [Seconds] Idle delay before hiding cursor & fading desktop icons Icon_Fade_Ms := 709 ; [Milliseconds] Smooth fade speed for desktop icons (0 = instant) Start_With_Windows := false ; [true / false] Launch automatically when signing in to Windows Start_Minimized := false ; [true / false] Start silently in the system tray without opening Settings ; ============================================================================== ; [4] COMPETITIVE GAMES & NEVER-DIM EXCLUSIONS LIST ; ============================================================================== Comp_Games_List := "RainbowSix.exe" ; [Comma-separated .exe names] Excluded_Processes_List := "" ; [Comma-separated .exe names] Pause auto-dim/blackout while any listed process is running ; ============================================================================== ; [5] TRAY MENU ORDER & VISIBILITY (Settings & Exit are fixed; IDs: pause, auto_dim, hdr_toggle, hdr_sdr, refresh, blackout, sec_dim, desk_hide, presets, edit, reload) ; ============================================================================== Tray_Menu_Config := "pause:1,auto_dim:1,hdr_toggle:1,hdr_sdr:0,refresh:1,blackout:1,sec_dim:1,desk_hide:1,presets:1,edit:0" ; [Ordered comma-separated item:enabled(1/0)] ; ============================================================================== ; [6] PER-MONITOR HOTKEYS (BLANK = DISABLED; RESPECTS EACH MONITOR'S DIM LEVEL) ; ============================================================================== Mon1_Hotkey := "Insert" ; [AHK Hotkey] Toggle Dim / Blackout on Monitor 1 Mon2_Hotkey := "PgUp" ; [AHK Hotkey] Toggle Dim / Blackout on Monitor 2 Mon3_Hotkey := "" ; [AHK Hotkey] Toggle Dim / Blackout on Monitor 3 Mon4_Hotkey := "" ; [AHK Hotkey] Toggle Dim / Blackout on Monitor 4 Mon5_Hotkey := "" ; [AHK Hotkey] Toggle Dim / Blackout on Monitor 5 ; ============================================================================== ; [6b] LONG-IDLE DISPLAY OFF, ADMIN & PRESETS (managed on the Presets tab) ; ============================================================================== ; These are saved by the Presets tab into