nixos-configs/devices/wim/config/ags/js/powermenu.js

49 lines
1.2 KiB
JavaScript
Raw Normal View History

import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
import { CenterBox, Label } from 'resource:///com/github/Aylur/ags/widget.js';
2023-11-06 18:37:23 -05:00
import { execAsync } from 'resource:///com/github/Aylur/ags/utils.js';
import PopupWindow from './misc/popup.js';
import Button from './misc/cursorbox.js';
2023-08-27 10:31:41 -04:00
const PowermenuWidget = () => CenterBox({
className: 'powermenu',
vertical: false,
2023-08-27 10:31:41 -04:00
startWidget: Button({
2023-11-06 18:37:23 -05:00
isButton: true,
className: 'shutdown',
2023-11-06 18:37:23 -05:00
onPrimaryClickRelease: () => execAsync(['systemctl', 'poweroff']).catch(print),
2023-08-27 10:31:41 -04:00
child: Label({
label: '襤',
}),
2023-08-27 10:31:41 -04:00
}),
centerWidget: Button({
2023-11-06 18:37:23 -05:00
isButton: true,
className: 'reboot',
2023-11-06 18:37:23 -05:00
onPrimaryClickRelease: () => execAsync(['systemctl', 'reboot']).catch(print),
2023-08-27 10:31:41 -04:00
child: Label({
label: '勒',
}),
2023-08-27 10:31:41 -04:00
}),
endWidget: Button({
2023-11-06 18:37:23 -05:00
isButton: true,
className: 'logout',
onPrimaryClickRelease: () => Hyprland.sendMessage('dispatch exit').catch(print),
2023-08-27 10:31:41 -04:00
child: Label({
label: '',
}),
2023-08-27 10:31:41 -04:00
}),
});
export default () => PopupWindow({
name: 'powermenu',
transition: 'crossfade',
child: PowermenuWidget(),
});