tisfeng / Easydict

一个简洁优雅的词典翻译 macOS App。开箱即用,支持离线 OCR 识别,支持有道词典,🍎 苹果系统词典,🍎 苹果系统翻译,OpenAI,Gemini,DeepL,Google,Bing,腾讯,百度,阿里,小牛,彩云和火山翻译。A concise and elegant Dictionary and Translator macOS App for looking up words and translating text.
GNU General Public License v3.0
7.03k stars 356 forks source link

🐞 Bug Report: window arrangement been changed after query text #511

Closed phlpsong closed 5 months ago

phlpsong commented 5 months ago

Please confirm the following:

Problem description

window arrangement been changed after query text

Is the issue consistently reproducible?

Reproducible

Steps to Reproduce

  1. Open two Chrome(or any other app) window and one is focused
  2. Open a window next to Chrome window
  3. Query some content in Chrom
  4. Back to Chrome

Screenshot

https://github.com/tisfeng/Easydict/assets/103433299/df5e475d-39ae-4e9c-a696-78b3302c30aa

Expected result

Not change window arrangement after back to the last frontmost app, current behavior is not proper in this case, I have to manually open the notes application after each query completed.

Proposed solution (optional)

Is it possible not to actively activate the previous window when closing the query window?

Device type and OS version

macOS 14.2.1

Are you willing to submit a PR to fix this issue?

tisfeng commented 5 months ago

I understand, indeed this could be a problem.

But this situation where one application has multiple windows is relatively rare, and should be acceptable for most users.

How should we fix it? Should we add an option to allow not automatically activating the previous application window?

phlpsong commented 5 months ago

I have compared Bob's behavior and found that its query window does not request to be focused, Chrom window has always been in focus, so they don't have such issue. Can we do the same?

tisfeng commented 5 months ago

No, I tried it and it automatically activates the previous frontend app as well.

I think this action is fine for the vast majority of users in most scenarios, especially when the user is typing in an input box, in this case hiding the Easydict window and then automatically activating the input box of the foreground application is useful, it makes it easy for the user to continue typing.

In some scenarios, activating the foreground application is necessary, for example, when using translated text to replace the original text.

https://github.com/tisfeng/Easydict/blob/e5ce53bc20ad6b34d04dff62a05fa2d6a361818c/Easydict/Feature/ViewController/View/CustomButton/EZReplaceTextButton/EZReplaceTextButton.m#L38

phlpsong commented 5 months ago

Well, let's leave things as they are for now. Maybe we can see how to improve later.

tisfeng commented 5 months ago

ok