Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 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
4 changes: 3 additions & 1 deletion src/ScreenshotManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace Gala {
[DBus (name="org.gnome.Shell.Screenshot")]
public class ScreenshotManager : Object {
private WindowManager wm;
private NotificationsManager notifications_manager;
private Settings desktop_settings;

private string prev_font_regular;
Expand All @@ -31,8 +32,9 @@ namespace Gala {
private uint conceal_timeout;

[DBus (visible = false)]
public ScreenshotManager (WindowManager _wm) {
public ScreenshotManager (WindowManager _wm, NotificationsManager _notifications_manager) {
wm = _wm;
notifications_manager = _notifications_manager;
}

construct {
Expand Down
24 changes: 23 additions & 1 deletion src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ namespace Gala {
unowned Meta.Display display = get_display ();

notifications_manager = new NotificationsManager ();
screenshot_manager = new ScreenshotManager (this);
screenshot_manager = new ScreenshotManager (this, notifications_manager);
DBus.init (this, notifications_manager, screenshot_manager);

WindowListener.init (display);
Expand Down Expand Up @@ -2323,6 +2323,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 @@ -2337,6 +2341,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 @@ -2348,9 +2356,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