Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 9 additions & 1 deletion src/components/sidebar/views/system_view.vala
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,15 @@ namespace Singularity {
var app = (Gtk.Application) GLib.Application.get_default();
var tool = Singularity.ScreenshotTool.get_default(app);
if (!tool.ensure_screenshots()) return;
tool.present();
// prepare_for_invocation() resolves _target_monitor/_target_connector
// and sets the layer-shell output -- without it both stay null and
// screen-mode capture fails with "no target monitor for screen
// capture" the instant this opens, since it defaults to screen mode.
// shortcut_manager.vala's screenshot_tool_action() (the Print-key
// path) already does this; this entry point never did.
var handle = Singularity.AppSystem.get_default().get_focused_window_handle();
tool.prepare_for_invocation(handle);
tool.open_dialog();
});
_edit_button = new Button.from_icon_name("document-edit-symbolic");
_edit_button.has_frame = false;
Expand Down
9 changes: 8 additions & 1 deletion src/core/screenshot_portal.vala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ namespace Singularity {
}

public bool is_available() {
if (connection == null) return false;
if (connection == null) {
warning("[ScreenshotPortal] is_available: no session bus connection");
return false;
}
try {
var res = connection.call_sync(
"org.freedesktop.DBus",
Expand All @@ -35,8 +38,12 @@ namespace Singularity {
DBusCallFlags.NONE, -1, null);
bool owned;
res.get("(b)", out owned);
if (!owned) {
warning("[ScreenshotPortal] is_available: org.freedesktop.portal.Desktop has no owner");
}
return owned;
} catch (Error e) {
warning("[ScreenshotPortal] is_available: NameHasOwner call failed: %s", e.message);
return false;
}
}
Expand Down