fix(ags bar): fix fullscreen hiding
This commit is contained in:
parent
23befab961
commit
cd6f9c4e24
15 changed files with 77 additions and 100 deletions
|
@ -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 { Label, Box, Icon } from 'resource:///com/github/Aylur/ags/widget.js';
|
||||||
import { execAsync } from 'resource:///com/github/Aylur/ags/utils.js';
|
import { execAsync } from 'resource:///com/github/Aylur/ags/utils.js';
|
||||||
|
|
||||||
import { SpeakerIcon } from '../misc/audio-icons.js';
|
import { SpeakerIcon } from '../../misc/audio-icons.js';
|
||||||
import Separator from '../misc/separator.js';
|
import Separator from '../../misc/separator.js';
|
||||||
import EventBox from '../misc/cursorbox.js';
|
import EventBox from '../../misc/cursorbox.js';
|
||||||
|
|
||||||
|
|
||||||
const SpeakerIndicator = props => Icon({
|
const SpeakerIndicator = props => Icon({
|
|
@ -1,7 +1,7 @@
|
||||||
import Battery from 'resource:///com/github/Aylur/ags/service/battery.js';
|
import Battery from 'resource:///com/github/Aylur/ags/service/battery.js';
|
||||||
import { Label, Icon, Box } from 'resource:///com/github/Aylur/ags/widget.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({
|
const Indicator = () => Icon({
|
|
@ -1,6 +1,6 @@
|
||||||
import { ProgressBar, Overlay, Box } from 'resource:///com/github/Aylur/ags/widget.js';
|
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';
|
import Heart from './heart.js';
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js';
|
||||||
import GLib from 'gi://GLib';
|
import GLib from 'gi://GLib';
|
||||||
const { DateTime } = GLib;
|
const { DateTime } = GLib;
|
||||||
|
|
||||||
import EventBox from '../misc/cursorbox.js';
|
import EventBox from '../../misc/cursorbox.js';
|
||||||
|
|
||||||
|
|
||||||
const ClockModule = ({
|
const ClockModule = ({
|
|
@ -1,7 +1,7 @@
|
||||||
import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js';
|
import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js';
|
||||||
import { subprocess, execAsync } from 'resource:///com/github/Aylur/ags/utils.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({
|
export default () => EventBox({
|
|
@ -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 Notifications from 'resource:///com/github/Aylur/ags/service/notifications.js';
|
||||||
import { Box, Icon, Label } from 'resource:///com/github/Aylur/ags/widget.js';
|
import { Box, Icon, Label } from 'resource:///com/github/Aylur/ags/widget.js';
|
||||||
|
|
||||||
import Separator from '../misc/separator.js';
|
import Separator from '../../misc/separator.js';
|
||||||
import EventBox from '../misc/cursorbox.js';
|
import EventBox from '../../misc/cursorbox.js';
|
||||||
|
|
||||||
|
|
||||||
export default () => EventBox({
|
export default () => EventBox({
|
|
@ -1,6 +1,6 @@
|
||||||
import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.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({
|
export default () => EventBox({
|
|
@ -1,7 +1,7 @@
|
||||||
import App from 'resource:///com/github/Aylur/ags/app.js';
|
import App from 'resource:///com/github/Aylur/ags/app.js';
|
||||||
import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.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({
|
export default () => EventBox({
|
|
@ -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 { timeout } from 'resource:///com/github/Aylur/ags/utils.js';
|
||||||
import { Box, Icon, MenuItem, MenuBar, Revealer } from 'resource:///com/github/Aylur/ags/widget.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 => {
|
const SysTrayItem = item => {
|
|
@ -1,6 +1,6 @@
|
||||||
import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.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({
|
export default () => EventBox({
|
|
@ -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 { timeout } from 'resource:///com/github/Aylur/ags/utils.js';
|
||||||
import { Box, Overlay, Revealer } from 'resource:///com/github/Aylur/ags/widget.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 } = {}) =>
|
const Workspace = ({ i } = {}) =>
|
|
@ -1,78 +1,54 @@
|
||||||
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
|
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
|
||||||
import Variable from 'resource:///com/github/Aylur/ags/variable.js';
|
import Variable from 'resource:///com/github/Aylur/ags/variable.js';
|
||||||
|
|
||||||
import { Box, EventBox, Revealer } from 'resource:///com/github/Aylur/ags/widget.js';
|
import { Box, EventBox, Revealer, Window } 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);
|
|
||||||
|
|
||||||
|
|
||||||
Hyprland.connect('changed', () => {
|
const BarCloser = variable => Window({
|
||||||
const workspace = Hyprland.getWorkspace(Hyprland.active.workspace.id);
|
name: 'bar-closer',
|
||||||
Revealed.value = workspace?.hasfullscreen;
|
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',
|
css: 'min-height: 1px',
|
||||||
hexpand: true,
|
hexpand: true,
|
||||||
vertical: 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: [
|
children: [
|
||||||
Revealer({
|
Revealer({
|
||||||
transition: 'slide_down',
|
transition: 'slide_down',
|
||||||
revealChild: true,
|
revealChild: true,
|
||||||
|
binds: [['revealChild', Revealed, 'value']],
|
||||||
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;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
...props,
|
...props,
|
||||||
}),
|
}),
|
||||||
}),
|
|
||||||
|
|
||||||
Revealer({
|
Revealer({
|
||||||
connections: [[Revealed, self => {
|
binds: [['revealChild', Revealed, 'value', v => !v]],
|
||||||
if (Revealed.value) {
|
|
||||||
timeout(2000, () => {
|
|
||||||
if (Revealed.value)
|
|
||||||
self.revealChild = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
self.revealChild = false;
|
|
||||||
}
|
|
||||||
}]],
|
|
||||||
child: EventBox({
|
child: EventBox({
|
||||||
onHover: self => {
|
onHover: () => {
|
||||||
Hovering.value = true;
|
barCloser.visible = true;
|
||||||
|
Revealed.value = true;
|
||||||
// Replace eventbox with bar
|
|
||||||
self.get_parent().get_parent().children[0].revealChild = true;
|
|
||||||
self.get_parent().revealChild = false;
|
|
||||||
},
|
},
|
||||||
child: Box({
|
child: Box({
|
||||||
css: 'min-height: 5px;',
|
css: 'min-height: 5px;',
|
||||||
|
@ -80,4 +56,5 @@ export default props => Box({
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
import { Window, CenterBox, Box } from 'resource:///com/github/Aylur/ags/widget.js';
|
import { Window, CenterBox, Box } from 'resource:///com/github/Aylur/ags/widget.js';
|
||||||
|
|
||||||
import Separator from '../misc/separator.js';
|
import Separator from '../misc/separator.js';
|
||||||
import CurrentWindow from './current-window.js';
|
import CurrentWindow from './buttons/current-window.js';
|
||||||
import Workspaces from './workspaces.js';
|
import Workspaces from './buttons/workspaces.js';
|
||||||
import OskToggle from './osk-toggle.js';
|
import OskToggle from './buttons/osk-toggle.js';
|
||||||
import TabletToggle from './tablet-toggle.js';
|
import TabletToggle from './buttons/tablet-toggle.js';
|
||||||
import QsToggle from './quick-settings.js';
|
import QsToggle from './buttons/quick-settings.js';
|
||||||
import NotifButton from './notif-button.js';
|
import NotifButton from './buttons/notif-button.js';
|
||||||
import Clock from './clock.js';
|
import Clock from './buttons/clock.js';
|
||||||
import SysTray from './systray.js';
|
import SysTray from './buttons/systray.js';
|
||||||
import Battery from './battery.js';
|
import Battery from './buttons/battery.js';
|
||||||
import Brightness from './brightness.js';
|
import Brightness from './buttons/brightness.js';
|
||||||
import Audio from './audio.js';
|
import Audio from './buttons/audio.js';
|
||||||
import KeyboardLayout from './keyboard-layout.js';
|
import KeyboardLayout from './buttons/keyboard-layout.js';
|
||||||
|
|
||||||
import Revealer from './fullscreen.js';
|
import BarReveal from './fullscreen.js';
|
||||||
|
|
||||||
|
|
||||||
export default () => Window({
|
export default () => Window({
|
||||||
|
@ -22,7 +22,7 @@ export default () => Window({
|
||||||
layer: 'overlay',
|
layer: 'overlay',
|
||||||
anchor: ['top', 'left', 'right'],
|
anchor: ['top', 'left', 'right'],
|
||||||
exclusivity: 'exclusive',
|
exclusivity: 'exclusive',
|
||||||
child: Revealer({
|
child: BarReveal({
|
||||||
child: CenterBox({
|
child: CenterBox({
|
||||||
className: 'bar',
|
className: 'bar',
|
||||||
vertical: false,
|
vertical: false,
|
||||||
|
|
Loading…
Reference in a new issue