nixos-configs/modules/ags/config/widgets/bar/items/brightness.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

40 lines
1 KiB
TypeScript

import { bind } from 'astal';
import { App } from 'astal/gtk3';
import Brightness from '../../../services/brightness';
import PopupWindow from '../../misc/popup-window';
export default () => {
const brightness = Brightness.get_default();
return (
<button
cursor="pointer"
className="bar-item brightness"
onButtonReleaseEvent={(self) => {
const win = App.get_window('win-brightness-slider') as PopupWindow;
win.set_x_pos(
self.get_allocation(),
'right',
);
win.set_visible(!win.get_visible());
}}
>
<overlay passThrough>
<circularprogress
startAt={0.75}
endAt={0.75}
value={bind(brightness, 'screen')}
rounded
/>
<icon icon={bind(brightness, 'screenIcon')} />
</overlay>
</button>
);
};