ags: sync

This commit is contained in:
end-4
2024-01-02 15:54:55 +07:00
parent fae6cf50c1
commit 577550642f
14 changed files with 251 additions and 168 deletions
@@ -1,6 +1,6 @@
const { Gdk, Gtk } = imports.gi;
import { App, SCREEN_WIDTH, SCREEN_HEIGHT, Service, Utils, Variable, Widget } from '../imports.js';
const { Box, Button, Entry, EventBox, Icon, Label, Revealer, Scrollable, Stack } = Widget;
const { Box, Button, EventBox, Label, Overlay, Revealer, Scrollable, Stack } = Widget;
export const MarginRevealer = ({
transition = 'slide_down',
@@ -13,46 +13,41 @@ export const MarginRevealer = ({
}) => {
const widget = Scrollable({
...rest,
css: `min-height: 0px;`,
properties: [
['revealChild', true], // It'll be set to false after init if it's supposed to hide
['transition', transition],
['show', (self) => {
if (self._revealChild) return;
self.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.NEVER);
['show', () => {
if (widget._revealChild) return;
widget.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.NEVER);
child.toggleClassName(hideClass, false);
child.toggleClassName(showClass, true);
self._revealChild = true;
widget._revealChild = true;
child.css = 'margin: 0px;';
}],
['hide', (self) => {
if (!self._revealChild) return;
['hide', () => {
if (!widget._revealChild) return;
child.toggleClassName(hideClass, true);
child.toggleClassName(showClass, false);
self._revealChild = false;
if (self._transition == 'slide_left')
widget._revealChild = false;
if (widget._transition == 'slide_left')
child.css = `margin-right: -${child.get_allocated_width()}px;`;
else if (self._transition == 'slide_right')
else if (widget._transition == 'slide_right')
child.css = `margin-left: -${child.get_allocated_width()}px;`;
else if (self._transition == 'slide_up')
else if (widget._transition == 'slide_up')
child.css = `margin-bottom: -${child.get_allocated_height()}px;`;
else if (self._transition == 'slide_down')
else if (widget._transition == 'slide_down')
child.css = `margin-top: -${child.get_allocated_height()}px;`;
}],
['toggle', (self) => {
['toggle', () => {
console.log('toggle');
if (self._revealChild) self._hide(self);
else self._show(self);
if (widget._revealChild) widget._hide();
else widget._show();
}],
...extraProperties,
],
setup: (self) => {
if (!revealChild)
self.set_policy(Gtk.PolicyType.ALWAYS, Gtk.PolicyType.ALWAYS);
else
self.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.NEVER);
self.child = child;
},
child: child,
hscroll: (revealChild ? 'never' : 'always'),
vscroll: (revealChild ? 'never' : 'always'),
});
child.toggleClassName(`${revealChild ? showClass : hideClass}`, true);
return widget;
-1
View File
@@ -7,7 +7,6 @@ const { Box, EventBox, Icon, Overlay, Label, Button, Revealer } = Widget;
import { MaterialIcon } from "./materialicon.js";
import { setupCursorHover } from "./cursorhover.js";
import { AnimatedCircProg } from "./animatedcircularprogress.js";
import { MarginRevealer } from './advancedrevealers.js';
function guessMessageType(summary) {
if (summary.includes('recording')) return 'screen_record';