awww -> awww + swaybg

顺便修修readme:减少md代码块以应对ly gitea黑色主题的蜜汁渲染
This commit is contained in:
2026-04-02 02:55:48 +08:00
parent bd658f9101
commit 2dbf833d80
4 changed files with 59 additions and 38 deletions

View File

@@ -2,7 +2,7 @@
transition: 1000ms ease ; transition: 1000ms ease ;
} }
window { window {
background-image: url("/home/agxcoy/.local/share/.wallpaper_blur"); background-image: url("/home/agxcoy/.cache/wallpaper_blur");
background-size: cover; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;

View File

@@ -126,7 +126,7 @@ overview {
} }
layer-rule { layer-rule {
match namespace="^swww-daemonblur$" match namespace="^wallpaper$"
place-within-backdrop true place-within-backdrop true
} }
@@ -181,8 +181,8 @@ include "config-keyboard.kdl"
// spawn-at-startup "waybar" // 建议交给 systemctl --user它自己没法热重载。 // spawn-at-startup "waybar" // 建议交给 systemctl --user它自己没法热重载。
// spawn-sh-at-startup "wl-paste --watch cliphist store" // spawn-sh-at-startup "wl-paste --watch cliphist store"
spawn-at-startup "swww-daemon" spawn-at-startup "awww-daemon"
spawn-at-startup "swww-daemon" "--namespace" "blur" // spawn-at-startup "awww-daemon" "--namespace" "blur"
spawn-at-startup "xwayland-satellite" spawn-at-startup "xwayland-satellite"
spawn-at-startup "/usr/lib/pam_kwallet_init" spawn-at-startup "/usr/lib/pam_kwallet_init"

View File

@@ -3,7 +3,11 @@ set -euo pipefail
THIS_COMMAND=$(basename "$0") THIS_COMMAND=$(basename "$0")
IMG_MAGICK="magick" IMG_MAGICK="magick"
WP_DIR="${XDG_DATA_HOME:-$HOME/.local/share}" SERVICE_NAME="swaybg.service"
WP_DIR="${XDG_CACHE_HOME:-$HOME/.cache}"
WP_FILE="$WP_DIR/wallpaper"
BLUR_WP="$WP_DIR/wallpaper_blur"
usage() { usage() {
cat << EOF cat << EOF
@@ -12,7 +16,7 @@ Options:
-d, --dir OUTPUT_PATH Directory to store chosen image. (default: $WP_DIR) -d, --dir OUTPUT_PATH Directory to store chosen image. (default: $WP_DIR)
-h, --help Show this help message and exit. -h, --help Show this help message and exit.
Notes: Notes:
- Images can be provided as arguments or via stdin. If both are used, they are combined. - This script needs 'swaybg.service' to be set up for overview background support (unless awww #521 solved). See niri documentation for details.
- Web URLs are also supported (via 'curl' or 'wget' downloading). - Web URLs are also supported (via 'curl' or 'wget' downloading).
- If multiple images are provided, one will be randomly picked each time the script is executed. - If multiple images are provided, one will be randomly picked each time the script is executed.
EOF EOF
@@ -36,8 +40,8 @@ while [[ $# -gt 0 ]]; do
esac esac
done done
if ! command -v swww >/dev/null 2>&1; then if ! command -v awww >/dev/null 2>&1; then
echo "!) 'swww' command not found. Unable to comply." >&2 echo "x) 'awww' not found. Unable to comply." >&2
exit 2 exit 2
fi fi
@@ -46,7 +50,7 @@ if command -v magick >/dev/null 2>&1; then
elif command -v convert >/dev/null 2>&1; then elif command -v convert >/dev/null 2>&1; then
IMG_MAGICK="convert" IMG_MAGICK="convert"
else else
echo "!) 'magick' or 'convert' command not found. Image processing unavailable." >&2 echo "x) 'magick' or 'convert' not found. Image processing unavailable." >&2
exit 2 exit 2
fi fi
@@ -70,13 +74,21 @@ set_wallpaper() {
} }
echo -n " -> making blurred version of '${1##*/}' ... " echo -n " -> making blurred version of '${1##*/}' ... "
cp $finput $WP_DIR/.wallpaper cp "$finput" "$WP_FILE"
$IMG_MAGICK $WP_DIR/.wallpaper -filter Gaussian -blur 0x30 $WP_DIR/.wallpaper_blur $IMG_MAGICK "$WP_FILE" -filter Gaussian -blur 0x30 "$BLUR_WP"
echo "Done." echo "Done."
# 原工具现在更名为 awww但留下了 bughttps://codeberg.org/LGFae/awww/issues/521 awww img "$WP_FILE" --transition-type=random
swww img $WP_DIR/.wallpaper
swww img $WP_DIR/.wallpaper_blur --namespace blur if [[ -f "$HOME/.config/systemd/user/niri.service.wants/$SERVICE_NAME" ]]; then
echo " -> restarting $SERVICE_NAME ..."
systemctl --user restart "$SERVICE_NAME"
else
echo " !) '$SERVICE_NAME' didn't loaded by niri. Won't reload backdrop." >&2
echo " => See niri documentation for setting up swaybg systemd unit." >&2
echo " => Or wait for awww #521 on codeberg being resolved." >&2
exit 1
fi
} }
imagepool=() imagepool=()
@@ -132,7 +144,7 @@ if command -v curl >/dev/null 2>&1; then
elif command -v wget >/dev/null 2>&1; then elif command -v wget >/dev/null 2>&1; then
wget -qO "$tmpfile" "$randomimage" wget -qO "$tmpfile" "$randomimage"
else else
echo "!) Unable to fetch image without 'curl' or 'wget'." >&2 echo "x) Unable to fetch image without 'curl' or 'wget'." >&2
exit 2 exit 2
fi fi
set_wallpaper "$tmpfile" set_wallpaper "$tmpfile"

View File

@@ -3,38 +3,47 @@
都怪雪叶!( 都怪雪叶!(
> [!note] > [!note]
> 1. Liteyuki Gitea 黑色主题对`这样的`代码块不太友好,为方便阅读我尽量少这么写。
> 1. 本仓库的配置管理方案比较原始:逐个做软链接处理。 > 1. 本仓库的配置管理方案比较原始:逐个做软链接处理。
> 个人并不打算无脑用`stow`,尤其不希望一些 systemd 服务和涉及 token 的自用小工具混进来。 > 个人并不打算无脑用 stow ,尤其不希望一些 systemd 服务和涉及 token 的自用小工具混进来。
> 2. 还有一些早期配置在整理本仓库时已经淡忘,由于篇幅和复述可靠性有限,亦不考虑收纳。 > 2. 还有一些早期配置在整理本仓库时已经淡忘,由于篇幅和复述可靠性有限,亦不考虑收纳。
> 3. 涉及`$HOME`、`~`、`%h`开头(最后一个多见于 systemd 服务)的路径建议自行适配——我的设定你不一定会满意。 > 3. 涉及家目录`$HOME`、`~`、`%h`开头(最后一个多见于 systemd 服务)的路径建议自行适配——我的设定你不一定会满意。
> - 另注gtklock 没有办法取巧,只能填绝对路径。算是为数不多的漏网之鱼。 > - 另注gtklock 没有办法取巧,只能填绝对路径。算是为数不多的漏网之鱼。
## 鸣谢 ## 鸣谢
- 雪叶 [@Vescrity](https://github.com/Vescrity) (Yukitoha) - 雪叶 [@Vescrity](https://github.com/Vescrity) (Yukitoha)
- fizzyizzy05 (Isabelle Jackson, mtf) - fizzyizzy05 (Isabelle Jackson)
## 已知依赖 ## 已知依赖
> 仅列出**想得起来的**依赖软件包。 > 仅列出**想得起来的**依赖软件包。
|依赖|配置|备注| |依赖|配置|
|-|-|-| |-|-|
|niri|`.config/niri/config*.kdl`|只拆分了`window-rule``binds`,拆太碎有些视觉效果会失效。| |niri|.config/niri/config*.kdl|
|`fuzzel`|`.config/fuzzel/*`| |➡️ fuzzel|.config/fuzzel/*|
|`mako`|`.config/mako/*`|Chrome 的消息推送都是无脑标 CRITICAL 级,没有办法调持续时间,量一多还会卡在那里,只能`makoctl reload`强制重载。| |➡️ mako|.config/mako/*|
|`swww-git`|`bin/chbg` (bash 脚本)|依赖`imagemagick`。另,可以配合图床等实现定期换壁纸。| |➡️ awww 和 swaybg|bin/chbg (bash 脚本)swaybg.service|
|`gtklock`|`.config/gtklock/*`|现阶段无法跟`swayidle`合用,尽管其 Wiki 鼓励这么做。| |➡️ gtklock|.config/gtklock/*|
|`xdg-desktop-portal-(gtk\|gnome)`|`.config/xdg-desktop-portal/*-portals.conf`|GNOME 支持最全,但称不上好看(| |➡️ xdg-desktop-portal-(gtk\|gnome)|.config/xdg-desktop-portal/*-portals.conf|
|`kwallet`|VSCode 试图登录时会弹出向导让你配的。|替代`gnome-keyring`。建议加装`kwallet-pam`,免得 VSCode 自己尝试解锁结果闪退。| |➡️ kwallet|VSCode 试图登录时会弹出向导让你配的。|
|foot|`.config/foot/foot.ini`| |foot|.config/foot/foot.ini|
|`zsh`|`.zshrc` `.zprofile`|另使用了 ZshIM 和 powerlevel10k 主题,因此有些配置(如`HISTFILE`)不得不相应地提前。| |➡️ zsh|.zshrc .zprofile|
|yazi|`.config/yazi/*`|替代`nautilus`。另用`fake-nautilus`移除`nautilus`包。| |yazi|.config/yazi/*|
|fastfetch|`.config/fastfetch/*`| |fastfetch|.config/fastfetch/*|
|waybar|`.config/waybar/*`|建议搭配`systemctl --user`(参见 [niri 在线文档](https://yalter.github.io/niri/Example-systemd-Setup.html))以便重载配置。| |waybar|.config/waybar/*|
|`mpris`||`systemctl --user`配置自启动(参见 ArchWiki| |➡️ mpris|`systemctl --user`配置自启动(参见 ArchWiki|
|`pavucontrol-qt`| |➡️ pavucontrol-qt|
> > 备注(太长了统一丢在下面)
> - swww 现更名为 awww但其读取缓存时存在问题——参见 [codeberg issue](https://codeberg.org/LGFae/awww/issues/521)。目前推荐用 swww-git因为实在找不到更好的双层组合方案了 > - niri 配置只拆分了 window-rule 和 binds即`config-*.kdl拆太碎有些视觉效果会失效
> - Chrome 的消息推送都是无脑标 CRITICAL 级,没有办法调持续时间,量一多还会卡在那里,只能`makoctl reload`强制重载。
> - chbg 依赖 imagemagick。awww 目前对多个命名空间的加载有问题:[\#521](https://codeberg.org/LGFae/awww/issues/521)。经各种方案的实地测试,最终还是考虑 swaybg 服务 + awww 混合。
> - gtklock 自身无法挂多个后台(即只能有一个`gtklock -d`,多了会报错),虽然也算侧面实现了单例,但搭配 swayidle 和 swaylock 可能不算好用。我是只在休眠快捷键里简单做了下 pgrep 检查。
> - niri 设计上就是用 gnome 作 xdg 后端,也就它支持最全。但 gnome 界面算不上好看,所以也有一些人考虑局部更换为 gtk 或 kde。像我就用 kwallet 替代 gnome-keyring。
> - 装 kwallet 建议加装 kwallet-pam免得 VSCode 自己尝试解锁结果闪退。
> - 有关终端:我另使用了 ZshIM 和 powerlevel10k 主题,因此会掺入自动生成的初始化命令。
> - 有关 fake-nautilus我是觉得 nautilus 不好看。在雪叶的指导下搞了个空包替代这个 gnome 后端必需的依赖。
> - waybar和 swaybg重载建议搭配`systemctl --user`(参见 [niri 在线文档](https://yalter.github.io/niri/Example-systemd-Setup.html))以便重载配置。若是用 niri 的 spawn-at-startup杀进程重启、挂后台可谓相当麻烦。
## 参考资源与备注 ## 参考资源与备注
- Nerd 字体:[Monaco Nerd Font Mono](https://glowmem.com/upload/articles/archlinux-note/Monaco_Nerd_Font_Mono-Regular.ttf) (MelodyEcho ver.) 或直接 [MesloLGS NF](https://github.com/romkatv/powerlevel10k/blob/master/font.md) (for p10k)。 - Nerd 字体:[Monaco Nerd Font Mono](https://glowmem.com/upload/articles/archlinux-note/Monaco_Nerd_Font_Mono-Regular.ttf) (MelodyEcho ver.) 或直接 [MesloLGS NF](https://github.com/romkatv/powerlevel10k/blob/master/font.md) (for p10k)。