3

In Gnome 3, Nautilus has a new file previewer called Sushi. You can select a file in Nautilus, hit the spacebar and it will show a quick preview. This is very similar to what Quick Look (Preview) on OSX does. Quick Look has a command line interface that allows you to use Quick Look from inside your own application. Sushi does not appear to allow this.

It appears the only way to call sushi it via dbus. (If you know how to call it via the cmd line, even better) I found sushi's source for where it registers its dbus messages but cannot figure out how to call it.

Here's what I tried:

> qdbus org.gnome.NautilusPreviewer /org/gnome/NautilusPreviewer org.gnome.NautilusPreviewer.ShowFile /foo/bar/baz.png 0x1c00010 0
Error: org.gnome.gjs.JSError.Error
Argument 'parent' (type interface) may not be null

I'm a novice when it comes to dbus, so maybe I'm missing something obvious

> dbus-send --print-reply --dest=org.gnome.NautilusPreviewer /org/gnome/NautilusPreviewer org.gnome.NautilusPreviewer.ShowFile string:"/foo/bar/baz.png" uint32:0x1c00010 uint32:1
Error org.freedesktop.DBus.Error.InvalidArgs: Type of message, '(suu)', does not match expected type '(sib)'
Matt
  • 1,415
  • 2
  • 15
  • 23

2 Answers2

3

Try this:

dbus-send --print-reply --dest=org.gnome.NautilusPreviewer /org/gnome/NautilusPreviewer org.gnome.NautilusPreviewer.ShowFile string:"file:///foo/bar/baz.png" int32:0 boolean:false

Your second error means you used incorrect types: you should use string, int32 and boolean (sib), not string and two unsigned integers (suu).

Also please note that you should use URI, not raw filename - just add file:// scheme prefix.

Second parameter should be xid of Window you want to show your preview over. But 0 works for me.

N0rbert
  • 559
  • 5
  • 22
Kyrylo Polezhaiev
  • 1,626
  • 11
  • 18
  • This doesn't seem to work anymore: "arguments to dbus_message_new_signal() were incorrect, assertion "_dbus_check_is_valid_path (path)" failed in file ../../../dbus/dbus-message.c line 1456." – hackel Jun 16 '17 at 14:39
  • As to an older version of Debian 8.11.1, `init32:0` will not work. The zero needs to be replaced with the current window ID. Otherwise, you get: "`Error org.gnome.gjs.JSError.Error: Argument 'parent' (type interface) may not be null`". I spent several hours today, and a couple of hours on a previous occasion, and was lucky enough today to find an Emacs lisp library `quick-preview.el`, which resolved the issue. – lawlist Dec 08 '22 at 06:15
0

I am not an expert on the question and pretty novice to linux. I faced this problem too and manage to solve it by reinstalling the dbg package.

I noticed that during the upgrade to 19.10 this package add necessarily to be remove to pursue with the installation.

Once the upgrade was performed, gnome-showed the same error as mentioned @Matthew Levine in the first post. reinstall gdb solved the issue for me.