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:
- 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.
- 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)
- Open file in Nautilus, the preview window always show with focus on it, so sushi perfroms perfectly in this case.
- 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. - 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?
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.