zotero / zotero-libreoffice-integration

Zotero LibreOffice integration

Home Page:https://www.zotero.org/support/libreoffice_writer_plugin_usage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Windows: Citation dialog is not brought to front

adomasven opened this issue · comments

I teach at a college in Toronto and strongly advocate Zotero to every single student of mine (actually, I made it mandatory to use it during the courses they have with me). Nonetheless, I know for a fact that many students of mine abandon Zotero right away, since they cannot wrap their minds around this UI bug. I wish I knew how to code so I could attempt to fix this bug. Unfortunately, I cannot do so.

I am not sure what metrics people refer to when they say LibreOffice on Windows is not that common (or is low in usage). It would be great to know what percentage of Zotero users are using it through LibreOffice on a Windows OS, so to form a better understanding of why this serious bug is so low in priority. I, for one, have almost 10 to 15 students coming to my classes every 3 to 4 months, and all of them must use Zotero if they want to pass my courses. That adds up to almost 40 students a year, give or take. That is not an insignificant number. Unless we are waiting for numbers in the vicinity of million or billion users, I consider the current LibreOffice+Windows users significant enough to warrant a higher priority for such a severe bug.

This, first-time-dialogue-box-focus bug gives almost all of my students the impression that Zotero is an unpolished, alpha-release that is not ready for serious work and is not worth a try. That is, sadly, the impression they get, even after me fixing and explaining things to them. Sadly, this type of dialogue-box focus bug is not limited to the first dialogue-box, but the red search-box as well. The combination of these UI issues make Zotero look less ready for any professional work. I totally disagree with that assessment and work, diligently, to educate my students on these issues and encourage them to push through these bitter, initial impressions. A few would persist and eventually learn to live with these annoying bugs. However, most do not. At the end of each course, I always have only 3 to 4 students who could stick around with Zotero long enough to actually learn how to use it and get passed these OLD bugs. The rest simply give up and lose marks if they have to.

Now, I am wondering, maybe THAT is one of the many reasons why Zotero+LibreOffice+Windows combination usage has remained low, as we are told.

@EricBright Ok, so I gave a shot trying to set up Zotero window activation per the link above and got no good results. Unfortunately, Windows is restrictive in which processes are allowed to put windows into foreground (mainly, windows that are in foreground themselves). To get this working we would have to make LibreOffice activate the Zotero dialog, and also ensure that Zotero has allowed LibreOffice to activate it. (See https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-allowsetforegroundwindow and https://docs.microsoft.com/en-gb/windows/win32/api/winuser/nf-winuser-setforegroundwindow?redirectedfrom=MSDN)

Given that I've had problems reproducing this issue very consistently now just testing whether the fix worked, and the indeed rather low userbase of LibreOffice on Windows (Word is simply much more popular amongst Windows users), nothing can be promised for the near future.

Dear @adomasven, thank you for getting back to me.

As you said above, this bug doesn't seem to be a trivial one. Nevertheless, it is strange that Zotero behaves almost perfectly in MS Word. That makes me believe that the issue is not with Windows at all, but with how LibreOffice handles Zotero’s behaviour. Because, if it was Windows itself, then MS Word would also have been affected in a similar way. However, Word seems to be able to handle the dialogue-boxes just fine. Whatever trick(s) Word is using, LibreOffice either does not use, or does not have access to. The latter speculation also does not seem relevant. What is the particular restriction of the OS that Word can easily get around and LibreOffice is totally barred from getting through? That does not seem to be the reason.

I am convinced that it is LibreOffice’s issue. If, by any chance, it is LibreOffice that is causing the trouble, would it be possible to somehow fix the code in LibreOffice instead, since that is also an open source project and anyone can contribute to its code? I mean, if it was my own code that was treated badly by the code from another open source project, I would have certainly looked into the offending code in the other project to see what was wrong with it and if I could fix it there. At least, would it be possible to positively discover the trouble-maker, be it the LibreOffice code or something else, so one could file a bug report with LibreOffice project to put it on their radar?

I so much wished I could write code. :( I feel so helpless, and useless at the same time, not being able to contribute to the projects such as Zotero and LibreOffice that I love so much.

It not restricted to LibreOffice. I use TeXstudio and I have the same problem

For me this issue also appears on the vanilla program (using TexStudio).

lsmi0009 posted a AutoHotKey workaround solution here
I updated it to work again:

/*
Switches focus to the citation window when you press Shift+F1
but only if TeXstudio is the active application.
*/

#SingleInstance
#NoEnv 
SendMode Input 
SetWorkingDir %A_ScriptDir% 

#IfWinActive ahk_exe texstudio.exe  
$+F1:: ; Shift+F1 is the hotkey
    SendInput, +{F1}
    WinWait, Schnellformatierung Zitation,, 3000 ; wait until cite window exists (3s timeout)
    WinActivate, Schnellformatierung Zitation ; activate cite window
    return
#IfWinActive

This is for German, that's why the program searches for "Schnellformatierung Zitation", if your OS is in English, change it to "Quick Format Citation". I also changed the Hotkey to Shift + F1.