manateelazycat / popweb

Show popup web window for Emacs
146 stars 17 forks source link

The window of popweb does not hide automatically #20

Closed chenyanming closed 1 year ago

chenyanming commented 2 years ago

At he first time loading popweb-dict-youdao-pointer, two *popweb* buffers/processes created (I think this should be a bug , I tried to fix, but in vain).

image

Then I do second time popweb-dict-youdao-pointer, a second popweb window shows up, the first popweb window does not hide until I kill the first *popweb* process manually.

image

Windows Emacs 27.2

MatthewZMD commented 2 years ago

Your sure this bug is still here after your patch?

chenyanming commented 2 years ago

yes, I have not found a way to fix it yet

MatthewZMD commented 2 years ago

I cannot reproduce your problem in Linux.

manateelazycat commented 2 years ago

I cannot reproduce too

chenyanming commented 2 years ago

Here is more information: Python 3.10.0 epc 0.0.5 pip 21.2.3 PyGetWindow 0.0.9 PyMuPDF 1.19.2 PyQt5 5.15.6 PyQt5-Qt5 5.15.2 PyQt5-sip 12.9.0 PyQtWebEngine 5.15.5 PyQtWebEngine-Qt5 5.15.2 PyRect 0.1.4 PySocks 1.7.1 setuptools 57.4.0 sexpdata 0.0.3

MatthewZMD commented 2 years ago

Try to call (popweb-call-async "hide_web_window" "dict_bing") yourself

chenyanming commented 2 years ago

Yes, I tired, it would not work, the window was belong to the first *popweb* process. Calling (popweb-call-async "hide_web_window" "dict_bing") only worked on the windows tied to *popweb*<1>. That's why if I kill *popweb*, the first window then dispeared.

MatthewZMD commented 2 years ago

Do the first popweb-dict-youdao-pointer, then (popweb-call-async "hide_web_window" "dict_youdao"), see if it closes, then do the second popweb-dict-youdao-pointer.

damoncro commented 2 years ago

I tested in mac, most of the times, it works. But sometimes (actually I encountered once), the first popup window did not disappear just like in Windows. After that, I did list-processes, both*popweb* and *popweb*<1> were there. I killed *popweb*, the popweb window finally was hidden, I can do popweb-dict-youdao-pointer happily later.

damoncro commented 2 years ago

Do the first popweb-dict-youdao-pointer, then (popweb-call-async "hide_web_window" "dict_youdao"), see if it closes, then do the second popweb-dict-youdao-pointer.

I'll test it if I use Windows later.

damoncro commented 2 years ago

Here is my setting in doom emacs:

  (package! popweb :recipe (:local-repo "modules/popweb" :files ("*") :build (:not compile)))
  (package! popweb-dict :recipe (:local-repo "modules/popweb/extension/dict" :files ("*") :build (:not compile)))
(use-package popweb
  :defer t
  :config
  (if IS-WINDOWS (setq popweb-python-command (let ((python (expand-file-name "d:/python/Python310/python.exe")))
                                (if (executable-find python)
                                    python
                                  (if (memq system-type '(cygwin windows-nt ms-dos)) "python.exe" "python3")))) )
  )
(use-package popweb-dict-bing
  :defer t
  :commands (popweb-dict-bing-input popweb-dict-bing-pointer)

  ) ; Translation using Bing

(use-package popweb-dict-youdao
  :defer t
  :commands (popweb-dict-youdao-input popweb-dict-youdao-pointer)

  ) ; Translation using Youdao
qingshuizheng commented 1 year ago

@chenyanming It might be a problem when you start a 2nd search before the 1st process is properly hidden/closed/killed, you name it. Not sure why it happens, but blaming macOS is always the right thing to do. 😜

The way I workaround it, is to hide any existing popweb-dict process before creating a new one. If still fail to hide it, manually popweb-restart-process is the way to go.

image

Edit: reword, retake screenshot.