[AGS] Brightness: Fix, add CLI

This commit is contained in:
2025-04-27 10:48:07 +02:00
parent 364b5cb0ef
commit 710eeb7fb4
2 changed files with 33 additions and 7 deletions

View File

@@ -4,19 +4,20 @@ import Brightness from "../../../../util/brightness";
const brightness = Brightness.get_default();
const BrightnessModule = () => {
print( brightness.screen * 100 );
const setBrightness = (value: number) => {
brightness.set_property('screen', value / 100);
brightness.screen = value;
}
return (
<box visible={bind(brightness, 'screenAvailable')}>
<image iconName={"brightness-high-symbolic"}></image>
<label label={bind(brightness, "screen").as(b => `${Math.round(100 * b)}%`)}></label>
<slider
value={bind(brightness, "screen").as(b => 100 * b)}
value={Math.round( brightness.screen * 100) / 100}
hexpand
max={100}
min={0}
step={1}
max={1}
min={0.01}
step={0.01}
vexpand
onChangeValue={self => setBrightness(self.value)}
></slider>