1717
1818[DBus (name= " org.gnome.Shell.Screenshot" )]
1919public class Gala.ScreenshotManager : GLib .Object {
20+ private const string NOTIFICATION_COMPONENT_NAME = " ScreenshotManager" ;
2021 private const string EXTENSION = " .png" ;
2122 private const int UNCONCEAL_TEXT_TIMEOUT = 2000 ;
2223
2324 private WindowManager wm;
25+ private NotificationsManager notifications_manager;
2426 private Settings desktop_settings;
2527
2628 private string prev_font_regular;
@@ -29,8 +31,9 @@ public class Gala.ScreenshotManager : GLib.Object {
2931 private uint conceal_timeout;
3032
3133 [DBus (visible = false )]
32- public ScreenshotManager (WindowManager _wm ) {
34+ public ScreenshotManager (WindowManager _wm , NotificationsManager _notifications_manager ) {
3335 wm = _wm;
36+ notifications_manager = _notifications_manager;
3437 }
3538
3639 construct {
@@ -92,6 +95,7 @@ public class Gala.ScreenshotManager : GLib.Object {
9295
9396 if (success) {
9497 play_shutter_sound ();
98+ send_notification (filename == " " );
9599 }
96100 }
97101
@@ -123,6 +127,7 @@ public class Gala.ScreenshotManager : GLib.Object {
123127
124128 if (success) {
125129 play_shutter_sound ();
130+ send_notification (filename == " " );
126131 } else {
127132 throw new DBusError .FAILED (" Failed to save image" );
128133 }
@@ -181,6 +186,7 @@ public class Gala.ScreenshotManager : GLib.Object {
181186
182187 if (success) {
183188 play_shutter_sound ();
189+ send_notification (filename == " " );
184190 }
185191 }
186192
@@ -381,6 +387,18 @@ public class Gala.ScreenshotManager : GLib.Object {
381387 context. play_full (0 , props, null );
382388 }
383389
390+ private void send_notification (bool clipboard) {
391+ notifications_manager. send (
392+ new NotificationsManager .NotificationData (
393+ NOTIFICATION_COMPONENT_NAME ,
394+ " Screenshot taken" ,
395+ clipboard ? _(" Screenshot is saved to clipboard" ) : _(" Screenshot saved to screenshots folder" ),
396+ " image-x-generic" ,
397+ new GLib .HashTable<string, Variant > (null , null )
398+ )
399+ );
400+ }
401+
384402 private Cairo . ImageSurface take_screenshot (int x, int y, int width, int height, bool include_cursor) {
385403 Cairo . ImageSurface image;
386404 int image_width, image_height;
0 commit comments