jlebon / textern

A Firefox add-on for editing text in your favourite external editor!
GNU General Public License v3.0
138 stars 21 forks source link

Support for macOS, mainly by replacing inotify with watchgod, which works cross-plattform #46

Open wosc opened 5 years ago

wosc commented 5 years ago

See issue #10 for more details. I've tested this under both Linux and macOS, and it worked fine for me.

Note that watchgod (isn't that name cute ;) does not use inotify/fsevents but file polling instead. I don't think the performance implications are terrible, but I admit it's not as pleasing to my nerd-sense of elegance.

My main reason for chosing it is that it offers an asyncio-compatible API, so it was really easy to integrate. Alternatives do exist, e.g. watchdog was mentioned in a previous issue comment, that uses inotify on Linux and FSEvents on macOS. However, its API is thread-based, and I have no idea how that could be integrated with asyncio, or whether that's even possible.

jlebon commented 5 years ago

Neat, thanks for this!

Alternatives do exist, e.g. watchdog was mentioned in a previous issue comment, that uses inotify on Linux and FSEvents on macOS. However, its API is thread-based, and I have no idea how that could be integrated with asyncio, or whether that's even possible.

Hmm, I haven't hacked on asyncio Python in a while, but I think we could get this to work. Will investigate.