disable-screenshot-notification.patch 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. --- a/js/ui/screenshot.js
  2. +++ b/js/ui/screenshot.js
  3. @@ -2308,68 +2308,7 @@ function _storeScreenshot(bytes, pixbuf) {
  4. saveRecentFile(file);
  5. }
  6. - // Create a St.ImageContent icon for the notification. We want
  7. - // St.ImageContent specifically because it preserves the aspect ratio when
  8. - // shown in a notification.
  9. - const coglContext = global.stage.context.get_backend().get_cogl_context();
  10. - const pixels = pixbuf.read_pixel_bytes();
  11. - const content =
  12. - St.ImageContent.new_with_preferred_size(pixbuf.width, pixbuf.height);
  13. - content.set_bytes(
  14. - coglContext,
  15. - pixels,
  16. - Cogl.PixelFormat.RGBA_8888,
  17. - pixbuf.width,
  18. - pixbuf.height,
  19. - pixbuf.rowstride
  20. - );
  21. -
  22. - // Show a notification.
  23. - const source = new MessageTray.Source({
  24. - // Translators: notification source name.
  25. - title: _('Screenshot'),
  26. - iconName: 'screenshot-recorded-symbolic',
  27. - });
  28. - const notification = new MessageTray.Notification({
  29. - source,
  30. - // Translators: notification title.
  31. - title: _('Screenshot captured'),
  32. - // Translators: notification body when a screenshot was captured.
  33. - body: _('You can paste the image from the clipboard.'),
  34. - datetime: time,
  35. - gicon: content,
  36. - isTransient: true,
  37. - });
  38. -
  39. - if (!disableSaveToDisk) {
  40. - // Translators: button on the screenshot notification.
  41. - notification.addAction(_('Show in Files'), () => {
  42. - const app =
  43. - Gio.app_info_get_default_for_type('inode/directory', false);
  44. -
  45. - if (app === null) {
  46. - // It may be null e.g. in a toolbox without nautilus.
  47. - log('Error showing in files: no default app set for inode/directory');
  48. - return;
  49. - }
  50. -
  51. - app.launch([file], global.create_app_launch_context(0, -1));
  52. - });
  53. - notification.connect('activated', () => {
  54. - try {
  55. - Gio.app_info_launch_default_for_uri(
  56. - file.get_uri(), global.create_app_launch_context(0, -1));
  57. - } catch (err) {
  58. - logError(err, 'Error opening screenshot');
  59. - }
  60. -
  61. - Main.overview.hide();
  62. - Main.panel.closeCalendar();
  63. - });
  64. - }
  65. -
  66. - Main.messageTray.add(source);
  67. - source.addNotification(notification);
  68. + // patched: do not show a notification after taking a screenshot
  69. return file;
  70. }