Score:1

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

ru flag

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. I test the command “/usr/bin/sushi MyFileName.pdf” with the Xterm, It is amazing, sushi always show file with focus on it, what is the difference between Terminal and Xterm, I am not familiar with Xterm.

  6. 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. Now my temporary solution is install the gnome extension (steal my focus) to force all new window immediately into focus.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.