diff --git a/data/dbus-interfaces/org.freedesktop.FileManager1.xml b/data/dbus-interfaces/org.freedesktop.FileManager1.xml
new file mode 100644
index 000000000..7f03e8640
--- /dev/null
+++ b/data/dbus-interfaces/org.freedesktop.FileManager1.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/data/gnome-shell-dbus-interfaces.gresource.xml b/data/gnome-shell-dbus-interfaces.gresource.xml
index c3954ba39..d4c189520 100644
--- a/data/gnome-shell-dbus-interfaces.gresource.xml
+++ b/data/gnome-shell-dbus-interfaces.gresource.xml
@@ -10,6 +10,7 @@
org.freedesktop.bolt1.Device.xml
org.freedesktop.bolt1.Manager.xml
org.freedesktop.DBus.xml
+ org.freedesktop.FileManager1.xml
org.freedesktop.GeoClue2.Agent.xml
org.freedesktop.GeoClue2.Manager.xml
org.freedesktop.impl.portal.Access.xml
diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js
index a1206a56d..aebde0c63 100644
--- a/js/ui/screenshot.js
+++ b/js/ui/screenshot.js
@@ -33,6 +33,32 @@ const ScreenshotIface = loadInterfaceXML('org.gnome.Shell.Screenshot');
const ScreencastIface = loadInterfaceXML('org.gnome.Shell.Screencast');
const ScreencastProxy = Gio.DBusProxy.makeProxyWrapper(ScreencastIface);
+const FileManagerIface = loadInterfaceXML('org.freedesktop.FileManager1');
+const FileManagerProxy = Gio.DBusProxy.makeProxyWrapper(FileManagerIface);
+
+function showInFiles(file) {
+ new FileManagerProxy(
+ Gio.DBus.session,
+ 'org.freedesktop.FileManager1',
+ '/org/freedesktop/FileManager1',
+ (proxy, error) => {
+ if (error) {
+ Main.notifyError(
+ _('Unable to Show in Files'),
+ _('File manager encountered a problem'));
+ console.warn(error.message);
+ return;
+ }
+
+ proxy.ShowItemsAsync([file.get_uri()], '').catch(e => {
+ Main.notifyError(
+ _('Unable to Show in Files'),
+ _('File manager encountered a problem'));
+ console.warn(e.message);
+ });
+ });
+}
+
const IconLabelButton = GObject.registerClass(
class IconLabelButton extends St.Button {
_init(iconName, label, params) {
@@ -2034,18 +2060,7 @@ export const ScreenshotUI = GObject.registerClass({
_('Click here to view the video.')
);
// Translators: button on the screencast notification.
- notification.addAction(_('Show in Files'), () => {
- const app =
- Gio.app_info_get_default_for_type('inode/directory', false);
-
- if (app === null) {
- // It may be null e.g. in a toolbox without nautilus.
- log('Error showing in files: no default app set for inode/directory');
- return;
- }
-
- app.launch([file], global.create_app_launch_context(0, -1));
- });
+ notification.addAction(_('Show in Files'), () => showInFiles(file));
notification.connect('activated', () => {
try {
Gio.app_info_launch_default_for_uri(
@@ -2275,18 +2290,7 @@ function _storeScreenshot(bytes, pixbuf) {
if (!disableSaveToDisk) {
// Translators: button on the screenshot notification.
- notification.addAction(_('Show in Files'), () => {
- const app =
- Gio.app_info_get_default_for_type('inode/directory', false);
-
- if (app === null) {
- // It may be null e.g. in a toolbox without nautilus.
- log('Error showing in files: no default app set for inode/directory');
- return;
- }
-
- app.launch([file], global.create_app_launch_context(0, -1));
- });
+ notification.addAction(_('Show in Files'), () => showInFiles(file));
notification.connect('activated', () => {
try {
Gio.app_info_launch_default_for_uri(