2023-10-07 20:41:24 -04:00
|
|
|
import { Widget, Hyprland, Utils, Variable } from '../../imports.js';
|
2023-10-16 13:55:31 -04:00
|
|
|
const { Box, EventBox, Overlay } = Widget;
|
2023-10-07 20:41:24 -04:00
|
|
|
|
|
|
|
const Revealed = Variable(true);
|
|
|
|
const Hovering = Variable(false);
|
|
|
|
|
2023-10-17 13:47:02 -04:00
|
|
|
import { RoundedCorner } from '../screen-corners.js';
|
|
|
|
import Gesture from './gesture.js';
|
2023-10-07 20:41:24 -04:00
|
|
|
|
|
|
|
|
2023-10-17 23:21:24 -04:00
|
|
|
// TODO: add fullscreen status in hyprland.ts
|
|
|
|
// TODO: when fullscreen changes, keep current workspace in memory.
|
|
|
|
// if it changes while still in fullscreen, check directly
|
|
|
|
// with hyprctl if in fullscreen or not until fullscreen
|
|
|
|
// status changes again
|
|
|
|
|
2023-10-17 13:47:02 -04:00
|
|
|
export default (props) => Overlay({
|
2023-10-16 13:55:31 -04:00
|
|
|
overlays: [
|
2023-10-17 13:47:02 -04:00
|
|
|
RoundedCorner('topleft', { className: 'corner' }),
|
|
|
|
RoundedCorner('topright', { className: 'corner' }),
|
2023-10-16 13:55:31 -04:00
|
|
|
],
|
|
|
|
|
|
|
|
child: Box({
|
|
|
|
style: 'min-height: 1px',
|
|
|
|
hexpand: true,
|
|
|
|
vertical: true,
|
|
|
|
children: [
|
|
|
|
Widget.Revealer({
|
|
|
|
transition: 'slide_down',
|
|
|
|
setup: self => self.revealChild = true,
|
2023-10-17 13:47:02 -04:00
|
|
|
|
|
|
|
properties: [['timeouts', []]],
|
2023-10-16 13:55:31 -04:00
|
|
|
connections: [[Hyprland, self => {
|
2023-10-17 13:47:02 -04:00
|
|
|
Utils.execAsync('hyprctl activewindow -j').then(out => {
|
|
|
|
let client = JSON.parse(out);
|
|
|
|
if (client.fullscreen === Revealed.value)
|
|
|
|
return;
|
2023-10-16 13:55:31 -04:00
|
|
|
|
2023-10-17 13:47:02 -04:00
|
|
|
Revealed.value = client.fullscreen;
|
|
|
|
|
|
|
|
if (Revealed.value) {
|
|
|
|
setTimeout(() => {
|
|
|
|
if (Revealed.value)
|
|
|
|
self.revealChild = false
|
|
|
|
}, 2000);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
self.revealChild = true;
|
|
|
|
}
|
|
|
|
}).catch(print);
|
2023-10-16 13:55:31 -04:00
|
|
|
}]],
|
|
|
|
|
|
|
|
child: Gesture({
|
|
|
|
onHover: () => Hovering.value = true,
|
|
|
|
onHoverLost: self => {
|
|
|
|
Hovering.value = false;
|
|
|
|
if (Revealed.value) {
|
|
|
|
setTimeout(() => {
|
|
|
|
if (!Hovering.value) {
|
|
|
|
self.get_parent().get_parent().children[1].revealChild = true;
|
|
|
|
self.get_parent().revealChild = false;
|
|
|
|
}
|
|
|
|
}, 2000);
|
2023-10-07 20:41:24 -04:00
|
|
|
}
|
2023-10-16 13:55:31 -04:00
|
|
|
},
|
2023-10-17 13:47:02 -04:00
|
|
|
...props,
|
2023-10-16 13:55:31 -04:00
|
|
|
}),
|
|
|
|
}),
|
2023-10-07 20:41:24 -04:00
|
|
|
|
2023-10-16 13:55:31 -04:00
|
|
|
Widget.Revealer({
|
|
|
|
connections: [[Revealed, self => {
|
2023-10-07 20:41:24 -04:00
|
|
|
if (Revealed.value) {
|
|
|
|
setTimeout(() => {
|
2023-10-16 13:55:31 -04:00
|
|
|
if (Revealed.value)
|
|
|
|
self.revealChild = true;
|
2023-10-07 20:41:24 -04:00
|
|
|
}, 2000);
|
|
|
|
}
|
2023-10-16 13:55:31 -04:00
|
|
|
else {
|
|
|
|
self.revealChild = false;
|
|
|
|
}
|
|
|
|
}]],
|
|
|
|
child: EventBox({
|
|
|
|
onHover: self => {
|
|
|
|
Hovering.value = true;
|
|
|
|
self.get_parent().get_parent().children[0].revealChild = true;
|
|
|
|
self.get_parent().revealChild = false;
|
|
|
|
},
|
|
|
|
child: Box({
|
|
|
|
style: 'min-height: 50px;',
|
|
|
|
}),
|
2023-10-07 20:41:24 -04:00
|
|
|
}),
|
|
|
|
}),
|
2023-10-16 13:55:31 -04:00
|
|
|
],
|
|
|
|
}),
|
2023-10-07 20:41:24 -04:00
|
|
|
});
|