-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DISCUSSION] Best way to change wallpaper with hyprpaper? #108
Comments
|
It seem easy, but, if you want to use Buy thank you!! |
you can make two calls, one for preload and one for wallpaper |
Hi again, sorry for the delay. Still didnt make it work with hyperctl. So just as example: Trying you way will be: hyprctl hyprpaper preload "~/wallpapers/wallpaper-1"
hyprctl hyprpaper monitor ",~/wallpapers/wallpaper-1" For me this didnt work. Error: File not found, could be because of sufix ? Thanks for the help |
what if you specify the monitor explicitly in |
Sorry it was a mistake: writting the post:
But, is not working for me. Thanks again. |
Or for those of us using hyprpaper with another compositor: Unfortunately, only one user is permitted at a time that way. It should go to /tmp/hypr-${USER} instead. |
(for me, at least) it does work when specifying the |
Just created a bash script which randomly changes background image. #!/bin/bash
directory=~/YOUR_BACKGROUND/IMAGE/DIRECTORY
monitor=`hyprctl monitors | grep Monitor | awk '{print $2}'`
if [ -d "$directory" ]; then
random_background=$(ls $directory/*.jpg | shuf -n 1)
hyprctl hyprpaper unload all
hyprctl hyprpaper preload $random_background
hyprctl hyprpaper wallpaper "$monitor, $random_background"
fi |
Took your idea with a lil inspiration from ZaneyOS and made a script that changes the wallpaper for all monitors every 15m. It's for a Nix config but one can easily make it a normal script if necessary. { pkgs, username, wallpaperDir, wallpaperGit }:
pkgs.writeShellScriptBin "wallpaper" ''
monitor=(`hyprctl monitors | grep Monitor | awk '{print $2}'`)
wal=$(find ${wallpaperDir} -name '*' | awk '!/.git/' | tail -n +2 | shuf -n 1)
cache=""
if [ -d ${wallpaperDir} ]; then
cd ${wallpaperDir}
git pull
else
${pkgs.git}/bin/git clone ${wallpaperGit} ${wallpaperDir}
chown -R ${username}:users ${wallpaperDir}
fi
while true; do
if [[ $cache == $wal ]]; then
wal=$(find ${wallpaperDir} -name '*' | awk '!/.git/' | tail -n +2 | shuf -n 1)
else
cache=$wal
hyprctl hyprpaper unload all
hyprctl hyprpaper preload $wal
for m in ''${monitor[@]}; do
hyprctl hyprpaper wallpaper "$m,$wal"
done
fi
sleep 900
done
'' |
Nice work!! |
Here is the bash script I use to change the wallpaper on all my monitors. #!/bin/bash
# Check if a file argument was provided
if [ -z "$1" ]; then
echo "Error: Please provide a wallpaper file as an argument."
exit 1
fi
# Check if the file exists
if [ ! -f "$1" ]; then
echo "Error: File not found: $1"
exit 1
fi
# Path to your hyprpaper configuration file
hyprpaper_config_file="$HOME/.config/hypr/hyprpaper.conf"
# Update the config file with the new wallpaper path
sed -i -e "s|^preload = .*$|preload = $1|" \
-e "s|^wallpaper = .*$|wallpaper = ,$1|" \
"$hyprpaper_config_file"
# Reload hyprpaper
killall -e hyprpaper &
sleep 1;
hyprpaper &
# Let the user know it's done
echo "Wallpaper settings in hyprpaper.conf updated successfully." usage: |
I created a home-manager module that sets up {
pkgs,
lib,
...
}:
with lib;
with builtins; let
theme = {
name = "catppuccin-mocha"; # Run `nix-shell -p lutgen --command 'lutgen apply -p ""` to see supported color palettes
wallpapers = ./some/local/directory/of/images;
};
themedWallpaper = wallpaper:
pkgs.stdenv.mkDerivation rec {
name = "${theme.name}-${baseNameOf wallpaper}";
nativeBuildInputs = [pkgs.lutgen];
phases = ["buildPhase" "installPhase"];
buildPhase = ''
cp ${wallpaper} ./${name}
lutgen apply -p ${theme.name} ${name} -o themed
'';
installPhase = ''
cp themed/${name} $out
'';
};
wallpapers = filesystem.listFilesRecursive theme.wallpapers;
themedWallpapers = listToAttrs (map (wallpaper: {
name = "${baseNameOf wallpaper}";
value = themedWallpaper wallpaper;
})
wallpapers);
wallpaperBashArray = "(\"${strings.concatStrings (strings.intersperse "\" \"" (map (wallpaper: "${wallpaper}") (attrValues themedWallpapers)))}\")";
wallpaperRandomizer = pkgs.writeShellScriptBin "wallpaperRandomizer" ''
wallpapers=${wallpaperBashArray}
rand=$[$RANDOM % ''${#wallpapers[@]}]
wallpaper=''${wallpapers[$rand]}
monitor=(`hyprctl monitors | grep Monitor | awk '{print $2}'`)
hyprctl hyprpaper unload all
hyprctl hyprpaper preload $wallpaper
for m in ''${monitor[@]}; do
hyprctl hyprpaper wallpaper "$m,$wallpaper"
done
'';
in {
home.packages = [wallpaperRandomizer];
services.hyprpaper = {
enable = true;
settings = {
ipc = "on";
splash = false;
splash_offset = 2.0;
};
};
systemd.user = {
services.wallpaperRandomizer = {
Install = {WantedBy = ["graphical-session.target"];};
Unit = {
Description = "Set random desktop background using hyprpaper";
After = ["graphical-session-pre.target"];
PartOf = ["graphical-session.target"];
};
Service = {
Type = "oneshot";
ExecStart = "${wallpaperRandomizer}/bin/wallpaperRandomizer";
IOSchedulingClass = "idle";
};
};
timers.wallpaperRandomizer = {
Unit = {Description = "Set random desktop background using hyprpaper on an interval";};
Timer = {OnUnitActiveSec = "1h";};
Install = {WantedBy = ["timers.target"];};
};
};
} You can also manually trigger it by running |
Here is a version without {
pkgs,
lib,
...
}:
with lib; let
theme = {
name = "catppuccin-mocha"; # Run `nix-shell -p lutgen --command 'lutgen apply -p ""` to see supported color palettes
wallpapers = ./some/local/directory/of/images;
};
wallpapers = filesystem.listFilesRecursive theme.wallpapers;
wallpaperBashArray = "(\"${strings.concatStrings (strings.intersperse "\" \"" (map (wallpaper: "${wallpaper}") wallpapers))}\")";
wallpaperRandomizer = pkgs.writeShellScriptBin "wallpaperRandomizer" ''
wallpapers=${wallpaperBashArray}
rand=$[$RANDOM % ''${#wallpapers[@]}]
wallpaper=''${wallpapers[$rand]}
monitor=(`hyprctl monitors | grep Monitor | awk '{print $2}'`)
hyprctl hyprpaper unload all
hyprctl hyprpaper preload $wallpaper
for m in ''${monitor[@]}; do
hyprctl hyprpaper wallpaper "$m,$wallpaper"
done
'';
in {
home.packages = [wallpaperRandomizer];
services.hyprpaper = {
enable = true;
settings = {
ipc = "on";
splash = false;
splash_offset = 2.0;
};
};
systemd.user = {
services.wallpaperRandomizer = {
Install = {WantedBy = ["graphical-session.target"];};
Unit = {
Description = "Set random desktop background using hyprpaper";
After = ["graphical-session-pre.target"];
PartOf = ["graphical-session.target"];
};
Service = {
Type = "oneshot";
ExecStart = "${wallpaperRandomizer}/bin/wallpaperRandomizer";
IOSchedulingClass = "idle";
};
};
timers.wallpaperRandomizer = {
Unit = {Description = "Set random desktop background using hyprpaper on an interval";};
Timer = {OnUnitActiveSec = "1h";};
Install = {WantedBy = ["timers.target"];};
};
};
} |
Hi all, Came up a similar version of the script with some modifications to make sure that my wallpaper orientation would match the orientation of the screen
That's all and good. However, if I try to use my user crontab (instead of looping and sleeping), I have got the following message:
Any idea why? |
Hello all, Thoughts on pyprpaper? It's a python script that randomly change wallpapers from a given directory or directories. I use the For now the script randomly choose the wallpapers. If you have any other implementations to add, I would love to add them. My current setup: The
I have a
|
Hello, I updated pyprpaper to include a --timer option, then we will be able to change the wallpaper each n seconds. Now there is no need to use cron jobs or systemd timer. |
Hello everyone, I use this simple script to slideshow my hyprpapers but after a while is becomes plain color instead of rendering images #!/bin/bash
interval=300
walldir=~/.local/share/wallpapers/
monitor=`hyprctl monitors | grep Monitor | awk '{print $2}'`
while true; do
find $walldir -type f | shuf | while read -r img; do
wal --cols16 -n -i $img -p theme
ln -f "$img" ~/.local/share/wallpapers/background
hyprctl hyprpaper unload all
hyprctl hyprpaper preload $img
hyprctl hyprpaper wallpaper "$monitor, $img"
sleep $interval
done
done I think it might have something to do with cache but im still yet to find out |
I took a look a round and realized that hyprpaper wasn't even running so the problem was probably because an unsupported wallpaper image format was used but i'm yet to check the logs |
Hello everyone, I'm opening this topic to discuss what is the best way to change wallpaper in hyprpaper:
This is how I do it right now, basically reset the hyprpaper.conf file and then overwrite it with the new info. is this the best way to change the wallpaper?
TL;DR
Basically i use this to change wallpaper with hyprper and i use it in 3 different scripts, which are:
With the
set-wallpaper.sh
script I have made a setting in Thunar, which allows me to set an image as wallpaper by right clicking.The text was updated successfully, but these errors were encountered: