ags: sync

This commit is contained in:
end-4
2023-12-31 01:12:29 +07:00
parent 7bede724a5
commit 5e43761875
62 changed files with 2688 additions and 1468 deletions
@@ -50,9 +50,7 @@ export default () => Widget.Revealer({
transition: 'slide_down',
transitionDuration: 200,
child: colorschemeContent,
connections: [
[showColorScheme, (revealer) => {
revealer.revealChild = showColorScheme.value;
}],
],
setup: (self) => self.hook(showColorScheme, (revealer) => {
revealer.revealChild = showColorScheme.value;
}),
})
@@ -2,34 +2,33 @@
const { GLib, Gtk } = imports.gi;
import { App, Service, Utils, Widget } from '../../imports.js';
import Audio from 'resource:///com/github/Aylur/ags/service/audio.js';
import Notifications from 'resource:///com/github/Aylur/ags/service/notifications.js';
const { Box, EventBox, Icon, Scrollable, Label, Button, Revealer } = Widget;
const { Box, Label, ProgressBar, Revealer } = Widget;
import { MarginRevealer } from '../../lib/advancedrevealers.js';
import Brightness from '../../services/brightness.js';
import Indicator from '../../services/indicator.js';
import Notification from '../../lib/notification.js';
const OsdValue = (name, labelConnections, progressConnections, props = {}) => Widget.Box({ // Volume
const OsdValue = (name, labelConnections, progressConnections, props = {}) => Box({ // Volume
...props,
vertical: true,
className: 'osd-bg osd-value',
hexpand: true,
children: [
Widget.Box({
Box({
vexpand: true,
children: [
Widget.Label({
Label({
xalign: 0, yalign: 0, hexpand: true,
className: 'osd-label',
label: `${name}`,
}),
Widget.Label({
Label({
hexpand: false, className: 'osd-value-txt',
label: '100',
connections: labelConnections,
}),
]
}),
Widget.ProgressBar({
ProgressBar({
className: 'osd-progress',
hexpand: true,
vertical: false,
@@ -58,16 +57,20 @@ const volumeIndicator = OsdValue('Volume',
}]],
);
export default () => Widget.Revealer({
export default () => MarginRevealer({
transition: 'slide_down',
showClass: 'osd-show',
hideClass: 'osd-hide',
connections: [
[Indicator, (revealer, value) => {
revealer.revealChild = (value > -1);
if(value > -1) revealer._show(revealer);
else revealer._hide(revealer);
}, 'popup'],
],
child: Widget.Box({
child: Box({
hpack: 'center',
vertical: false,
className: 'spacing-h--10',
children: [
brightnessIndicator,
volumeIndicator,
+3
View File
@@ -10,6 +10,7 @@ export default (monitor) => Widget.Window({
monitor,
className: 'indicator',
layer: 'overlay',
// exclusivity: 'ignore',
visible: true,
anchor: ['top'],
child: Widget.EventBox({
@@ -18,6 +19,7 @@ export default (monitor) => Widget.Window({
},
child: Widget.Box({
vertical: true,
className: 'osd-window',
css: 'min-height: 2px;',
children: [
IndicatorValues(),
@@ -28,3 +30,4 @@ export default (monitor) => Widget.Window({
})
}),
});
@@ -4,6 +4,7 @@ const { exec, execAsync } = Utils;
import Mpris from 'resource:///com/github/Aylur/ags/service/mpris.js';
const { Box, EventBox, Icon, Scrollable, Label, Button, Revealer } = Widget;
import { MarginRevealer } from '../../lib/advancedrevealers.js';
import { AnimatedCircProg } from "../../lib/animatedcircularprogress.js";
import { MaterialIcon } from '../../lib/materialicon.js';
import { showMusicControls } from '../../variables.js';
@@ -343,9 +344,11 @@ const MusicControlsWidget = (player) => Box({
]
})
export default () => Widget.Revealer({
export default () => MarginRevealer({
transition: 'slide_down',
transitionDuration: 170,
revealChild: false,
showClass: 'osd-show',
hideClass: 'osd-hide',
child: Box({
connections: [[Mpris, box => {
let foundPlayer = false;
@@ -360,14 +363,19 @@ export default () => Widget.Revealer({
if (!foundPlayer) {
box._player = null;
box.get_children().forEach(ch => ch.destroy());
const children = box.get_children();
for (let i = 0; i < children.length; i++) {
const child = children[i];
child.destroy();
}
return;
}
}, 'notify::players']],
}),
connections: [
[showMusicControls, (revealer) => {
revealer.revealChild = showMusicControls.value;
if(showMusicControls.value) revealer._show(revealer);
else revealer._hide(revealer);
}],
],
})
@@ -30,12 +30,10 @@ const PopupNotification = (notifObject) => Widget.Box({
const naiveNotifPopupList = Widget.Box({
vertical: true,
className: 'spacing-v-5',
connections: [
[Notifications, (box) => {
box.children = Notifications.popups.reverse()
.map(notifItem => PopupNotification(notifItem));
}],
],
setup: (self) => self.hook(Notifications, (box) => {
box.children = Notifications.popups.reverse()
.map(notifItem => PopupNotification(notifItem));
}),
})
const notifPopupList = Box({
@@ -72,11 +70,11 @@ const notifPopupList = Box({
// box.children = Array.from(box._map.values()).reverse();
}],
],
connections: [
[Notifications, (box, id) => box._notify(box, id), 'notified'],
[Notifications, (box, id) => box._dismiss(box, id), 'dismissed'],
[Notifications, (box, id) => box._dismiss(box, id, true), 'closed'],
],
setup: (self) => self
.hook(Notifications, (box, id) => box._notify(box, id), 'notified')
.hook(Notifications, (box, id) => box._dismiss(box, id), 'dismissed')
.hook(Notifications, (box, id) => box._dismiss(box, id, true), 'closed')
,
});
export default () => notifPopupList;