FooSoft / yomichan

Japanese pop-up dictionary extension for Chrome and Firefox.
https://foosoft.net/projects/yomichan
Other
1.06k stars 222 forks source link

[Feature Request] Yomichan for Desktop #146

Closed SpongebobSquamirez closed 5 years ago

SpongebobSquamirez commented 5 years ago

Is there a quick way to get Yomichan to work as a desktop application, so it can work with other programs like PDF readers and ebook readers (e.g. Acrobat and Kindle)? Basically, like goldendict with its ctrl+C+C rikai-like functionality, but also with Anki Connect integration to save the original sentence. The latter would definitely be the priority, since goldendict and tagaini exist for system-wide lookups (although goldendict doesn't work with conjugated words), so I guess I'm just wondering how to make Anki Connect more universal (either working with everything, or at least with things like adobe reader/acrobat, kindle, calibre, MS word, notepad++, etc.)? I don't really know much about getting other programs to send HTTP POST requests...

Is autohotkey/pywinauto a better solution for this? Would using Anki Connect or porting Yomichan to desktop be worth the effort?

oudajosefu commented 5 years ago

I'm surprised no one's replied to or even commented on this request. I'd really like to see this happen, since it would make language learning on apps other than browsers much more convenient.

toasted-nutbread commented 5 years ago

I don't speak on behalf of the main developer, but I'll make a response since I looked at this feature request a while back and contemplated it a bit.

Based on what I've learned while adding some features recently, this would not be possible. The main reason being that this extension uses standardized APIs and functionality that are core to web browser technologies, and these capabilities wouldn't be available in other contexts. While it could be theoretically possible to still use the same core JavaScript source for a desktop app (see: Electron), other things would be extremely difficult and/or time consuming.

One big example would be how to detect the text from other apps. Going the simplest route and assuming this would be targeting a single operating system (let take Windows for example), there are many different ways Windows can render text. Some methods may be somewhat standardized (DirectWrite), but not all applications will render text this way. An alternative would be to try to use OCR to detect characters on the screen, but this would be far less robust and not work in the general case. And this is not even scratching the surface of the challenges that would await; other fun issues would include how to hook into the OS text rendering APIs, multiple OS support, testing/compatibility, etc.

FooSoft commented 5 years ago

As @toasted-nutbread points out, this would be outside the scope of the project, and pretty much none of the code that was written for this project could be reused. Also, as pointed out, there is no good way to determine what text is rendered under the cursor in a generic way. If you wanted to make this work cross-platform, it becomes even a bigger nightmare.

I think you might be going about this the wrong way though. Why not just convert whatever PDF, text file, or whatever to HTML and use Yomichan on that? Converters already exist for most formats of consequence, and even if they did not, creating a converter for the format you care about would probably be easier than trying to make a version of Yomichan that just works for all applications.

autoteelar commented 1 year ago

hey, at least some electron apps like Element might be compatible