ags: implement per-monitor brightness control

This commit is contained in:
MoetaYuko
2024-05-01 15:23:30 +08:00
parent de0d5ffdf0
commit 7d45e9dc1b
6 changed files with 81 additions and 26 deletions
@@ -49,16 +49,16 @@ const OsdValue = ({
});
}
export default () => {
export default (monitor = 0) => {
const brightnessIndicator = OsdValue({
name: 'Brightness',
extraClassName: 'osd-brightness',
extraProgressClassName: 'osd-brightness-progress',
labelSetup: (self) => self.hook(Brightness, self => {
self.label = `${Math.round(Brightness.screen_value * 100)}`;
labelSetup: (self) => self.hook(Brightness[monitor], self => {
self.label = `${Math.round(Brightness[monitor].screen_value * 100)}`;
}, 'notify::screen-value'),
progressSetup: (self) => self.hook(Brightness, (progress) => {
const updateValue = Brightness.screen_value;
progressSetup: (self) => self.hook(Brightness[monitor], (progress) => {
const updateValue = Brightness[monitor].screen_value;
progress.value = updateValue;
}, 'notify::screen-value'),
});
@@ -109,4 +109,4 @@ export default () => {
]
})
});
}
}
+1 -2
View File
@@ -22,7 +22,7 @@ export default (monitor = 0) => Widget.Window({
className: 'osd-window',
css: 'min-height: 2px;',
children: [
IndicatorValues(),
IndicatorValues(monitor),
MusicControls(),
NotificationPopups(),
ColorScheme(),
@@ -30,4 +30,3 @@ export default (monitor = 0) => Widget.Window({
})
}),
});