move hyprland-related scripts

This commit is contained in:
andrzej 2024-10-16 12:24:58 +02:00
parent 7cb2f9cea3
commit 9171212406
5 changed files with 113 additions and 3 deletions

View File

@ -0,0 +1 @@
2854

View File

@ -0,0 +1,61 @@
#!/usr/bin/env bash
##set working directory to location of this script
cd "$(dirname "$0")"
PIDFILE=bg_slideshow.pid
remove_pidfile()
{
rm -f "$PIDFILE"
}
if [ -f "$PIDFILE" ]; then
kill -9 "$(cat $PIDFILE)"
fi
if [[ ${1} == kill ]]; then
echo "killing myslef, byeeee"
exit
fi
echo $$ > "$PIDFILE"
bgsDirectory="/home/andrzej/bgs/"
path=${1}
duration=${2}
echo "path: ${path}, duration: ${duration}"
#ARGS $1:directory e.g. chsck
chooseRandom(){
shopt -s nullglob
files=("${bgsDirectory}${1}/"*)
length=$((${#files[@]}))
echo "length: ${length}"
randomIndex=$(($RANDOM % $length))
echo "random index: ${randomIndex}"
##re-roll if the result is a directory
while [[ -d ${files[$randomIndex]} ]]
do
echo "${files[randomIndex]} is a directory!"
randomIndex=$(($RANDOM % $length))
done
image="${files[$randomIndex]}"
echo ${image}
}
while true; do
chooseRandom ${path}
hyprctl hyprpaper preload "${image}"
hyprctl hyprpaper wallpaper ",contain:${image}"
sleep $duration
hyprpaper unload all
done

View File

@ -0,0 +1,48 @@
bgsDirectory="${HOME}/bgs/"
##set working directory to location of this script
cd "$(dirname "$0")"
##stop slideshow if running
sh ./hyprland-slideshow.sh kill
preloadImage(){
hyprctl hyprpaper preload "${image}"
}
setImage() {
hyprctl hyprpaper wallpaper ",contain:${image}"
}
#ARGS $1:directory e.g. chsck
chooseRandom(){
shopt -s nullglob
files=("${bgsDirectory}${1}/"*)
length=$((${#files[@]}))
echo "length: ${length}"
randomIndex=$(($RANDOM % $length))
echo "random index: ${randomIndex}"
##re-roll if the result is a directory
while [[ -d ${files[$randomIndex]} ]]
do
echo "${files[randomIndex]} is a directory!"
randomIndex=$(($RANDOM % $length))
done
image="${files[$randomIndex]}"
echo ${image}
}
if [ $# -eq 0 ]; then
image="${bgsDirectory}default.jpg"
preloadImage image
setImage image
else
chooseRandom ${1}
preloadImage
setImage
fi
sleep 1
hyprctl hyprpaper unload all

View File

@ -187,8 +187,8 @@ bind = $mainMod, k, movefocus, u
bind = $mainMod, j, movefocus, d
#background bg switcheroo
bind = $mainMod SHIFT, W, exec, /home/andrzej/scripts/hyprland-switch-bg.sh chsck
bind = $mainMod , W, exec, /home/andrzej/scripts/hyprland-switch-bg.sh
bind = $mainMod SHIFT, W, exec, $HOME/.config/hypr/bg-scripts/hyprland-switch-bg.sh chsck
bind = $mainMod , W, exec, $HOME/.config/hypr/bg-scripts/hyprland-switch-bg.sh
# Switch workspaces with mainMod + [0-9]
bind = $mainMod, 1, workspace, 1

View File

@ -1,7 +1,7 @@
alias update="apt update && apt upgrade -y"
alias tidal="/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=com.mastermindzh.tidal-hifi com.mastermindzh.tidal-hifi &"
alias devsesh="$HOME/scripts/tmux-dev-session.sh"
alias slides="nohup ${HOME}/scripts/hyprland-slideshow.sh"
alias slides="nohup ${HOME}/.config/hypr/bg-scripts/hyprland-slideshow.sh"
alias ls="ls --color=auto"
export SUDO_EDITOR="nvim"