disable-screenshot-notification.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. --- a/js/ui/screenshot.js
  2. +++ b/js/ui/screenshot.js
  3. @@ -2319,49 +2319,7 @@ function _storeScreenshot(bytes, pixbuf) {
  4. pixbuf.rowstride
  5. );
  6. - // Show a notification.
  7. - const source = new MessageTray.Source({
  8. - // Translators: notification source name.
  9. - title: _('Screenshot'),
  10. - iconName: 'screenshot-recorded-symbolic',
  11. - });
  12. - const notification = new MessageTray.Notification({
  13. - source,
  14. - // Translators: notification title.
  15. - title: _('Screenshot captured'),
  16. - // Translators: notification body when a screenshot was captured.
  17. - body: _('You can paste the image from the clipboard.'),
  18. - datetime: time,
  19. - gicon: content,
  20. - isTransient: true,
  21. - });
  22. -
  23. - if (!disableSaveToDisk) {
  24. - // Translators: button on the screenshot notification.
  25. - notification.addAction(_('Show in Files'), () => {
  26. - const app =
  27. - Gio.app_info_get_default_for_type('inode/directory', false);
  28. -
  29. - if (app === null) {
  30. - // It may be null e.g. in a toolbox without nautilus.
  31. - log('Error showing in files: no default app set for inode/directory');
  32. - return;
  33. - }
  34. -
  35. - app.launch([file], global.create_app_launch_context(0, -1));
  36. - });
  37. - notification.connect('activated', () => {
  38. - try {
  39. - Gio.app_info_launch_default_for_uri(
  40. - file.get_uri(), global.create_app_launch_context(0, -1));
  41. - } catch (err) {
  42. - logError(err, 'Error opening screenshot');
  43. - }
  44. - });
  45. - }
  46. -
  47. - Main.messageTray.add(source);
  48. - source.addNotification(notification);
  49. + // patched: do not show a notification after taking a screenshot
  50. return file;
  51. }