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

50 lines
1.2 KiB
TypeScript
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.ts';
import CursorBox from './misc/cursorbox.ts';
2023-08-27 10:31:41 -04:00
const PowermenuWidget = () => CenterBox({
class_name: 'powermenu',
// @ts-expect-error
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',
on_primary_click_release: () => 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',
child: PowermenuWidget(),
});