Skip to content

Commit 952296a

Browse files
committed
Add SDR brightness hotkey support
1 parent e96b942 commit 952296a

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
@@ -1653,7 +1653,7 @@ function ActionItem(props) {
16531653
return null
16541654
} else {
16551655
let selectBoxValue = action.target
1656-
if (!(selectBoxValue === "brightness" || selectBoxValue === "contrast" || selectBoxValue === "volume" || selectBoxValue === "powerState")) {
1656+
if (!(selectBoxValue === "brightness" || selectBoxValue === "sdr" || selectBoxValue === "contrast" || selectBoxValue === "volume" || selectBoxValue === "powerState")) {
16571657
selectBoxValue = "vcp"
16581658
}
16591659
const selectBox = (
@@ -1672,6 +1672,7 @@ function ActionItem(props) {
16721672
<option value="contrast">{T.t("PANEL_LABEL_CONTRAST")}</option>
16731673
<option value="volume">{T.t("PANEL_LABEL_VOLUME")}</option>
16741674
<option value="vcp">{T.t("SETTINGS_FEATURES_ADD_VCP")}</option>
1675+
<option value="sdr">{T.t("SETTINGS_FEATURES_SDR_BRIGHTNESS")}</option>
16751676
</select>
16761677
</div>
16771678
)

src/electron.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,8 @@ async function doHotkey(hotkey) {
11471147
let currentValue = 0
11481148
if (action.target === "brightness") {
11491149
currentValue = monitor.brightness
1150+
} else if (action.target === "sdr") {
1151+
currentValue = monitor.sdrLevel ?? 0
11501152
} else if (action.target === "contrast") {
11511153
currentValue = await getVCP(monitor, parseInt("0x12"))
11521154
} else if (action.target === "volume") {
@@ -1167,6 +1169,8 @@ async function doHotkey(hotkey) {
11671169
let currentCycleValue = 0
11681170
if (action.target === "brightness") {
11691171
currentCycleValue = monitor.brightness
1172+
} else if (action.target === "sdr") {
1173+
currentCycleValue = monitor.sdrLevel ?? 0
11701174
} else if (action.target === "contrast") {
11711175
currentCycleValue = await getVCP(monitor, parseInt("0x12"))
11721176
} else if (action.target === "volume") {
@@ -1227,6 +1231,8 @@ async function doHotkey(hotkey) {
12271231
writeSettings({ linkedLevelsActive: false })
12281232
}
12291233
showOverlay = true
1234+
} else if(action.target === "sdr") {
1235+
updateBrightnessThrottle(monitor.id, parseInt(value), false, true, "sdr")
12301236
} else {
12311237
let vcpCode = action.target
12321238
if (action.target === "contrast") {
@@ -1962,6 +1968,7 @@ function updateBrightness(index, newLevel, useCap = true, vcpValue = "brightness
19621968
brightness: level,
19631969
id: monitor.id
19641970
})
1971+
monitor.sdrLevel = level
19651972
} else if (monitor.type == "ddcci") {
19661973
if (vcp === "brightness") {
19671974
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)