Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow native wayland options to support HiDPI screens that using fractional scaling (snap builds) #116

Merged
merged 4 commits into from
Apr 8, 2024

Conversation

azvyae
Copy link
Contributor

@azvyae azvyae commented Apr 7, 2024

Apparently more people are using larger screen nowadays and they tend to use fractional scaling (especially in wayland). This is what happened when we use electron through xwayland compositor:

image

image

Both images are preserving its size and also the screenshot, but the second picture was taken from the 2.5K monitor and appears to be blurred.

Electron on the other hand already supports native wayland settings so can address this issue by providing simple Execute command:

/usr/bin/env ELECTRON_OZONE_PLATFORM_HINT=auto restfox

But because your electron-build config (especially snap) doesn't support wayland, so the command line wouldn't work and triggers segmentation error.

image

This PR just simply added allowNativeWayland option on snap build so we can activate ELECTRON_OZONE_PLATFORM_HINT env.

Copy link

netlify bot commented Apr 7, 2024

Deploy Preview for chimerical-kitsune-a0bfa0 ready!

Name Link
🔨 Latest commit e2c6423
🔍 Latest deploy log https://app.netlify.com/sites/chimerical-kitsune-a0bfa0/deploys/6613f05a0f609a0008dfb4fc
😎 Deploy Preview https://deploy-preview-116--chimerical-kitsune-a0bfa0.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@azvyae azvyae changed the title Allow native wayland options to support HiDPI screens that using fractional scaling Allow native wayland options to support HiDPI screens that using fractional scaling (snap builds) Apr 7, 2024
@flawiddsouza
Copy link
Owner

Hey @azvyae, thanks for the fix. Can you check if this flag can be moved to the electron builder config here?
image

@flawiddsouza
Copy link
Owner

@azvyae Just to confirm before the merge. Flag works after moving to package.json right?

@azvyae
Copy link
Contributor Author

azvyae commented Apr 8, 2024

I can open the snap application now when the flag is there, (mentioning that before I added the configuration, it cannot open the app at all and creating a segmentation fault). But I'm currently struggling to serve the UI, running npm run build-snap inside the electron package folder is indeed creating a snap file, but it showing only white screen because UI is missing, probably because the build setup that I did. Am I missing something?

(node:60574) electron: Failed to load URL:
file:https:///snap/restfox/x1/resources/app.asar/ui/index.html with error: ERR_FILE_NOT_FOUND
(Use `restfox --trace-warnings ...` to show where the warning was created)

image

@flawiddsouza
Copy link
Owner

To build the ui, use these commands:

cd ui
npm run build-desktop-electron

Then you will be able to see the ui in the built binary. The above needs to be done before building the binary.

@azvyae
Copy link
Contributor Author

azvyae commented Apr 8, 2024

Taken from 2.5K display with 150% fractional scaling on 😁, and seems like there is no blurry problem anymore, to allow the app running on wayland, user should also provide these argument on .desktop launcher.

/usr/bin/env ELECTRON_OZONE_PLATFORM_HINT=auto restfox

image

Edit: it also appears to be working fine (when the flag is omitted and running in Xwayland or even X11). Here's a bit info on my system if you need that.

image

You may proceed to merge this PR, thanks.

@flawiddsouza
Copy link
Owner

Nice. I was going to say setting that env manually seems cumbersome. But it seems it's working without so that's great.

@flawiddsouza flawiddsouza merged commit fe5695a into flawiddsouza:main Apr 8, 2024
4 checks passed
@azvyae
Copy link
Contributor Author

azvyae commented Apr 8, 2024

Actually that env can automatically checks if current display manager is wayland or x11, and will switch to either of two at the runtime, but unfortunately, I don't know where you put the script to generate .desktop file in the snap builds.

@flawiddsouza
Copy link
Owner

snap install automatically generates it. Not sure if there's a way to modify it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants