HiDPI(高分屏) Hyprland 安装配置
由于我的电脑不是高分屏的,所以在我电脑上测试的结果可能会有写偏差,如果遇到了什么问题,可以在评论区留言,十分感谢!!!
非高分屏看这篇文章,这篇文章还有对一些细节进行描述

安装
可以使用paru或者yay安装(以paru为例):
// 安装对应的HiDPI版本
paru -S xorg-xwayland-hidpi-xprop wlroots-hidpi-xprop-git hyprland-hidpi-xprop-git
paru -S xorg-xrdb //配置xwayland的DPI

高分屏配置2倍缩放
配置 ~/.config/hyprland.conf :
# 配置wayland的缩放为两倍
monitor = ,highres,auto,2
# 告诉 wayland xwayland它自己会缩放两倍,让 wayland 不要管 xwayland 的缩放
exec-once = xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2
# 设置 xwayland 的 DPI 192, 一倍的 DPI 为96, 2倍即为192
exec-once = echo 'Xft.dpi:192' | xrdb -merge
# 设置 xwayland 下 gtk 的缩放,不会影响 wayland 下 gtk 的缩放
env = GDK_SCALE,2 # 这一行我不确定要不要,可以尝试一下
# 设置 xwayalnd 鼠标图标的大小
env = XCURSOR_SIZE,32

非整数缩放
HiDPI 版本的 hyprland 依旧不支持非整数缩放,所以 `monitor = ,highres,auto,2`,`exec-once = xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2` 都必须为2
如果2倍仍不够,依旧保持上面的为2,然后照下面的配置(以2.5倍为例,即DPI为240)
xwayland(所有框架的应用基本都用这个) :
exec-once = echo 'Xft.dpi:240' | xrdb -merge
env = GDK_SCALE,2 # 这一行我不确定要不要,可以尝试一下
env = XCURSOR_SIZE,32
wayland(不同框架的应用配置方式不同):
gtk3(安装dconf,dconf-editor): 设置dconf-editor 的 /org/gnome/desktop/interface/text-scaling-factor 改字体缩放为2.5,
/org/gnome/desktop/interface/scaling-factor 改界面缩放(貌似没用).
QT: export QT_WAYLAND_FORCE_DPI=240 比如OBS必须在wayalnd下运行
electron: 运行electron时加参数`--force-device-scale-factor`,有输入法和显示bug(建议electron在xwayland下运行,默认是在xwayland下运行)
fcitx5: 设置输入框的DPI:
fcitx5-configtool->Addons -> Classic User Interface -> ✅ Use Per Screen DPI
fcitx5-configtool->Addons -> Classic User Interface -> Force Font DPI on Wayland 240
其他: 像waybar这种就调一下字体大小就行
详情参考: https://wiki.archlinux.org/title/HiDPI#GUI_toolkits

