Skip to content

Commit 741f2ac

Browse files
Send notification on screenshot (#2238)
Co-authored-by: Leonhard <[email protected]>
1 parent 6cdb795 commit 741f2ac

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/WindowManager.vala

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2325,6 +2325,10 @@ namespace Gala {
23252325
bool success = false;
23262326
string filename_used = "";
23272327
yield screenshot_manager.screenshot_window (true, false, true, filename, out success, out filename_used);
2328+
2329+
if (success) {
2330+
send_screenshot_notification (clipboard);
2331+
}
23282332
} catch (Error e) {
23292333
// Ignore this error
23302334
}
@@ -2339,6 +2343,10 @@ namespace Gala {
23392343
int x, y, w, h;
23402344
yield screenshot_manager.select_area (out x, out y, out w, out h);
23412345
yield screenshot_manager.screenshot_area (x, y, w, h, true, filename, out success, out filename_used);
2346+
2347+
if (success) {
2348+
send_screenshot_notification (clipboard);
2349+
}
23422350
} catch (Error e) {
23432351
// Ignore this error
23442352
}
@@ -2350,9 +2358,23 @@ namespace Gala {
23502358
bool success = false;
23512359
string filename_used = "";
23522360
yield screenshot_manager.screenshot (false, true, filename, out success, out filename_used);
2361+
2362+
if (success) {
2363+
send_screenshot_notification (clipboard);
2364+
}
23532365
} catch (Error e) {
23542366
// Ignore this error
23552367
}
23562368
}
2369+
2370+
private void send_screenshot_notification (bool clipboard) {
2371+
notifications_manager.send.begin (
2372+
"ScreenshotManager",
2373+
"image-x-generic",
2374+
_("Screenshot taken"),
2375+
clipboard ? _("Screenshot is saved to clipboard") : _("Screenshot saved to screenshots folder"),
2376+
new GLib.HashTable<string, Variant> (null, null)
2377+
);
2378+
}
23572379
}
23582380
}

0 commit comments

Comments
 (0)