Codebase list gnome-shell-extension-panel-osd / 28656ac
Fix #35 (make the extension work on gnome-shell 3.34). Jens Lody 4 years ago
2 changed file(s) with 136 addition(s) and 71 deletion(s). Raw diff Collapse all Expand all
11 "uuid": "@uuid@",
22 "name": "Panel OSD",
33 "description": "Configuring where on the (main) screen notifications will appear, instead of just above the message tray",
4 "shell-version": [ "3.10", "3.12", "3.14", "3.16", "3.18", "3.20", "3.22", "3.24", "3.26", "3.28" ],
4 "shell-version": [ "3.10", "3.12", "3.14", "3.16", "3.18", "3.20", "3.22", "3.24", "3.26", "3.28", "3.30", "3.32", "3.34" ],
55 "localedir": "@LOCALEDIR@",
66 "url": "@url@",
77 "version": "@version@"
4646 const Convenience = Me.imports.convenience;
4747 const St = imports.gi.St;
4848 const Meta = imports.gi.Meta;
49 const Clutter = imports.gi.Clutter;
50
4951
5052 const Gettext = imports.gettext.domain('gnome-shell-extension-panel-osd');
5153 const _ = Gettext.gettext;
237239
238240 this._bannerBin.add_actor(this._banner.actor);
239241
240 this._bannerBin._opacity = 0;
242 if (!versionAtLeast('3.34', Config.PACKAGE_VERSION)) {
243 this._bannerBin._opacity = 0;
244 }
241245 this._bannerBin.opacity = 0;
242246
243247 if (getY_position() < 50)
268272 this._notificationWidget.show();
269273 }
270274
275 if (versionAtLeast('3.30', Config.PACKAGE_VERSION)) {
276 Meta.disable_unredirect_for_display(global.display);
277 }
271278 this._updateShowingNotification();
272279
273280 let [x, y, mods] = global.get_pointer();
350357 }
351358 }
352359
353 // JRL changes begin
354 let theNotification;
355 if (versionAtLeast('3.16', Config.PACKAGE_VERSION)) {
356 theNotification = this._bannerBin;
357 }else
358 {
359 theNotification = this._notificationWidget;
360 }
361 // JRL changes end
362
363
364 if (animate) {
365 if (versionAtLeast('3.16', Config.PACKAGE_VERSION)) {
366 // JRL changes begin
367 this._tween(theNotification, '_notificationState', State.HIDDEN,
368 { y: yPos,
369 // JRL changes end
370 _opacity: 0,
371 time: ANIMATION_TIME,
372 transition: 'easeOutBack',
373 onUpdate: this._clampOpacity,
374 onUpdateScope: this,
375 onComplete: this._hideNotificationCompleted,
376 onCompleteScope: this
377 });
360 if (versionAtLeast('3.34', Config.PACKAGE_VERSION)) {
361 this._bannerBin.remove_all_transitions();
362
363 if (animate) {
364 this._notificationState = State.HIDING;
365 this._bannerBin.ease({
366 opacity: 0,
367 duration: ANIMATION_TIME,
368 mode: Clutter.AnimationMode.EASE_OUT_BACK
369 });
370 this._bannerBin.ease({
371 // JRL changes begin
372 y: yPos,
373 // JRL changes end
374 duration: ANIMATION_TIME,
375 mode: Clutter.AnimationMode.EASE_OUT_BACK,
376 onComplete: () => {
377 this._notificationState = State.HIDDEN;
378 this._hideNotificationCompleted();
379 this._updateState();
380 }
381 });
378382 } else {
379383 // JRL changes begin
380 this._tween(theNotification, '_notificationState', State.HIDDEN,
381 { y: yPos,
382 // JRL changes end
383 opacity: 0,
384 time: ANIMATION_TIME,
385 transition: 'easeOutQuad',
386 onComplete: this._hideNotificationCompleted,
387 onCompleteScope: this
388 });
389 }
390 } else {
384 y: yPos,
385 // JRL changes end
386 this._bannerBin.opacity = 0;
387 this._notificationState = State.HIDDEN;
388 this._hideNotificationCompleted();
389 }
390 }
391 else
392 {
391393 // JRL changes begin
392 Tweener.removeTweens(theNotification);
393 theNotification.y = yPos;
394 theNotification.opacity = 0;
395 // JRL changes end
396 this._notificationState = State.HIDDEN;
397 this._hideNotificationCompleted();
394 let theNotification;
395 if (versionAtLeast('3.16', Config.PACKAGE_VERSION)) {
396 theNotification = this._bannerBin;
397 }else
398 {
399 theNotification = this._notificationWidget;
400 }
401 // JRL changes end
402
403
404 if (animate) {
405 if (versionAtLeast('3.16', Config.PACKAGE_VERSION)) {
406 // JRL changes begin
407 this._tween(theNotification, '_notificationState', State.HIDDEN,
408 { y: yPos,
409 // JRL changes end
410 _opacity: 0,
411 time: ANIMATION_TIME,
412 transition: 'easeOutBack',
413 onUpdate: this._clampOpacity,
414 onUpdateScope: this,
415 onComplete: this._hideNotificationCompleted,
416 onCompleteScope: this
417 });
418 } else {
419 // JRL changes begin
420 this._tween(theNotification, '_notificationState', State.HIDDEN,
421 { y: yPos,
422 // JRL changes end
423 opacity: 0,
424 time: ANIMATION_TIME,
425 transition: 'easeOutQuad',
426 onComplete: this._hideNotificationCompleted,
427 onCompleteScope: this
428 });
429 }
430 } else {
431 // JRL changes begin
432 Tweener.removeTweens(theNotification);
433 theNotification.y = yPos;
434 theNotification.opacity = 0;
435 // JRL changes end
436 this._notificationState = State.HIDDEN;
437 this._hideNotificationCompleted();
438 }
398439 }
399440 };
400441
493534 // We use this._showNotificationCompleted() onComplete callback to extend the time the updated
494535 // notification is being shown.
495536
496 let tweenParams;
497 if (versionAtLeast('3.16', Config.PACKAGE_VERSION)) {
498 tweenParams = { _opacity: 255,
499 // JRL changes begin
500 y: yPos,
501 // JRL changes end
502 time: ANIMATION_TIME,
503 transition: 'easeOutBack',
504 onUpdate: this._clampOpacity,
505 onUpdateScope: this,
506 onComplete: this._showNotificationCompleted,
507 onCompleteScope: this
508 };
509 }else
510 {
511 tweenParams = { opacity: 255,
512 // JRL changes begin
513 y: yPos,
514 // JRL changes end
515 time: ANIMATION_TIME,
516 transition: 'easeOutQuad',
517 onComplete: this._showNotificationCompleted,
518 onCompleteScope: this
519 };
520 }
521
522 this._tween(theNotification, '_notificationState', State.SHOWN, tweenParams);
537 if (versionAtLeast('3.34', Config.PACKAGE_VERSION)) {
538 this._notificationState = State.SHOWING;
539 this._bannerBin.remove_all_transitions();
540 this._bannerBin.ease({
541 opacity: 255,
542 duration: ANIMATION_TIME,
543 mode: Clutter.AnimationMode.LINEAR
544 });
545 this._bannerBin.ease({
546 // JRL changes begin
547 y: yPos,
548 // JRL changes end
549 duration: ANIMATION_TIME,
550 mode: Clutter.AnimationMode.EASE_OUT_BACK,
551 onComplete: () => {
552 this._notificationState = State.SHOWN;
553 this._showNotificationCompleted();
554 this._updateState();
555 }
556 });
557 }
558 else
559 {
560 let tweenParams;
561 if (versionAtLeast('3.16', Config.PACKAGE_VERSION)) {
562 tweenParams = { _opacity: 255,
563 // JRL changes begin
564 y: yPos,
565 // JRL changes end
566 time: ANIMATION_TIME,
567 transition: 'easeOutBack',
568 onUpdate: this._clampOpacity,
569 onUpdateScope: this,
570 onComplete: this._showNotificationCompleted,
571 onCompleteScope: this
572 };
573 }else
574 {
575 tweenParams = { opacity: 255,
576 // JRL changes begin
577 y: yPos,
578 // JRL changes end
579 time: ANIMATION_TIME,
580 transition: 'easeOutQuad',
581 onComplete: this._showNotificationCompleted,
582 onCompleteScope: this
583 };
584 }
585
586 this._tween(theNotification, '_notificationState', State.SHOWN, tweenParams);
587 }
523588 };
524589
525590 /*