项目名称:waybar_niri_plugin_WallSwitcher
这是一个给 niri + waybar 用的双层壁纸切换插件。
它同时管理两层内容:
wallpaper:正常桌面看到的壁纸层backdrop:niri进入 overview / 上帝视角时使用的背景层
插件通过 Waybar 左键弹出 fuzzel 菜单进行选择,支持以下两种模式:
自动高斯模糊模式- 选择一个
wallpaper - 如果是图片,就直接把图片做细腻高斯模糊后作为
backdrop - 如果是视频,就先用
ffmpeg导出首帧,再做同样的高斯模糊作为backdrop
- 选择一个
分选模式- 分别选择
wallpaper和backdrop wallpaper支持图片 / 视频 / 透明backdrop支持图片 / 视频
- 分别选择
插件只读取以下两个目录:
~/Pictures/Wallpaper~/Videos/WallVideo
注意:
- 图片请放到
~/Pictures/Wallpaper - 视频请放到
~/Videos/WallVideo - 目录名大小写不敏感,例如
Wallpaper、wallpaper、WALLPAPER都可以被识别 WallVideo同样支持大小写变体,例如WallVideo、wallvideo、WALLVIDEO
请先确保系统里有这些命令:
ffmpegmagick(ImageMagick)jqfuzzelmpvpaperswwwswaybgwaybarniri
waybar/modules/wallpaper-switcher.sh
waybar/modules/wallpaper-switcher.json
snippets/waybar-modules.jsonc.snippet
snippets/waybar-config.snippet
snippets/niri-config.kdl.snippet
把下面两个文件复制到你的 Waybar 模块目录:
waybar/modules/wallpaper-switcher.shwaybar/modules/wallpaper-switcher.json
目标位置通常是:
~/.config/waybar/modules/并确保脚本有执行权限:
chmod +x ~/.config/waybar/modules/wallpaper-switcher.shmkdir -p ~/Pictures/Wallpaper
mkdir -p ~/Videos/WallVideo然后把图片和视频分别放进去。
把 snippets/waybar-modules.jsonc.snippet 里的模块块加入你的 ~/.config/waybar/modules.jsonc。
再把 snippets/waybar-config.snippet 里的 "custom/wallpaper" 加进你想放的位置,例如 modules-left。
把 snippets/niri-config.kdl.snippet 里的内容并入你的 ~/.config/niri/config.kdl:
swww-daemon放进backdropmpvpaper的backgroundlayer 放进backdrop- 开机执行
wallpaper-switcher.sh restore - 绑定
Mod+Ctrl+B打开菜单 - 绑定
Mod+Ctrl+R触发 niri 配置热重载 - 绑定
Mod+Ctrl+W开关 waybar
注意:
- 带有绝对路径的内容只出现在下面两个片段里:
snippets/niri-config.kdl.snippet的第10行,以及第13到15行snippets/waybar-modules.jsonc.snippet的第4行和第8行- 这些行当前按本机路径写成了
/home/lonnet/... - 如果安装目标不是这个用户,请把这些行里的绝对路径改成你自己的家目录路径
touch ~/.config/niri/config.kdl
pkill waybar
waybar &- Waybar 左键点击壁纸模块:打开壁纸菜单
- 选
自动高斯模糊模式:只选一次 wallpaper,插件自动生成 backdrop - 选
分选模式:分别选 wallpaper 和 backdrop
- 用
swaybg作为正常桌面壁纸层
- 用
mpvpaper --layer bottom作为正常桌面壁纸层
- 用
swww-daemon+swww img - 通过
niri的place-within-backdrop true放进 backdrop
- 用
mpvpaper --layer background - 再通过
niri的place-within-backdrop true放进 backdrop
- 如果
~/Pictures/Wallpaper里没有图片,菜单里就不会出现静态图片项 - 如果
~/Videos/WallVideo里没有视频,菜单里就不会出现视频项 - 自动模式下生成的模糊图会缓存在:
~/.config/waybar/cache/wallpaper-switcher
- 当前实现只支持从上述两个固定目录读取资源,目录路径不通过配置文件改写
本项目使用 MIT License。
完整许可证内容见仓库根目录下的 LICENSE 文件。