Skip to content
This repository has been archived by the owner on Mar 6, 2022. It is now read-only.

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

Closed
obahareth opened this issue Jan 4, 2020 · 18 comments
Closed

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

obahareth opened this issue Jan 4, 2020 · 18 comments
Labels
help wanted Extra attention is needed

Comments

@obahareth
Copy link
Owner

obahareth commented Jan 4, 2020

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:

  • Unpack the app.asar, modify the JS to somehow inject the script tag and persist that change across the index.html changes.
  • Making a daemon in Go that watches changes to the Application Support/Notion/assetCache directory and re-inject the tag as necessary.
@obahareth obahareth added the help wanted Extra attention is needed label Jan 7, 2020
@obahareth
Copy link
Owner Author

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
Copy link
Contributor

dragonwocky commented Aug 13, 2020

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
Copy link
Owner Author

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

@dragonwocky
Copy link
Contributor

dragonwocky commented Aug 15, 2020

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
Copy link
Collaborator

Fahme commented Aug 15, 2020

@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
Copy link
Contributor

dragonwocky commented Aug 16, 2020

@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
Copy link
Collaborator

Fahme commented Aug 20, 2020

@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
Copy link
Contributor

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
Copy link
Contributor

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

@alonidel
Copy link

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
Copy link
Owner Author

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

@alonidel
Copy link

alonidel commented Aug 28, 2020

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

@dragonwocky
Copy link
Contributor

@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
Copy link
Contributor

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
Copy link
Owner Author

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

@allcontributors
Copy link
Contributor

@obahareth

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

@neronguyenvn
Copy link

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
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants