Skip to content

Commit

Permalink
Add debug toggles for new events
Browse files Browse the repository at this point in the history
  • Loading branch information
xanderfrangos committed Oct 2, 2024
1 parent a0dce86 commit 0c7cdd7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/SettingsWindow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1426,6 +1426,9 @@ export default class SettingsWindow extends PureComponent {
<SettingsOption title="Use Win32 hardware events" input={this.renderToggle("useWin32Event")} />
<SettingsOption title="Use Electron hardware events" input={this.renderToggle("useElectronEvents")} />
<SettingsOption title="Use WM_DISPLAYCHANGE events" input={this.renderToggle("useWmDisplayChangeEvent")} />
<SettingsOption title="Use SC_MONITORPOWER events" input={this.renderToggle("useScMonitorPowerEvent")} />
<SettingsOption title="Use GUID_SESSION_USER_PRESENCE events" input={this.renderToggle("useGuidPresenceEvent")} />
<SettingsOption title="Use GUID_VIDEO_CURRENT_MONITOR_BRIGHTNESS events" input={this.renderToggle("useGuidBrightnessEvent")} />
<SettingsOption title="Reload tray icon on hardware events" input={this.renderToggle("reloadTray")} />
<SettingsOption title="Reload flyout panel on hardware events" input={this.renderToggle("reloadFlyout")} />
<SettingsOption title="Show console window (requires restart)" input={this.renderToggle("showConsole")} />
Expand Down
6 changes: 6 additions & 0 deletions src/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,9 @@ const defaultSettings = {
useWin32Event: true,
useElectronEvents: true,
useWmDisplayChangeEvent: true,
useScMonitorPowerEvent: true,
useGuidPresenceEvent: true,
useGuidBrightnessEvent: true,
reloadTray: true,
reloadFlyout: true,
defaultOverlayType: "safe",
Expand Down Expand Up @@ -2457,6 +2460,7 @@ function createPanel(toggleOnLoad = false, isRefreshing = false) {
}

if(setting.name === "GUID_SESSION_USER_PRESENCE") {
if(!settings.useGuidPresenceEvent) return false;
if(setting.data === 2) {
// Idle
if(!isWindowsUserIdle) {
Expand All @@ -2476,6 +2480,7 @@ function createPanel(toggleOnLoad = false, isRefreshing = false) {
// "Make my device sleep after"
} else if(setting.name === "GUID_VIDEO_CURRENT_MONITOR_BRIGHTNESS") {
// Internal display brightness change
if(!settings.useGuidBrightnessEvent) return false;
if(!ignoreBrightnessEvent) {
for(const hwid2 in monitors) {
const monitor = monitors[hwid2]
Expand All @@ -2492,6 +2497,7 @@ function createPanel(toggleOnLoad = false, isRefreshing = false) {

// WM_SYSCOMMAND
mainWindow.hookWindowMessage(0x0112, (wParam, lParam) => {
if(!settings.useScMonitorPowerEvent) return false;
if(wParam.readUInt32LE() === 61808) {
// SC_MONITORPOWER
if(lParam.readUInt32LE() === 2) {
Expand Down

0 comments on commit 0c7cdd7

Please sign in to comment.