dotfiles/bin/wallpaper.sh

30 lines
645 B
Bash
Executable File

#!/bin/bash
wallpapers_dir=~/.local/share/wallpapers
finder="fzf --preview='feh {}'"
cd "$wallpapers_dir"
if [ -n "$TMUX" ] ; then
#finder="fzf-tmux -p --preview='pistol {}'"
finder="fzf-tmux -p"
fi
# fzf selector
if [ "$1" == '-s' ] ; then
# follows links and omits the env file
selection=$(find -L -type f -printf '%P\n' | $finder)
if [ -n "$selection" ] ; then
# didnt exit
feh --bg-scale "$selection"
fi
fi
# feh slideshow selector
if [ "$1" == '-p' ] ; then
# follows links and omits the env file
# find -L -type f -printf '%P\n' | feh -A "echo '%f';"
echo "BROKEN">&2
exit 1
fi