fix(ags bar): fix fullscreen hiding

This commit is contained in:
matt1432 2023-11-16 00:48:50 -05:00
parent 23befab961
commit cd6f9c4e24
15 changed files with 77 additions and 100 deletions

View file

@ -2,9 +2,9 @@ import Audio from 'resource:///com/github/Aylur/ags/service/audio.js';
import { Label, Box, Icon } from 'resource:///com/github/Aylur/ags/widget.js';
import { execAsync } from 'resource:///com/github/Aylur/ags/utils.js';
import { SpeakerIcon } from '../misc/audio-icons.js';
import Separator from '../misc/separator.js';
import EventBox from '../misc/cursorbox.js';
import { SpeakerIcon } from '../../misc/audio-icons.js';
import Separator from '../../misc/separator.js';
import EventBox from '../../misc/cursorbox.js';
const SpeakerIndicator = props => Icon({

View file

@ -1,7 +1,7 @@
import Battery from 'resource:///com/github/Aylur/ags/service/battery.js';
import { Label, Icon, Box } from 'resource:///com/github/Aylur/ags/widget.js';
import Separator from '../misc/separator.js';
import Separator from '../../misc/separator.js';
const Indicator = () => Icon({

View file

@ -1,6 +1,6 @@
import { ProgressBar, Overlay, Box } from 'resource:///com/github/Aylur/ags/widget.js';
import Separator from '../misc/separator.js';
import Separator from '../../misc/separator.js';
import Heart from './heart.js';

View file

@ -4,7 +4,7 @@ import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js';
import GLib from 'gi://GLib';
const { DateTime } = GLib;
import EventBox from '../misc/cursorbox.js';
import EventBox from '../../misc/cursorbox.js';
const ClockModule = ({

View file

@ -1,7 +1,7 @@
import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js';
import { subprocess, execAsync } from 'resource:///com/github/Aylur/ags/utils.js';
import EventBox from '../misc/cursorbox.js';
import EventBox from '../../misc/cursorbox.js';
export default () => EventBox({

View file

@ -2,8 +2,8 @@ import App from 'resource:///com/github/Aylur/ags/app.js';
import Notifications from 'resource:///com/github/Aylur/ags/service/notifications.js';
import { Box, Icon, Label } from 'resource:///com/github/Aylur/ags/widget.js';
import Separator from '../misc/separator.js';
import EventBox from '../misc/cursorbox.js';
import Separator from '../../misc/separator.js';
import EventBox from '../../misc/cursorbox.js';
export default () => EventBox({

View file

@ -1,6 +1,6 @@
import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js';
import EventBox from '../misc/cursorbox.js';
import EventBox from '../../misc/cursorbox.js';
export default () => EventBox({

View file

@ -1,7 +1,7 @@
import App from 'resource:///com/github/Aylur/ags/app.js';
import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js';
import EventBox from '../misc/cursorbox.js';
import EventBox from '../../misc/cursorbox.js';
export default () => EventBox({

View file

@ -2,7 +2,7 @@ import SystemTray from 'resource:///com/github/Aylur/ags/service/systemtray.js';
import { timeout } from 'resource:///com/github/Aylur/ags/utils.js';
import { Box, Icon, MenuItem, MenuBar, Revealer } from 'resource:///com/github/Aylur/ags/widget.js';
import Separator from '../misc/separator.js';
import Separator from '../../misc/separator.js';
const SysTrayItem = item => {

View file

@ -1,6 +1,6 @@
import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js';
import EventBox from '../misc/cursorbox.js';
import EventBox from '../../misc/cursorbox.js';
export default () => EventBox({

View file

@ -2,7 +2,7 @@ import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
import { timeout } from 'resource:///com/github/Aylur/ags/utils.js';
import { Box, Overlay, Revealer } from 'resource:///com/github/Aylur/ags/widget.js';
import EventBox from '../misc/cursorbox.js';
import EventBox from '../../misc/cursorbox.js';
const Workspace = ({ i } = {}) =>

View file

@ -1,78 +1,54 @@
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
import Variable from 'resource:///com/github/Aylur/ags/variable.js';
import { Box, EventBox, Revealer } from 'resource:///com/github/Aylur/ags/widget.js';
import { timeout } from 'resource:///com/github/Aylur/ags/utils.js';
const Revealed = Variable(true);
const Hovering = Variable(false);
import { Box, EventBox, Revealer, Window } from 'resource:///com/github/Aylur/ags/widget.js';
Hyprland.connect('changed', () => {
const workspace = Hyprland.getWorkspace(Hyprland.active.workspace.id);
Revealed.value = workspace?.hasfullscreen;
const BarCloser = variable => Window({
name: 'bar-closer',
visible: false,
anchor: ['top', 'bottom', 'left', 'right'],
layer: 'overlay',
child: EventBox({
onHover: self => {
variable.value = false;
self.get_parent().visible = false;
},
child: Box({
css: 'padding: 1px',
}),
}),
});
Hyprland.connect('fullscreen', (_, fullscreen) => Revealed.value = fullscreen);
export default props => Box({
export default props => {
const Revealed = Variable(true);
const barCloser = BarCloser(Revealed);
return Box({
css: 'min-height: 1px',
hexpand: true,
vertical: true,
connections: [
[Hyprland.active, () => {
const workspace = Hyprland.getWorkspace(Hyprland.active.workspace.id);
Revealed.value = !workspace?.hasfullscreen;
}],
[Hyprland, (_, fullscreen) => Revealed.value = !fullscreen, 'fullscreen'],
],
children: [
Revealer({
transition: 'slide_down',
revealChild: true,
properties: [['timeouts', []]],
connections: [[Revealed, self => {
if (Revealed.value) {
timeout(2000, () => {
if (Revealed.value)
self.revealChild = false;
});
}
else {
self.revealChild = true;
}
}]],
child: EventBox({
onHover: () => Hovering.value = true,
onHoverLost: self => {
Hovering.value = false;
if (Revealed.value) {
timeout(2000, () => {
if (!Hovering.value) {
// Replace bar with transparent eventbox
self.get_parent().get_parent().children[1].revealChild = true;
self.get_parent().revealChild = false;
}
});
}
},
binds: [['revealChild', Revealed, 'value']],
...props,
}),
}),
Revealer({
connections: [[Revealed, self => {
if (Revealed.value) {
timeout(2000, () => {
if (Revealed.value)
self.revealChild = true;
});
}
else {
self.revealChild = false;
}
}]],
binds: [['revealChild', Revealed, 'value', v => !v]],
child: EventBox({
onHover: self => {
Hovering.value = true;
// Replace eventbox with bar
self.get_parent().get_parent().children[0].revealChild = true;
self.get_parent().revealChild = false;
onHover: () => {
barCloser.visible = true;
Revealed.value = true;
},
child: Box({
css: 'min-height: 5px;',
@ -80,4 +56,5 @@ export default props => Box({
}),
}),
],
});
});
};

View file

@ -1,20 +1,20 @@
import { Window, CenterBox, Box } from 'resource:///com/github/Aylur/ags/widget.js';
import Separator from '../misc/separator.js';
import CurrentWindow from './current-window.js';
import Workspaces from './workspaces.js';
import OskToggle from './osk-toggle.js';
import TabletToggle from './tablet-toggle.js';
import QsToggle from './quick-settings.js';
import NotifButton from './notif-button.js';
import Clock from './clock.js';
import SysTray from './systray.js';
import Battery from './battery.js';
import Brightness from './brightness.js';
import Audio from './audio.js';
import KeyboardLayout from './keyboard-layout.js';
import CurrentWindow from './buttons/current-window.js';
import Workspaces from './buttons/workspaces.js';
import OskToggle from './buttons/osk-toggle.js';
import TabletToggle from './buttons/tablet-toggle.js';
import QsToggle from './buttons/quick-settings.js';
import NotifButton from './buttons/notif-button.js';
import Clock from './buttons/clock.js';
import SysTray from './buttons/systray.js';
import Battery from './buttons/battery.js';
import Brightness from './buttons/brightness.js';
import Audio from './buttons/audio.js';
import KeyboardLayout from './buttons/keyboard-layout.js';
import Revealer from './fullscreen.js';
import BarReveal from './fullscreen.js';
export default () => Window({
@ -22,7 +22,7 @@ export default () => Window({
layer: 'overlay',
anchor: ['top', 'left', 'right'],
exclusivity: 'exclusive',
child: Revealer({
child: BarReveal({
child: CenterBox({
className: 'bar',
vertical: false,