Sway: Add wallpaper-video toggle.

This commit is contained in:
Dmitry Voronin 2025-01-01 18:22:32 +03:00
parent 894ae96b5e
commit 03fb7207c8
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
3 changed files with 17 additions and 11 deletions

View file

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

View file

@ -1,4 +1,6 @@
output * bg @wallpaper@ fill output * bg @wallpaper@ fill
bindsym --to-code $mod+z exec swayscript wallpaper_video
client.focused "#@accent@" "#@accent@" "#@fg@" "#@accent@" "#@accent@" client.focused "#@accent@" "#@accent@" "#@fg@" "#@accent@" "#@accent@"
client.focused_inactive "#@border@" "#@border@" "#@fg@" "#@border@" "#@border@" client.focused_inactive "#@border@" "#@border@" "#@fg@" "#@border@" "#@border@"
client.unfocused "#@border@" "#@border@" "#@fg@" "#@border@" "#@border@" client.unfocused "#@border@" "#@border@" "#@fg@" "#@border@" "#@border@"

View file

@ -0,0 +1,4 @@
# Toggle video wallpaper.
function wallpaper_video() {
pkill mpvpaper || wallpaper-video
}