How to make terminal sushi a file with focus on it?

I plan to use sushi as my preview application in Zotero(A famous open source research assistant), it is similar to run a command which is “sushi FILENAME” in shell. it turn out that the preview window does not have focus and is buried under Zotero mainwindow. For finding out possible workaround, I tried to do the following:

  1. Execute “/usr/bin/sushi MyFileName.pdf” in terminal, the preview windows only have focus for the first time I run the command, then I close the preview windows; after that every time I execute the same command, the preview window is always behind the terminal windows.
  2. I think it may be caused by gnome, so I try to use evince(the ubuntu default PDF reader) open PDF file, execute “/usr/bin/evince MyFileName.pdf” in terminal, the new window have focus every time. same result for other PDF reader application(libreoffice…etc)
  3. Open file in Nautilus, the preview window always show with focus on it, so sushi perfroms perfectly in this case.
  4. in sushi README, I discover sushi support show files manually, so I use dbus-send to call org.gnome.NautilusPreviewer. the command is below:
    dbus-send --print-reply --dest=org.gnome.NautilusPreviewer /org/gnome/NautilusPreviewer org.gnome.NautilusPreviewer.ShowFile string:"file:///home/madhouse/Downloads/U1D400.pdf" int32:58720257 boolean:true
    I want to make preview windows active(focus) by setting parent windows ID(int32:58720257 is parent window id), but the preview windows always behind the terminal windows after the first time. this situation is the same as the first case.
  5. Comparing the above will find that sushi cant preview file with focus on it when run it in terminal. What’s the reason for this kind of behavior? Any possible workarounds for this?
    Peek 2023-06-03 22-41
    my device: Ubuntu 20.04 //gnome version: 3.36.8
    PS:
    I have already submitted this issue([Link]), but the developer thinks it is not actionable and closed the issue soon. I believe it is unreasonable (because this is obviously a bug)
    Now my temporary solution is install the gnome extension (steal my focus) to force all new window immediately into focus.

I test the command with the Xterm, It is amazing, sushi can show file with focus on it, what is the difference between Terminal and Xterm, I am not familiar with Xterm.

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.