2023-11-13 13:19:14 -05:00
|
|
|
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-10-31 08:32:40 -04:00
|
|
|
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';
|
2023-09-21 20:01:14 -04:00
|
|
|
|
2023-10-17 13:47:02 -04:00
|
|
|
import PopupWindow from './misc/popup.js';
|
2023-12-18 23:20:32 -05:00
|
|
|
import CursorBox from './misc/cursorbox.js';
|
2023-08-27 10:31:41 -04:00
|
|
|
|
2023-10-02 12:06:35 -04:00
|
|
|
|
2023-12-19 12:28:29 -05:00
|
|
|
// FIXME: eventboxes are the wrong size
|
2023-10-17 13:47:02 -04:00
|
|
|
const PowermenuWidget = () => CenterBox({
|
2023-12-18 23:20:32 -05:00
|
|
|
class_name: 'powermenu',
|
|
|
|
// @ts-expect-error
|
2023-10-20 23:11:21 -04:00
|
|
|
vertical: false,
|
2023-08-27 10:31:41 -04:00
|
|
|
|
2023-12-18 23:20:32 -05:00
|
|
|
startWidget: CursorBox({
|
|
|
|
class_name: 'shutdown',
|
|
|
|
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-18 23:20:32 -05:00
|
|
|
centerWidget: CursorBox({
|
|
|
|
class_name: 'reboot',
|
|
|
|
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-18 23:20:32 -05:00
|
|
|
endWidget: CursorBox({
|
|
|
|
class_name: 'logout',
|
|
|
|
on_primary_click_release: () => Hyprland.sendMessage('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',
|
|
|
|
transition: 'crossfade',
|
|
|
|
child: PowermenuWidget(),
|
2023-09-21 20:01:14 -04:00
|
|
|
});
|