nixos-configs/modules/ags/config/ts/powermenu.ts

50 lines
1.1 KiB
TypeScript
Raw Normal View History

const Hyprland = await Service.import('hyprland');
const { CenterBox, Label } = Widget;
const { execAsync } = Utils;
import PopupWindow from './misc/popup.ts';
import CursorBox from './misc/cursorbox.ts';
2023-08-27 10:31:41 -04:00
const PowermenuWidget = () => CenterBox({
class_name: 'powermenu',
vertical: false,
2023-08-27 10:31:41 -04:00
2023-12-23 01:14:21 -05:00
start_widget: CursorBox({
class_name: 'shutdown button',
on_primary_click_release: () => execAsync(['systemctl', 'poweroff'])
.catch(print),
2023-08-27 10:31:41 -04:00
child: Label({
label: '襤',
}),
2023-08-27 10:31:41 -04:00
}),
2023-12-23 01:14:21 -05:00
center_widget: CursorBox({
class_name: 'reboot button',
on_primary_click_release: () => execAsync(['systemctl', 'reboot'])
.catch(print),
2023-08-27 10:31:41 -04:00
child: Label({
label: '勒',
}),
2023-08-27 10:31:41 -04:00
}),
2023-12-23 01:14:21 -05:00
end_widget: CursorBox({
class_name: 'logout button',
2024-02-11 02:18:59 -05:00
on_primary_click_release: () => Hyprland.messageAsync('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: 'slide bottom',
child: PowermenuWidget(),
});