Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send notification on screenshot #2238

Merged
merged 18 commits into from
Jan 26, 2025
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -2325,6 +2325,10 @@ namespace Gala {
bool success = false;
string filename_used = "";
yield screenshot_manager.screenshot_window (true, false, true, filename, out success, out filename_used);

if (success) {
send_screenshot_notification (clipboard);
}
} catch (Error e) {
// Ignore this error
}
Expand All @@ -2339,6 +2343,10 @@ namespace Gala {
int x, y, w, h;
yield screenshot_manager.select_area (out x, out y, out w, out h);
yield screenshot_manager.screenshot_area (x, y, w, h, true, filename, out success, out filename_used);

if (success) {
send_screenshot_notification (clipboard);
}
} catch (Error e) {
// Ignore this error
}
Expand All @@ -2350,9 +2358,23 @@ namespace Gala {
bool success = false;
string filename_used = "";
yield screenshot_manager.screenshot (false, true, filename, out success, out filename_used);

if (success) {
send_screenshot_notification (clipboard);
}
} catch (Error e) {
// Ignore this error
}
}

private void send_screenshot_notification (bool clipboard) {
notifications_manager.send.begin (
"ScreenshotManager",
"image-x-generic",
_("Screenshot taken"),
clipboard ? _("Screenshot is saved to clipboard") : _("Screenshot saved to screenshots folder"),
new GLib.HashTable<string, Variant> (null, null)
);
}
}
}
Loading