nixos-configs/modules/ags/config/widgets/brightness-slider/main.tsx
matt1432 7acb86fd98
All checks were successful
Discord / discord commits (push) Has been skipped
feat(ags): add brightness slider
2025-01-29 17:46:36 -05:00

35 lines
973 B
TypeScript

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>
);
};