From 4e1c6955e95e890817fb5e6150eac81f9c587f1a Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Wed, 1 Jan 2025 14:10:55 +0300 Subject: [PATCH] Swayscript: Add mpvpaper reload support. --- config/Wallpaper.nix | 13 +++++++++++++ home/file/sway/default.nix | 4 ++-- package/swayscript/script/Reload.sh | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 config/Wallpaper.nix diff --git a/config/Wallpaper.nix b/config/Wallpaper.nix new file mode 100644 index 0000000..e4e3b2c --- /dev/null +++ b/config/Wallpaper.nix @@ -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} + '') + ]; + }) + ]; +} diff --git a/home/file/sway/default.nix b/home/file/sway/default.nix index 0428c1f..7c090c9 100644 --- a/home/file/sway/default.nix +++ b/home/file/sway/default.nix @@ -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; } diff --git a/package/swayscript/script/Reload.sh b/package/swayscript/script/Reload.sh index 8b2420d..2b952e0 100644 --- a/package/swayscript/script/Reload.sh +++ b/package/swayscript/script/Reload.sh @@ -4,6 +4,8 @@ function reload() { re() { # Sway. swaymsg reload + pkill mpvpaper + mpvpaper-sway # Waybar. pkill waybar