forked from Shinonome/dots-hyprland
brightness: use connector name to distinguish different monitors
One may have multiple monitors of the same model
This commit is contained in:
@@ -58,7 +58,7 @@ Singleton {
|
|||||||
if (data.startsWith("Display ")) {
|
if (data.startsWith("Display ")) {
|
||||||
const lines = data.split("\n").map(l => l.trim());
|
const lines = data.split("\n").map(l => l.trim());
|
||||||
root.ddcMonitors.push({
|
root.ddcMonitors.push({
|
||||||
model: lines.find(l => l.startsWith("Monitor:")).split(":")[2],
|
name: lines.find(l => l.startsWith("DRM connector:")).split("-").slice(1).join('-'),
|
||||||
busNum: lines.find(l => l.startsWith("I2C bus:")).split("/dev/i2c-")[1]
|
busNum: lines.find(l => l.startsWith("I2C bus:")).split("/dev/i2c-")[1]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -76,11 +76,11 @@ Singleton {
|
|||||||
|
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
readonly property bool isDdc: {
|
readonly property bool isDdc: {
|
||||||
const match = root.ddcMonitors.find(m => m.model === screen.model && !root.monitors.slice(0, root.monitors.indexOf(this)).some(mon => mon.busNum === m.busNum));
|
const match = root.ddcMonitors.find(m => m.name === screen.name && !root.monitors.slice(0, root.monitors.indexOf(this)).some(mon => mon.busNum === m.busNum));
|
||||||
return !!match;
|
return !!match;
|
||||||
}
|
}
|
||||||
readonly property string busNum: {
|
readonly property string busNum: {
|
||||||
const match = root.ddcMonitors.find(m => m.model === screen.model && !root.monitors.slice(0, root.monitors.indexOf(this)).some(mon => mon.busNum === m.busNum));
|
const match = root.ddcMonitors.find(m => m.name === screen.name && !root.monitors.slice(0, root.monitors.indexOf(this)).some(mon => mon.busNum === m.busNum));
|
||||||
return match?.busNum ?? "";
|
return match?.busNum ?? "";
|
||||||
}
|
}
|
||||||
property int rawMaxBrightness: 100
|
property int rawMaxBrightness: 100
|
||||||
@@ -215,7 +215,7 @@ Singleton {
|
|||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: screenshotProc
|
id: screenshotProc
|
||||||
command: ["bash", "-c",
|
command: ["bash", "-c",
|
||||||
`mkdir -p '${StringUtils.shellSingleQuoteEscape(root.screenshotDir)}'`
|
`mkdir -p '${StringUtils.shellSingleQuoteEscape(root.screenshotDir)}'`
|
||||||
+ ` && grim -o '${StringUtils.shellSingleQuoteEscape(screenScope.screenName)}' -`
|
+ ` && grim -o '${StringUtils.shellSingleQuoteEscape(screenScope.screenName)}' -`
|
||||||
+ ` | magick png:- -colorspace Gray -format "%[fx:mean*100]" info:`
|
+ ` | magick png:- -colorspace Gray -format "%[fx:mean*100]" info:`
|
||||||
|
|||||||
Reference in New Issue
Block a user