Fix hyprland background
This commit is contained in:
parent
c6cae00eba
commit
02d9349a03
3 changed files with 24 additions and 29 deletions
|
|
@ -1,29 +1,19 @@
|
|||
{ findutils
|
||||
, coreutils
|
||||
, writeShellScriptBin
|
||||
{ coreutils
|
||||
, findutils
|
||||
, hyprland
|
||||
, lib
|
||||
, writeShellScriptBin
|
||||
, backgrounds_directory ? "$HOME/Immagini/Sfondi/"
|
||||
}: writeShellScriptBin "wl-update-background"
|
||||
}: writeShellScriptBin "wl-update-background" ''
|
||||
set -euo pipefail
|
||||
PATH=$PATH:${lib.makeBinPath [findutils coreutils hyprland]}
|
||||
WALLPAPER_DIR=${backgrounds_directory}
|
||||
CURRENT_WALL=$(hyprctl hyprpaper listloaded)
|
||||
CURRENT_WALL=$(basename "$CURRENT_WALL")
|
||||
|
||||
# ''
|
||||
# set -e
|
||||
# if [ $# -eq 0 ]; then
|
||||
# image=`${findutils}/bin/find ${backgrounds_directory} -type f | ${gnugrep}/bin/grep -v "/\." | ${coreutils}/bin/shuf -n 1`
|
||||
# else
|
||||
# image="$1"
|
||||
# fi
|
||||
# echo "image: $image"
|
||||
# ${swww}/bin/swww img "$image"
|
||||
# ''
|
||||
# Get a random wallpaper that is not the current one
|
||||
NEW_WALLPAPER=$(find "$WALLPAPER_DIR" -type f ! -name "$CURRENT_WALL" | shuf -n 1)
|
||||
|
||||
''
|
||||
set -euo pipefail
|
||||
WALLPAPER_DIR=${backgrounds_directory}
|
||||
CURRENT_WALL=$(hyprctl hyprpaper listloaded)
|
||||
|
||||
# Get a random wallpaper that is not the current one
|
||||
WALLPAPER=$(${findutils}/bin/find "$WALLPAPER_DIR" -type f ! -name "$(${coreutils}/bin/basename "$CURRENT_WALL")" | ${coreutils}/bin/shuf -n 1)
|
||||
|
||||
# Apply the selected wallpaper
|
||||
${hyprland}/bin/hyprctl hyprpaper reload ,"$WALLPAPER"
|
||||
''
|
||||
# Apply the selected wallpaper
|
||||
hyprctl hyprpaper reload ,"$NEW_WALLPAPER"
|
||||
''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue