Compare commits
No commits in common. "bb7a001eb8080ad99606a83ffd14ea86fe71a61c" and "4b3cdd82b98d6ddfece8f59883cb7d3d940fa3b1" have entirely different histories.
bb7a001eb8
...
4b3cdd82b9
4 changed files with 19 additions and 53 deletions
|
@ -27,26 +27,11 @@ export const Draggable = ({
|
||||||
|
|
||||||
let gesture = Gtk.GestureDrag.new(w);
|
let gesture = Gtk.GestureDrag.new(w);
|
||||||
|
|
||||||
let leftAnim = 'transition: margin 0.5s ease, opacity 0.5s ease; ' +
|
|
||||||
'margin-left: -' + Number(maxOffset + endMargin) + 'px; ' +
|
|
||||||
'margin-right: ' + Number(maxOffset + endMargin) + 'px; ' +
|
|
||||||
'margin-bottom: -70px; margin-top: -70px; opacity: 0;';
|
|
||||||
|
|
||||||
let rightAnim = 'transition: margin 0.5s ease, opacity 0.5s ease; ' +
|
|
||||||
'margin-left: ' + Number(maxOffset + endMargin) + 'px; ' +
|
|
||||||
'margin-right: -' + Number(maxOffset + endMargin) + 'px; ' +
|
|
||||||
'margin-bottom: -70px; margin-top: -70px; opacity: 0;';
|
|
||||||
|
|
||||||
w.child = Box({
|
w.child = Box({
|
||||||
properties: [
|
|
||||||
['leftAnim', leftAnim],
|
|
||||||
['rightAnim', rightAnim],
|
|
||||||
],
|
|
||||||
children: [
|
children: [
|
||||||
...children,
|
...children,
|
||||||
child,
|
child,
|
||||||
],
|
],
|
||||||
style: leftAnim,
|
|
||||||
connections: [
|
connections: [
|
||||||
|
|
||||||
[gesture, box => {
|
[gesture, box => {
|
||||||
|
@ -71,18 +56,22 @@ export const Draggable = ({
|
||||||
|
|
||||||
if (Math.abs(offset) > maxOffset) {
|
if (Math.abs(offset) > maxOffset) {
|
||||||
if (offset > 0) {
|
if (offset > 0) {
|
||||||
box.setStyle(rightAnim);
|
box.setStyle('transition: margin 0.5s ease, opacity 0.5s ease; ' +
|
||||||
|
'margin-left: ' + Number(maxOffset + endMargin) + 'px; ' +
|
||||||
|
'margin-right: -' + Number(maxOffset + endMargin) + 'px; ' +
|
||||||
|
'margin-bottom: -70px; margin-top: -70px; opacity: 0;');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
box.setStyle(leftAnim);
|
box.setStyle('transition: margin 0.5s ease, opacity 0.5s ease; ' +
|
||||||
|
'margin-left: -' + Number(maxOffset + endMargin) + 'px; ' +
|
||||||
|
'margin-right: ' + Number(maxOffset + endMargin) + 'px; ' +
|
||||||
|
'margin-bottom: -70px; margin-top: -70px; opacity: 0;');
|
||||||
}
|
}
|
||||||
setTimeout(command, 500);
|
setTimeout(command, 500);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
box.setStyle('transition: margin 0.5s ease, opacity 0.5s ease; ' +
|
box.setStyle('transition: margin 0.5s ease; margin-left: ' + startMargin + 'px; ' +
|
||||||
'margin-left: ' + startMargin + 'px; ' +
|
'margin-right: ' + startMargin + 'px;');
|
||||||
'margin-right: ' + startMargin + 'px; ' +
|
|
||||||
'margin-bottom: unset; margin-top: unset; opacity: 1;');
|
|
||||||
if (w.window)
|
if (w.window)
|
||||||
w.window.set_cursor(Gdk.Cursor.new_from_name(display, 'grab'));
|
w.window.set_cursor(Gdk.Cursor.new_from_name(display, 'grab'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,9 +51,9 @@ const NotificationIcon = ({ appEntry, appIcon, image }) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ({ id, summary, body, actions, urgency, time, command = i => {}, ...icon }) => Draggable({
|
export default ({ id, summary, body, actions, urgency, time, ...icon }) => Draggable({
|
||||||
maxOffset: 200,
|
maxOffset: 200,
|
||||||
command: () => command(id),
|
command: () => Notifications.close(id),
|
||||||
properties: [['hovered', false]],
|
properties: [['hovered', false]],
|
||||||
onHover: w => {
|
onHover: w => {
|
||||||
if (!w._hovered) {
|
if (!w._hovered) {
|
||||||
|
|
|
@ -37,13 +37,10 @@ const NotificationList = () => Box({
|
||||||
if (box.children.length == 0) {
|
if (box.children.length == 0) {
|
||||||
box.children = Notifications.notifications
|
box.children = Notifications.notifications
|
||||||
.reverse()
|
.reverse()
|
||||||
.map(n => Notification({ ...n, command: i => Notifications.close(i), }));
|
.map(n => Notification(n));
|
||||||
}
|
}
|
||||||
else if (id) {
|
else if (id) {
|
||||||
box.add(Notification({
|
box.add(Notification(Notifications.getNotification(id)));
|
||||||
...Notifications.getNotification(id),
|
|
||||||
command: i => Notifications.close(i),
|
|
||||||
}));
|
|
||||||
box.show_all();
|
box.show_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import Notification from './base.js';
|
import Notification from './base.js';
|
||||||
const { Notifications } = ags.Service;
|
const { Notifications } = ags.Service;
|
||||||
const { Box, Revealer, Window } = ags.Widget;
|
const { Box, Revealer, Window } = ags.Widget;
|
||||||
const { timeout, interval } = ags.Utils;
|
const { timeout } = ags.Utils;
|
||||||
const { source_remove } = imports.gi.GLib;
|
|
||||||
|
|
||||||
const Popups = () => Box({
|
const Popups = () => Box({
|
||||||
vertical: true,
|
vertical: true,
|
||||||
|
@ -19,10 +18,6 @@ const Popups = () => Box({
|
||||||
box.get_parent().reveal_child = false;
|
box.get_parent().reveal_child = false;
|
||||||
|
|
||||||
timeout(200, () => {
|
timeout(200, () => {
|
||||||
if (box._map.get(id).interval) {
|
|
||||||
source_remove(box._map.get(id).interval);
|
|
||||||
box._map.get(id).interval = undefined;
|
|
||||||
}
|
|
||||||
box._map.get(id)?.destroy();
|
box._map.get(id)?.destroy();
|
||||||
box._map.delete(id);
|
box._map.delete(id);
|
||||||
});
|
});
|
||||||
|
@ -32,26 +27,11 @@ const Popups = () => Box({
|
||||||
return;
|
return;
|
||||||
|
|
||||||
box._map.delete(id);
|
box._map.delete(id);
|
||||||
|
box._map.set(id, Notification(Notifications.getNotification(id)));
|
||||||
box._map.set(id, Notification({
|
|
||||||
...Notifications.getNotification(id),
|
|
||||||
command: i => Notifications.dismiss(i),
|
|
||||||
}));
|
|
||||||
|
|
||||||
box.children = Array.from(box._map.values()).reverse();
|
box.children = Array.from(box._map.values()).reverse();
|
||||||
timeout(10, () => {
|
timeout(10, () => {
|
||||||
box.get_parent().revealChild = true;
|
box.get_parent().revealChild = true;
|
||||||
});
|
});
|
||||||
box._map.get(id).interval = interval(4500, () => {
|
|
||||||
if (!box._map.get(id)._hovered) {
|
|
||||||
box._map.get(id).child.setStyle(box._map.get(id).child._leftAnim);
|
|
||||||
|
|
||||||
if (box._map.get(id).interval) {
|
|
||||||
source_remove(box._map.get(id).interval);
|
|
||||||
box._map.get(id).interval = undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}],
|
}],
|
||||||
],
|
],
|
||||||
connections: [
|
connections: [
|
||||||
|
@ -61,7 +41,7 @@ const Popups = () => Box({
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
const PopupList = ({ transition = 'none' } = {}) => Box({
|
const PopupList = ({ transition = 'slide_right' } = {}) => Box({
|
||||||
className: 'notifications-popup-list',
|
className: 'notifications-popup-list',
|
||||||
style: 'padding: 1px',
|
style: 'padding: 1px',
|
||||||
children: [
|
children: [
|
||||||
|
|
Loading…
Reference in a new issue