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

[feature request] Wayland support #122

Open
ylxdzsw opened this issue Jun 14, 2021 · 5 comments
Open

[feature request] Wayland support #122

ylxdzsw opened this issue Jun 14, 2021 · 5 comments

Comments

@ylxdzsw
Copy link

ylxdzsw commented Jun 14, 2021

我使用的 Gnome + Wayland + fractional scaling,electron-netease-cloud-music 会默认使用 Xwayland 启动,但是会变得模糊。Electron 12 加入了 native Wayland 支持,只需要加两个启动选项就能启用,可以解决模糊的问题。也就是需要这样启动

electron /usr/lib/electron-netease-cloud-music --enable-features=UseOzonePlatform --ozone-platform=wayland

希望能够增加一个内置的选项,这样就不用去覆盖 /usr/bin/electron-netease-cloud-music 或者 .desktop 文件。

@Firestar-Reimu
Copy link

Firefox也会模糊来着……我这边是KDE,我现在都不用Wayland

@SamLukeYes
Copy link

如果是 Arch 系的发行版,可以直接在 ~/.config/electron-flags.conf 中加入这些选项

@rocka
Copy link
Member

rocka commented Nov 6, 2021

尝试了一下使用 Electron 的 commandLine API

app.commandLine.appendSwitch('enable-features', 'UseOzonePlatform');
app.commandLine.appendSwitch('ozone-platform', 'wayland');

在应用启动后添加 command line switch ,能成功启动,但无法渲染界面,就像这样

image
这时候如果把鼠标放到正确的位置,是可以响应点击事件的,也能用 MPRIS 控制播放音乐。


又做了几次试验,发现 --enable-features=UseOzonePlatform 似乎只有放在命令行参数里面才有效;而 --ozone-platform=wayland 用 Electron 的 appendSwitch 来添加也能生效,不知道是不是 Electron 的 bug 。

@icepie
Copy link

icepie commented Apr 11, 2022

#!/bin/bash
exec electron /usr/lib/electron-netease-cloud-music "$@"

可以加个 "$@"

$ electron-netease-cloud-music --enable-features=UseOzonePlatform --ozone-platform=wayland

就可 wayland 模式运行了

然后如果你用的是 gnome 会发现缺失了系统窗口, 可以通过 WaylandWindowDecorations 打开

$ electron-netease-cloud-music --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform=wayland

@DreamMaoMao
Copy link

[Desktop Entry]
Name=netease
Exec=electron-netease-cloud-music --force-device-scale-factor=1 %U
Terminal=false
Type=Application
Icon=netease-cloud-music
StartupWMClass=netease
Categories=Network;
Comment=netease
Keywords=netease;

把缩放还原回 --force-device-scale-factor=1 就不会模糊 ,因为默认是x11模式不支持wayland的分数缩放

如果要缩放使用xwayland 应用的话,最优解是直接修dpi,这样既能缩放x11应用 又不会模糊

echo "Xft.dpi: 140" | xrdb -merge

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

No branches or pull requests

6 participants