feat(ags): add brightness slider

This commit is contained in:
matt1432 2025-01-29 17:46:36 -05:00
parent eaecd0eec5
commit 7acb86fd98
3 changed files with 58 additions and 3 deletions
modules/ags/config/widgets/brightness-slider

View file

@ -0,0 +1,35 @@
import { bind } from 'astal';
import { Astal, Gtk } from 'astal/gtk3';
import Brightness from '../../services/brightness';
import PopupWindow from '../misc/popup-window';
export default () => {
const brightness = Brightness.get_default();
return (
<PopupWindow
name="brightness-slider"
anchor={Astal.WindowAnchor.RIGHT | Astal.WindowAnchor.TOP}
>
<box className="widget" widthRequest={500}>
<slider
hexpand
halign={Gtk.Align.FILL}
drawValue
cursor="pointer"
min={0}
max={100}
value={bind(brightness, 'screen').as((v) => v * 100)}
onDragged={(self) => {
brightness.screen = Number((self.value / 100).toFixed(2));
}}
/>
</box>
</PopupWindow>
);
};