wallpaper
This commit is contained in:
parent
f9c369c584
commit
36c8d05a0d
4 changed files with 43 additions and 559 deletions
|
|
@ -2,6 +2,7 @@
|
|||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
|
|
@ -10,13 +11,8 @@ let
|
|||
};
|
||||
qs = "${pkgs.quickshell}/bin/qs";
|
||||
wl-paste = "${pkgs.wl-clipboard}/bin/wl-paste";
|
||||
swww = "${pkgs.swww}/bin/swww";
|
||||
swww-daemon = "${pkgs.swww}/bin/swww-daemon";
|
||||
wallpapers = inputs.self.packages.${pkgs.system}.wallpapers;
|
||||
|
||||
# Your assets - adjust paths as needed
|
||||
assetsPath = ./assets;
|
||||
wallpaperDir = "${config.home.homeDirectory}/.config/wallpapers";
|
||||
systemctl = "${pkgs.systemd}/bin/systemctl";
|
||||
in
|
||||
{
|
||||
programs.niri.settings = {
|
||||
|
|
@ -30,9 +26,17 @@ in
|
|||
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
|
||||
SDL_VIDEODRIVER = "wayland";
|
||||
};
|
||||
|
||||
spawn-at-startup = [
|
||||
(makeCommand "${lib.getExe pkgs.hyprlock}")
|
||||
(makeCommand swww-daemon)
|
||||
{
|
||||
command = [
|
||||
"${lib.getExe pkgs.mpvpaper}"
|
||||
"-vs"
|
||||
"-o"
|
||||
"'no-audio loop' ALL ${wallpapers}/share/wallpapers/*.mp4"
|
||||
];
|
||||
}
|
||||
{
|
||||
command = [
|
||||
"${wl-paste}"
|
||||
|
|
@ -57,23 +61,6 @@ in
|
|||
"DankMaterialShell"
|
||||
];
|
||||
}
|
||||
# Set animated wallpaper on startup
|
||||
{
|
||||
command = [
|
||||
"${pkgs.bash}/bin/bash"
|
||||
"-c"
|
||||
''
|
||||
sleep 3
|
||||
while ! ${swww} query &>/dev/null; do
|
||||
sleep 1
|
||||
done
|
||||
${swww} img "${wallpaperDir}/anime-cat-girl-snow.mp4" \
|
||||
--transition-type fade \
|
||||
--transition-duration 2 \
|
||||
--transition-fps 30
|
||||
''
|
||||
];
|
||||
}
|
||||
];
|
||||
input = {
|
||||
touchpad = {
|
||||
|
|
@ -94,6 +81,7 @@ in
|
|||
warp-mouse-to-focus.enable = true;
|
||||
workspace-auto-back-and-forth = true;
|
||||
};
|
||||
|
||||
outputs = {
|
||||
"eDP-1" = {
|
||||
scale = 1.0;
|
||||
|
|
@ -103,6 +91,7 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
overview = {
|
||||
workspace-shadow.enable = false;
|
||||
backdrop-color = "transparent";
|
||||
|
|
@ -130,6 +119,7 @@ in
|
|||
default-column-width = {
|
||||
proportion = 0.5;
|
||||
};
|
||||
|
||||
gaps = 6;
|
||||
struts = {
|
||||
left = 0;
|
||||
|
|
@ -137,6 +127,7 @@ in
|
|||
top = 0;
|
||||
bottom = 0;
|
||||
};
|
||||
|
||||
tab-indicator = {
|
||||
hide-when-single-tab = true;
|
||||
place-within-column = true;
|
||||
|
|
@ -148,136 +139,8 @@ in
|
|||
length.total-proportion = 0.1;
|
||||
};
|
||||
};
|
||||
|
||||
prefer-no-csd = true;
|
||||
hotkey-overlay.skip-at-startup = true;
|
||||
|
||||
# Wallpaper keybindings
|
||||
binds = with config.lib.niri.actions; {
|
||||
# Switch between your wallpapers
|
||||
|
||||
# Interactive wallpaper selection
|
||||
"Mod+Shift+A".action = spawn [
|
||||
"${pkgs.bash}/bin/bash"
|
||||
"-c"
|
||||
''
|
||||
selected=$(find "${wallpaperDir}" -type f \( -name "*.gif" -o -name "*.mp4" -o -name "*.webm" -o -name "*.jpg" -o -name "*.png" \) | ${pkgs.fzf}/bin/fzf --preview='basename {}')
|
||||
if [ -n "$selected" ]; then
|
||||
${swww} img "$selected" \
|
||||
--transition-type fade \
|
||||
--transition-duration 2 \
|
||||
--transition-fps 30
|
||||
fi
|
||||
''
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
swww
|
||||
fzf
|
||||
ffmpeg
|
||||
];
|
||||
|
||||
# Create cache directory for wallpaper state
|
||||
home.file = {
|
||||
# Create wallpaper directory
|
||||
".config/wallpapers/.keep".text = "";
|
||||
|
||||
# Create cache directory for rotation state
|
||||
|
||||
# Initialize wallpaper rotation state (starts at 0, so first rotation goes to index 1)
|
||||
".cache/wallpaper-rotation-state".text = "0";
|
||||
|
||||
# Copy your animated wallpaper
|
||||
".config/wallpapers/anime-cat-girl-snow.mp4" = {
|
||||
source = "${assetsPath}/Anime Live Wallpaper - Anime Cat Girl Snow - HD - no copyright [SiMc3l0ido0].mp4";
|
||||
};
|
||||
|
||||
# Copy your static wallpaper
|
||||
".config/wallpapers/static-wallpaper.jpg" = {
|
||||
source = "${assetsPath}/wp6553608.jpg";
|
||||
};
|
||||
|
||||
# Create optimized version of the MP4 using a script
|
||||
".config/wallpapers/anime-cat-girl-snow-optimized.mp4" = {
|
||||
source =
|
||||
pkgs.runCommand "optimized-wallpaper"
|
||||
{
|
||||
buildInputs = [ pkgs.ffmpeg ];
|
||||
}
|
||||
''
|
||||
${pkgs.ffmpeg}/bin/ffmpeg -i "${assetsPath}/Anime Live Wallpaper - Anime Cat Girl Snow - HD - no copyright [SiMc3l0ido0].mp4" \
|
||||
-vf "scale=1920:1080:force_original_aspect_ratio=increase,crop=1920:1080" \
|
||||
-r 30 -c:v libx264 -crf 28 -preset medium \
|
||||
-t 30 -an "$out"
|
||||
'';
|
||||
};
|
||||
|
||||
# SWWW configuration
|
||||
".config/swww/config".text = ''
|
||||
resize=crop
|
||||
fill_color=000000
|
||||
filter=Lanczos3
|
||||
'';
|
||||
};
|
||||
|
||||
# Wallpaper rotation service
|
||||
systemd.user.services.wallpaper-rotation = {
|
||||
Unit = {
|
||||
Description = "Rotate between wallpapers";
|
||||
After = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.writeShellScript "rotate-wallpaper" ''
|
||||
wallpapers=(
|
||||
"${wallpaperDir}/anime-cat-girl-snow.mp4"
|
||||
"${wallpaperDir}/anime-cat-girl-snow-optimized.mp4"
|
||||
"${wallpaperDir}/static-wallpaper.jpg"
|
||||
)
|
||||
|
||||
# Wait for swww to be available
|
||||
while ! ${swww} query &>/dev/null; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Get random wallpaper
|
||||
random_wallpaper="''${wallpapers[$RANDOM % ''${#wallpapers[@]}]}"
|
||||
|
||||
${swww} img "$random_wallpaper" \
|
||||
--transition-type random \
|
||||
--transition-duration 3 \
|
||||
--transition-fps 30
|
||||
''}";
|
||||
};
|
||||
};
|
||||
|
||||
# Optional: Timer for automatic wallpaper rotation
|
||||
systemd.user.timers.wallpaper-rotation = {
|
||||
Unit = {
|
||||
Description = "Timer for wallpaper rotation";
|
||||
};
|
||||
|
||||
Timer = {
|
||||
OnBootSec = "10min";
|
||||
OnUnitActiveSec = "10min";
|
||||
Unit = "wallpaper-rotation.service";
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ "timers.target" ];
|
||||
};
|
||||
};
|
||||
|
||||
# Shell aliases
|
||||
programs.bash.shellAliases = {
|
||||
wallpaper = "${swww} img";
|
||||
wallpaper-anime = "${swww} img ${wallpaperDir}/anime-cat-girl-snow.mp4 --transition-type fade --transition-fps 30";
|
||||
wallpaper-static = "${swww} img ${wallpaperDir}/static-wallpaper.jpg --transition-type fade";
|
||||
wallpaper-optimized = "${swww} img ${wallpaperDir}/anime-cat-girl-snow-optimized.mp4 --transition-type fade --transition-fps 30";
|
||||
wallpaper-rotate = "${systemctl} --user start wallpaper-rotation.service";
|
||||
wallpaper-auto-start = "${systemctl} --user start wallpaper-rotation.timer";
|
||||
wallpaper-auto-stop = "${systemctl} --user stop wallpaper-rotation.timer";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue