fix(ags fullscreen): close closer when loses focus
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-03-21 22:00:24 -04:00
parent a2283e5d6a
commit 2a9ea9a4e9

View file

@ -42,6 +42,25 @@ export default ({ bar, transition, monitor = 0, ...rest }) => {
BarVisible.setValue(!v.value.monitors.includes(monitor)); BarVisible.setValue(!v.value.monitors.includes(monitor));
}); });
const barCloser = Window({
name: `bar-${monitor}-closer`,
visible: false,
monitor,
anchor: ['top', 'bottom', 'left', 'right'],
layer: 'overlay',
child: EventBox({
on_hover: () => {
barCloser.set_visible(false);
BarVisible.setValue(false);
},
child: Box({
css: 'padding: 1px;',
}),
}),
});
// Hide bar instantly when out of focus // Hide bar instantly when out of focus
Hyprland.active.workspace.connect('changed', () => { Hyprland.active.workspace.connect('changed', () => {
const addr = FullscreenState.value.clientAddrs.get(monitor); const addr = FullscreenState.value.clientAddrs.get(monitor);
@ -51,31 +70,11 @@ export default ({ bar, transition, monitor = 0, ...rest }) => {
if (client!.workspace.id !== Hyprland.active.workspace.id) { if (client!.workspace.id !== Hyprland.active.workspace.id) {
BarVisible.setValue(false); BarVisible.setValue(false);
barCloser.visible = false;
} }
} }
}); });
const barCloser = Window({
name: `bar-${monitor}-closer`,
visible: false,
monitor,
anchor: ['top', 'bottom', 'left', 'right'],
layer: 'overlay',
child: EventBox({
on_hover: (self) => {
const parent = self.get_parent();
parent?.set_visible(false);
BarVisible.setValue(false);
},
child: Box({
css: 'padding: 1px;',
}),
}),
});
const buffer = Box({ const buffer = Box({
css: 'min-height: 10px', css: 'min-height: 10px',
visible: BarVisible.bind().as((v) => !v), visible: BarVisible.bind().as((v) => !v),