前言
本文记录了我在 Fedora 上安装 Hyprland 并完成基本使用配置的过程。如果你是其他发行版的话,配置都大差不差。使用发行版对应的包管理器安装即可。如果有wayland版的最好(一般不会有缩放模糊问题),如rori-wayland。
如果有遗漏或错误,欢迎指正和讨论!
Hyprland 安装
Hyprland 已经在 Fedora 官方仓库中提供,可以直接安装:
sudo dnf install hyprland
安装完成后,Hyprland 的配置文件默认在:
~/.config/hypr/hyprland.conf
如果不存在,需要自行创建。
顶部导航栏 - Waybar
安装 Waybar:
sudo dnf install waybar
将 Waybar 添加到 Hyprland 启动项:
exec-once = waybar
Waybar 的默认配置文件位于 /etc/xdg/waybar/,建议复制一份到用户目录并修改:
mkdir -p ~/.config/waybar
cp -r /etc/xdg/waybar/* ~/.config/waybar/
消息通知 - Dunst
安装 Dunst:
sudo dnf install dunst
添加自启动:
exec-once = dunst
应用程序启动器 - Wofi 或 Rofi
选择安装 Wofi 或 Rofi:
sudo dnf install wofi
# 或
sudo dnf install rofi
两者都可以用,注意:
-
Wofi 配置文件在
/etc/xdg/wofi/,包括config.jsonc和style.css。
同样的,可以复制到家目录进行更改
mkdir ~/.config/wofi
cp -r /etc/xdg/wofi/* ~/.config/wofi
- Rofi 的配置文件通常在:
~/.config/rofi/config.rasi
如果没有,可以自己手动创建,或者用命令生成默认配置:
rofi -dump-config > ~/.config/rofi/config.rasi
如果原来是这样用 wofi 的:
bind = SUPER, R, exec, wofi --show drun
如果要使用rofi,需要修改
bind = SUPER, R, exec, rofi -show drun
设置壁纸 - Hyprpaper
安装 Hyprpaper:
sudo dnf install hyprpaper
添加自启动:
exec-once = hyprpaper
创建 Hyprpaper 配置文件:
~/.config/hypr/hyprpaper.conf
示例内容:
# 预加载图片
preload = /path/to/your/image.jpg
# 设置壁纸
wallpaper = /path/to/your/image.jpg
# 启用开机splash
splash = true
# 禁用 IPC
ipc = off
解决 XWayland 缩放模糊问题
在 hyprland.conf 中添加(如果有则修改):
xwayland {
force_zero_scaling = true
}
然后在启动时应用 DPI 设置:
exec-once = xrdb -merge ~/.Xresources
在 ~/.Xresources 中添加:
Xft.dpi: 144
绑定媒体键
安装需要的软件包:
sudo dnf install pavucontrol pamixer playerctl
在 hyprland.conf 中添加媒体键绑定:
bind = , XF86AudioRaiseVolume, exec, pamixer -i 5
bind = , XF86AudioLowerVolume, exec, pamixer -d 5
bind = , XF86AudioMicMute, exec, pamixer --default-source -t
bind = , XF86AudioMute, exec, pamixer -t
bind = , XF86AudioPlay, exec, playerctl play-pause
bind = , XF86AudioNext, exec, playerctl next
bind = , XF86AudioPrev, exec, playerctl previous
触摸板手势支持
Hyprland 的手势默认是关闭的,需要在 hyprland.conf 中启用:
gestures {
workspace_swipe = true
}
调节屏幕亮度
安装 brightnessctl:
sudo dnf install brightnessctl
添加按键绑定:
bind = , XF86MonBrightnessUp, exec, brightnessctl set +5%
bind = , XF86MonBrightnessDown, exec, brightnessctl set 5%-
启用密码验证器 - Polkit
对于某些可能会需要图形界面密码验证的应用,如TimeShift等
安装 Mate-Polkit:
sudo dnf install mate-polkit
添加自启动:
exec-once = /usr/libexec/polkit-mate-authentication-agent-1
睡眠和锁屏管理 - Hypridle
安装 Hypridle:
sudo dnf install hypridle
添加自启动:
exec-once = hypridle
创建并编辑 ~/.config/hypr/hypridle.conf:
general {
lock_cmd = pidof hyprlock || hyprlock
before_sleep_cmd = loginctl lock-session
after_sleep_cmd = hyprctl dispatch dpms on
}
listener {
timeout = 150
on-timeout = brightnessctl set 10
on-resume = brightnessctl -r
}
listener {
timeout = 150
on-timeout = brightnessctl -sd rgb:kbd_backlight set 0
on-resume = brightnessctl -rd rgb:kbd_backlight
}
listener {
timeout = 300
on-timeout = loginctl lock-session
}
listener {
timeout = 330
on-timeout = hyprctl dispatch dpms off
on-resume = hyprctl dispatch dpms on && brightnessctl -r
}
listener {
timeout = 1800
on-timeout = systemctl suspend
}
附加优化和小技巧
窗口动效与透明效果
在 hyprland.conf 中添加动效和透明:
animations {
enabled = yes
bezier = ease, 0.25, 0.1, 0.25, 1.0
animation = windows, 1, 7, ease
animation = workspaces, 1, 5, ease
}
decoration {
blur {
enabled = true
size = 8
passes = 3
}
drop_shadow = true
shadow_range = 20
shadow_render_power = 3
}
使用 OSD 提示音量/亮度变化
安装 dunst + mako 配合脚本,可以实现音量/亮度变化时的提示。
结语
以上就是 Fedora 上 Hyprland 的基础配置教程。
整体体验非常流畅炫酷,配置也不算复杂。
如果大家有更多实用的优化方法,欢迎一起讨论交流!
刚创的,欢迎加入->HYPR2025LD(QQ频道)
869






