2024-01-30 11:29:07 -05:00
|
|
|
const Hyprland = await Service.import('hyprland');
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2024-01-30 11:29:07 -05:00
|
|
|
const { CenterBox, Label } = Widget;
|
|
|
|
const { execAsync } = Utils;
|
2023-09-21 20:01:14 -04:00
|
|
|
|
2024-01-13 23:38:31 -05:00
|
|
|
import PopupWindow from './misc/popup.ts';
|
|
|
|
import CursorBox from './misc/cursorbox.ts';
|
2023-08-27 10:31:41 -04:00
|
|
|
|
2023-10-02 12:06:35 -04:00
|
|
|
|
2023-10-17 13:47:02 -04:00
|
|
|
const PowermenuWidget = () => CenterBox({
|
2023-12-18 23:20:32 -05:00
|
|
|
class_name: 'powermenu',
|
2023-10-20 23:11:21 -04:00
|
|
|
vertical: false,
|
2023-08-27 10:31:41 -04:00
|
|
|
|
2023-12-23 01:14:21 -05:00
|
|
|
start_widget: CursorBox({
|
2023-12-24 00:25:55 -05:00
|
|
|
class_name: 'shutdown button',
|
2023-12-18 23:20:32 -05:00
|
|
|
on_primary_click_release: () => execAsync(['systemctl', 'poweroff'])
|
2023-11-21 01:29:46 -05:00
|
|
|
.catch(print),
|
2023-08-27 10:31:41 -04:00
|
|
|
|
2023-10-20 23:11:21 -04:00
|
|
|
child: Label({
|
|
|
|
label: '襤',
|
|
|
|
}),
|
2023-08-27 10:31:41 -04:00
|
|
|
}),
|
|
|
|
|
2023-12-23 01:14:21 -05:00
|
|
|
center_widget: CursorBox({
|
2023-12-24 00:25:55 -05:00
|
|
|
class_name: 'reboot button',
|
2023-12-18 23:20:32 -05:00
|
|
|
on_primary_click_release: () => execAsync(['systemctl', 'reboot'])
|
2023-11-21 01:29:46 -05:00
|
|
|
.catch(print),
|
2023-08-27 10:31:41 -04:00
|
|
|
|
2023-10-20 23:11:21 -04:00
|
|
|
child: Label({
|
|
|
|
label: '勒',
|
|
|
|
}),
|
2023-08-27 10:31:41 -04:00
|
|
|
}),
|
|
|
|
|
2023-12-23 01:14:21 -05:00
|
|
|
end_widget: CursorBox({
|
2023-12-24 00:25:55 -05:00
|
|
|
class_name: 'logout button',
|
2024-02-11 02:18:59 -05:00
|
|
|
on_primary_click_release: () => Hyprland.messageAsync('dispatch exit')
|
2023-11-21 01:29:46 -05:00
|
|
|
.catch(print),
|
2023-08-27 10:31:41 -04:00
|
|
|
|
2023-10-20 23:11:21 -04:00
|
|
|
child: Label({
|
|
|
|
label: '',
|
|
|
|
}),
|
2023-08-27 10:31:41 -04:00
|
|
|
}),
|
|
|
|
});
|
2023-09-21 20:01:14 -04:00
|
|
|
|
2023-10-16 18:11:19 -04:00
|
|
|
export default () => PopupWindow({
|
2023-10-20 23:11:21 -04:00
|
|
|
name: 'powermenu',
|
2024-01-29 18:54:07 -05:00
|
|
|
content: PowermenuWidget(),
|
2023-09-21 20:01:14 -04:00
|
|
|
});
|