2023-10-31 08:32:40 -04:00
|
|
|
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
|
|
|
|
import Variable from 'resource:///com/github/Aylur/ags/variable.js';
|
|
|
|
|
2023-11-15 16:01:30 -05:00
|
|
|
import { Box, EventBox, Revealer } from 'resource:///com/github/Aylur/ags/widget.js';
|
2023-10-31 08:32:40 -04:00
|
|
|
import { timeout } from 'resource:///com/github/Aylur/ags/utils.js';
|
2023-10-07 20:41:24 -04:00
|
|
|
|
2023-10-22 13:39:13 -04:00
|
|
|
const Revealed = Variable(true);
|
|
|
|
const Hovering = Variable(false);
|
|
|
|
|
2023-10-07 20:41:24 -04:00
|
|
|
|
2023-10-21 01:15:21 -04:00
|
|
|
Hyprland.connect('changed', () => {
|
2023-10-30 21:58:53 -04:00
|
|
|
const workspace = Hyprland.getWorkspace(Hyprland.active.workspace.id);
|
2023-11-15 16:01:30 -05:00
|
|
|
Revealed.value = workspace?.hasfullscreen;
|
2023-10-21 01:15:21 -04:00
|
|
|
});
|
|
|
|
Hyprland.connect('fullscreen', (_, fullscreen) => Revealed.value = fullscreen);
|
2023-10-17 23:21:24 -04:00
|
|
|
|
2023-11-15 16:01:30 -05:00
|
|
|
export default props => Box({
|
|
|
|
css: 'min-height: 1px',
|
|
|
|
hexpand: true,
|
|
|
|
vertical: true,
|
|
|
|
children: [
|
|
|
|
Revealer({
|
|
|
|
transition: 'slide_down',
|
|
|
|
revealChild: true,
|
2023-10-17 13:47:02 -04:00
|
|
|
|
2023-11-15 16:01:30 -05:00
|
|
|
properties: [['timeouts', []]],
|
|
|
|
connections: [[Revealed, self => {
|
|
|
|
if (Revealed.value) {
|
|
|
|
timeout(2000, () => {
|
|
|
|
if (Revealed.value)
|
|
|
|
self.revealChild = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
self.revealChild = true;
|
|
|
|
}
|
|
|
|
}]],
|
2023-10-22 13:39:13 -04:00
|
|
|
|
2023-11-15 16:01:30 -05:00
|
|
|
child: EventBox({
|
|
|
|
onHover: () => Hovering.value = true,
|
|
|
|
onHoverLost: self => {
|
|
|
|
Hovering.value = false;
|
2023-10-21 01:15:21 -04:00
|
|
|
if (Revealed.value) {
|
2023-10-31 08:32:40 -04:00
|
|
|
timeout(2000, () => {
|
2023-11-15 16:01:30 -05:00
|
|
|
if (!Hovering.value) {
|
|
|
|
// Replace bar with transparent eventbox
|
|
|
|
self.get_parent().get_parent().children[1].revealChild = true;
|
|
|
|
self.get_parent().revealChild = false;
|
|
|
|
}
|
2023-10-21 01:15:21 -04:00
|
|
|
});
|
|
|
|
}
|
2023-11-15 16:01:30 -05:00
|
|
|
},
|
|
|
|
...props,
|
2023-10-20 23:11:21 -04:00
|
|
|
}),
|
2023-11-15 16:01:30 -05:00
|
|
|
}),
|
2023-10-07 20:41:24 -04:00
|
|
|
|
2023-11-15 16:01:30 -05:00
|
|
|
Revealer({
|
|
|
|
connections: [[Revealed, self => {
|
|
|
|
if (Revealed.value) {
|
|
|
|
timeout(2000, () => {
|
|
|
|
if (Revealed.value)
|
|
|
|
self.revealChild = true;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
self.revealChild = false;
|
|
|
|
}
|
|
|
|
}]],
|
|
|
|
child: EventBox({
|
|
|
|
onHover: self => {
|
|
|
|
Hovering.value = true;
|
2023-11-06 20:38:16 -05:00
|
|
|
|
2023-11-15 16:01:30 -05:00
|
|
|
// Replace eventbox with bar
|
|
|
|
self.get_parent().get_parent().children[0].revealChild = true;
|
|
|
|
self.get_parent().revealChild = false;
|
|
|
|
},
|
|
|
|
child: Box({
|
|
|
|
css: 'min-height: 5px;',
|
2023-10-20 23:11:21 -04:00
|
|
|
}),
|
|
|
|
}),
|
2023-11-15 16:01:30 -05:00
|
|
|
}),
|
|
|
|
],
|
2023-10-07 20:41:24 -04:00
|
|
|
});
|