obahareth / notion-rtl

ARCHIVED - A Chrome extension to enable RTL support in https://notion.so
https://chrome.google.com/webstore/detail/notion-rtl/fflggojmgaedcocmholcdicoedgaabib
MIT License
60 stars 8 forks source link

Find a way to make this work in the desktop apps #3

Closed obahareth closed 4 years ago

obahareth commented 4 years ago

I tried making a script in Go that includes the script in ~/Library/"Application Support"/Notion/assetCache/{version}/index-*.html (on macOS) and it works, however that file gets deleted when relaunching Notion. I also tried unpacking the app.asar from inside /Applications/Notion.app and including that script in renderer/index.html (and even just tossing an H1 there), but it appears that HTML file is only used when launching the app and then a new one is downloaded from the website.

Here's the script tag for reference

<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/obahareth/notion-rtl@master/index.js"></script>

Approaches I'm considering:

obahareth commented 4 years ago

I'm thinking of making a daemon using systray and having it run automatically on startup (with options to disable that from the menubar icon)

dragonwocky commented 4 years ago

Hey!

I work on the notion-enhancer, a script that mods the desktop app to add custom theming and scripting. I'm working on transitioning it from a simple mod to a proper mod-loader, and I was hoping to be able to include this as a mod (you'd be properly attributed for it, of course).

If that's alright with you, please let me know as soon as possible :)

obahareth commented 4 years ago

Hey @dragonwocky, thanks a lot for that, that would be wonderful! I'd love to have this mod included there!

dragonwocky commented 4 years ago

Implemented/working and will be included in the update once it's released in a couple days!

Including the improvements from #11 and simplified a bit to remove unnecessary code, it all boils down to this: https://github.com/dragonwocky/notion-enhancer/blob/js/mods/right-to-left/mod.js#L19-L44

image

Fahme commented 4 years ago

@dragonwocky Thanks for your work my implementation in the PR is slightly more performant :

https://stackoverflow.com/a/39332340/6938643 -> give this answer a read hope it will be helpful :)

dragonwocky commented 4 years ago

@Fahme did some performance work with a requestAnimationFrame debounce and getting rid of querySelector, thanks for the StackOverflow link. I didn't use your method, though, because it means only page content is aligned, whereas my updated code fixes #4 and does right-to-left alignment nearly everywhere.

image image

Admittedly it only aligns right within the database as screenshotted after hovering, I don't know what's going on there. Everywhere else it seems to just work, though.

Fahme commented 4 years ago

@dragonwocky there's alot of things that needs to be done for the DB RTL support not only the text but also the buttons that overlay on text, table items, input items etc ..

probably will need to find a better way than currently to support and fix major issues in #1 as well or else this extension is not very practical for full RTL support IMO

dragonwocky commented 4 years ago

it's definitely not perfect, but it's better than nothing. the enhancer is all about improving notion in the ways it can until a better way appears. over time, improvements will be made until notion has support builtin.

dragonwocky commented 4 years ago

https://github.com/dragonwocky/notion-enhancer/ notion-enhancer v0.8 now released.

alonidel commented 4 years ago

Would be great to make the RTL support full. In this example the bullets in the Hebrew text should be on the Right side of the text.

Screen Shot 2020-08-28 at 17 30 24

obahareth commented 4 years ago

@alonidel Are you sure you're on the latest version? This was resolved in #8.

alonidel commented 4 years ago

@obahareth I'm on the latest notion-enhancer (Mac)

dragonwocky commented 4 years ago

@alonidel the version in notion-enhancer is extremely buggy at the moment, and though it was based on this currently has very different code. it's better to ask support for it in the notion-enhancer repo.

dragonwocky commented 4 years ago

I think this issue can be closed: I'm now using a more direct implementation of @Fahme's code, which works reliably and solves the above problem.

obahareth commented 4 years ago

@all-contributors please add @dragonwocky for platform contributions.

allcontributors[bot] commented 4 years ago

@obahareth

I've put up a pull request to add @dragonwocky! :tada:

neronguyenvn commented 3 years ago

Sorry guys can you guide me how to use RTL in Notion Enhanced in Linux ver ? I have already enabled it in Enhancements but don't know how to use in app ...

dragonwocky commented 3 years ago

@DSparda it's bugged at the moment, it will be fixed in the next update. For a temporary fix, check out https://github.com/notion-enhancer/notion-enhancer/issues/589