Skip to content

Commit 167c59d

Browse files
committed
Add SDR brightness hotkey support
1 parent 9411b80 commit 167c59d

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/components/SettingsWindow.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1651,7 +1651,7 @@ function ActionItem(props) {
16511651
return null
16521652
} else {
16531653
let selectBoxValue = action.target
1654-
if (!(selectBoxValue === "brightness" || selectBoxValue === "contrast" || selectBoxValue === "volume" || selectBoxValue === "powerState")) {
1654+
if (!(selectBoxValue === "brightness" || selectBoxValue === "sdr" || selectBoxValue === "contrast" || selectBoxValue === "volume" || selectBoxValue === "powerState")) {
16551655
selectBoxValue = "vcp"
16561656
}
16571657
const selectBox = (
@@ -1670,6 +1670,7 @@ function ActionItem(props) {
16701670
<option value="contrast">{T.t("PANEL_LABEL_CONTRAST")}</option>
16711671
<option value="volume">{T.t("PANEL_LABEL_VOLUME")}</option>
16721672
<option value="vcp">{T.t("SETTINGS_FEATURES_ADD_VCP")}</option>
1673+
<option value="sdr">{T.t("SETTINGS_FEATURES_SDR_BRIGHTNESS")}</option>
16731674
</select>
16741675
</div>
16751676
)

src/electron.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,8 @@ async function doHotkey(hotkey) {
11161116
let currentValue = 0
11171117
if (action.target === "brightness") {
11181118
currentValue = monitor.brightness
1119+
} else if (action.target === "sdr") {
1120+
currentValue = monitor.sdrLevel ?? 0
11191121
} else if (action.target === "contrast") {
11201122
currentValue = await getVCP(monitor, parseInt("0x12"))
11211123
} else if (action.target === "volume") {
@@ -1136,6 +1138,8 @@ async function doHotkey(hotkey) {
11361138
let currentCycleValue = 0
11371139
if (action.target === "brightness") {
11381140
currentCycleValue = monitor.brightness
1141+
} else if (action.target === "sdr") {
1142+
currentCycleValue = monitor.sdrLevel ?? 0
11391143
} else if (action.target === "contrast") {
11401144
currentCycleValue = await getVCP(monitor, parseInt("0x12"))
11411145
} else if (action.target === "volume") {
@@ -1196,6 +1200,8 @@ async function doHotkey(hotkey) {
11961200
writeSettings({ linkedLevelsActive: false })
11971201
}
11981202
showOverlay = true
1203+
} else if(action.target === "sdr") {
1204+
updateBrightnessThrottle(monitor.id, parseInt(value), false, true, "sdr")
11991205
} else {
12001206
let vcpCode = action.target
12011207
if (action.target === "contrast") {
@@ -1933,6 +1939,7 @@ function updateBrightness(index, newLevel, useCap = true, vcpValue = "brightness
19331939
brightness: level,
19341940
id: monitor.id
19351941
})
1942+
monitor.sdrLevel = level
19361943
} else if (monitor.type == "ddcci") {
19371944
if (vcp === "brightness") {
19381945
monitor.brightness = level

src/localization/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
"SETTINGS_FEATURES_VCP_LIST_TITLE": "All VCP codes reported by this display",
140140
"SETTINGS_FEATURES_VCP_LIST_DESC": "The following is a list of available VCP codes reported by this display to Windows. Twinkle Tray does not validate the functionality or stability of these VCP codes. Use them at your own risk.",
141141
"SETTINGS_FEATURES_VCP_EXPECTED": "Expected values",
142+
"SETTINGS_FEATURES_SDR_BRIGHTNESS": "SDR Brightness",
142143
"SETTINGS_TIME_TITLE": "Time of Day Adjustments",
143144
"SETTINGS_TIME_DESC": "Automatically set your monitors to a specific brightness level at a desired time. All monitors will be set to the same, normalized levels.",
144145
"SETTINGS_TIME_ADD": "Add a time",

0 commit comments

Comments
 (0)