Swayscript: Add mpvpaper reload support.

This commit is contained in:
Dmitry Voronin 2025-01-01 14:10:55 +03:00
parent 6df3fc101f
commit 4e1c6955e9
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
3 changed files with 17 additions and 2 deletions

13
config/Wallpaper.nix Normal file
View file

@ -0,0 +1,13 @@
{ config, lib, pkgs, ... }: let
cfg = config.module.wallpaper;
in {
config = lib.mkMerge [
(lib.mkIf cfg.video {
environment.systemPackages = [
(pkgs.writeShellScriptBin "mpvpaper-sway" ''
mpvpaper -o 'no-audio --loop-file --panscan=1' '*' ${cfg.videoPath}
'')
];
})
];
}

View file

@ -246,6 +246,6 @@ in
include /etc/sway/config.d/*
''
+ builtins.readFile swayRc
+ lib.concatStringsSep "\n" config.module.sway.extraConfig
+ lib.optionalString config.module.wallpaper.video "\nexec mpvpaper -o 'no-audio --loop-file --panscan=1' '*' ${config.module.wallpaper.videoPath}";
+ lib.optionalString config.module.wallpaper.video "\nexec mpvpaper-sway"
+ lib.concatStringsSep "\n" config.module.sway.extraConfig;
}

View file

@ -4,6 +4,8 @@ function reload() {
re() {
# Sway.
swaymsg reload
pkill mpvpaper
mpvpaper-sway
# Waybar.
pkill waybar