fedora下的hyprland配置

hyprland安装和基本配置

下面提到的配置文件默认都是在~/.config/hypr/hyprlang.conf

hyprland在官方源下就有提供

dnf install hyprland

配置文件在~/.config/hypr/hyprland.conf

顶部导航栏

可以使用waybar

dnf install waybar

添加自启动

exec-once = waybar

waybar的默认配置文件在/etc/xdg/目录下,我们把它复制到~/.config/waybar

消息通知

这里我下载的是dunst

dnf install dunst

添加自启动

exec-once = dunst

应用程序启动器

有wofi和rofi,这两个差不太多,但是配置文件不一样,rofi在我的系统下没有找到配置文件(config.rasi),wofi的配置文件在/etc/xdg/目录下(config.jsonc 和 style.css)。如果使用rofi需要将配置里的wofi改成rofi 两个'-'去掉一个。

dnf install wofi 

dnf install rofi 

设置壁纸

可以使用hypr生态提供的Hyprpaper

dnf install hyprpaper

添加自启动

exec-once = hyprpaper

创建并编辑~/.config/hypr/hyprpaper.conf
hyprland设置壁纸要预加载

# 预加载图片路径
preload=/path/to/img
# 设置壁纸路径
wallpaper=/path/to/img
# 在壁纸上启用文本渲染
splash=ture 
# 完全禁用ipc,默认为禁用
ipc=off

解决xwayland缩放模糊问题

先禁用xwayland缩放
xwayland {
    force_zero_scaling = true
}
然后单独进行缩放
```bash
exec-once xrdb-merge xft.dpi:144

绑定媒体按键

如果没安装,请安装这三个包,pavucontrol、pamixer和playerctl,添加下列配置(如果没有)

bind = , XF86AudioRaiseVolume, exec, pamixer -i 5 
bind = , XF86AudioLowerVolume, exec, pamixer -d 5 
bind = , XF86AudioMicMute, exec, pamixer --default-source -m
bind = , XF86AudioMute, exec, pamixer -t
bind = , XF86AudioPlay, exec, playerctl play-pause
bind = , XF86AudioPause, exec, playerctl play-pause
bind = , XF86AudioNext, exec, playerctl next
bind = , XF86AudioPrev, exec, playerctl previous

启用触摸板手势

hyprland的手势默认是禁用的
找到workspace_swipe并把它设置为true

调节亮度

通过brightnessctl,如果没有装,请安装它。将下列文本写入配置文件

bind = , XF86MonBrightnessUp, exec, brightnessctl s +5%
bind = , XF86MonBrightnessDown, exec, brightnessctl s 5%-

密码验证器

一部分ui需要使用密码验证(polkit),我之前的桌面环境是gnome,但是无法使用gnome的polkit,可以用这个mate-polkit来替代

dnf install mate-polkit

然后将配置写入

exec-once = /usr/libexec/polkit-mate-authentication-agent-1

睡眠和锁屏

可以下载hypridle,通过配合loginctl来使用

exec-once = hypridle&loginctl

创建并编辑~/.config/hypr/hypridle.conf,并添加一下配置

general {
    lock_cmd = pidof hyprlock || hyprlock       # avoid starting multiple hyprlock instances.
    before_sleep_cmd = loginctl lock-session    # lock before suspend.
    after_sleep_cmd = hyprctl dispatch dpms on  # to avoid having to press a key twice to turn on the display.
}

listener {
    timeout = 150                                # 2.5min.
    on-timeout = brightnessctl -s set 10         # set monitor backlight to minimum, avoid 0 on OLED monitor.
    on-resume = brightnessctl -r                 # monitor backlight restore.
}

# turn off keyboard backlight, comment out this section if you dont have a keyboard backlight.
listener { 
    timeout = 150                                          # 2.5min.
    on-timeout = brightnessctl -sd rgb:kbd_backlight set 0 # turn off keyboard backlight.
    on-resume = brightnessctl -rd rgb:kbd_backlight        # turn on keyboard backlight.
}

listener {
    timeout = 300                                 # 5min
    on-timeout = loginctl lock-session            # lock screen when timeout has passed
}

listener {
    timeout = 330                                                     # 5.5min
    on-timeout = hyprctl dispatch dpms off                            # screen off when timeout has passed
    on-resume = hyprctl dispatch dpms on && brightnessctl -r          # screen on when activity is detected after timeout has fired.
}

listener {
    timeout = 1800                                # 30min
    on-timeout = systemctl suspend                # suspend pc
}

结语

这里基本配置就差不多了,如果哪里有问题还请指出,如果有遗漏的地方,也欢迎讨论。

这是我使用的壁纸

posted @ 2025-03-19 20:33  ime2333  阅读(660)  评论(2)    收藏  举报