nixos-configs/config/ags/js/common.js

36 lines
849 B
JavaScript
Raw Normal View History

2023-08-27 11:28:14 -04:00
export const Closer = ags.Widget.Window({
name: 'closer',
popup: true,
layer: 'top',
anchor: 'top bottom left right',
child: ags.Widget.EventBox({
onPrimaryClickRelease: () => {
ags.App.closeWindow('powermenu');
ags.App.closeWindow('closer');
},
}),
});
2023-09-04 22:27:34 -04:00
export const Separator = width => ags.Widget.Box({
style: `min-width: ${width}px;`,
});
import Gdk from 'gi://Gdk';
const display = Gdk.Display.get_default();
export const EventBox = ({ ...params }) => ags.Widget.EventBox({
...params,
onHover: box => {
if (! box.child.sensitive || ! box.sensitive) {
box.window.set_cursor(Gdk.Cursor.new_from_name(display, 'not-allowed'));
}
else {
box.window.set_cursor(Gdk.Cursor.new_from_name(display, 'pointer'));
}
2023-09-04 22:27:34 -04:00
},
onHoverLost: box => {
box.window.set_cursor(null);
},
});