@@ -21,7 +21,10 @@ namespace Gala {
2121
2222 [DBus (name ="org.gnome. Shell .Screenshot ")]
2323 public class ScreenshotManager : Object {
24+ private const string NOTIFICATION_COMPONENT_NAME = " ScreenshotManager" ;
25+
2426 private WindowManager wm;
27+ private NotificationsManager notifications_manager;
2528 private Settings desktop_settings;
2629
2730 private string prev_font_regular;
@@ -30,8 +33,9 @@ namespace Gala {
3033 private uint conceal_timeout;
3134
3235 [DBus (visible = false )]
33- public ScreenshotManager (WindowManager _wm) {
36+ public ScreenshotManager (WindowManager _wm, NotificationsManager _notifications_manager ) {
3437 wm = _wm;
38+ notifications_manager = _notifications_manager;
3539 }
3640
3741 construct {
@@ -93,6 +97,7 @@ namespace Gala {
9397
9498 if (success) {
9599 play_shutter_sound ();
100+ send_notification (filename == " " );
96101 }
97102 }
98103
@@ -124,6 +129,7 @@ namespace Gala {
124129
125130 if (success) {
126131 play_shutter_sound ();
132+ send_notification (filename == " " );
127133 } else {
128134 throw new DBusError .FAILED (" Failed to save image" );
129135 }
@@ -182,6 +188,7 @@ namespace Gala {
182188
183189 if (success) {
184190 play_shutter_sound ();
191+ send_notification (filename == " " );
185192 }
186193 }
187194
@@ -382,6 +389,18 @@ namespace Gala {
382389 context. play_full (0 , props, null );
383390 }
384391
392+ private void send_notification (bool clipboard) {
393+ notifications_manager. send (
394+ new NotificationsManager .NotificationData (
395+ NOTIFICATION_COMPONENT_NAME ,
396+ " Screenshot taken" ,
397+ clipboard ? _(" Screenshot is saved to clipboard" ) : _(" Screenshot saved to screenshots folder" ),
398+ " image-x-generic" ,
399+ new GLib .HashTable<string, Variant > (null , null )
400+ )
401+ );
402+ }
403+
385404 private Cairo . ImageSurface take_screenshot (int x, int y, int width, int height, bool include_cursor) {
386405 Cairo . ImageSurface image;
387406 int image_width, image_height;
0 commit comments