forked from Shinonome/dots-hyprland
modified scripts to allow for random wallpapers or positional arguments
This commit is contained in:
@@ -3,31 +3,35 @@
|
|||||||
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||||
CONFIG_DIR="$XDG_CONFIG_HOME/ags"
|
CONFIG_DIR="$XDG_CONFIG_HOME/ags"
|
||||||
|
|
||||||
|
switch() {
|
||||||
|
imgpath=$1
|
||||||
|
screensizey=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2 | head -1)
|
||||||
|
cursorposx=$(hyprctl cursorpos -j | gojq '.x' 2>/dev/null) || cursorposx=960
|
||||||
|
cursorposy=$(hyprctl cursorpos -j | gojq '.y' 2>/dev/null) || cursorposy=540
|
||||||
|
cursorposy_inverted=$((screensizey - cursorposy))
|
||||||
|
|
||||||
|
if [ "$imgpath" == '' ]; then
|
||||||
|
echo 'Aborted'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ags run-js "wallpaper.set('')"
|
||||||
|
# sleep 0.1 && ags run-js "wallpaper.set('${imgpath}')" &
|
||||||
|
swww img "$imgpath" --transition-step 1 --transition-fps 120 \
|
||||||
|
--transition-type grow --transition-angle 30 --transition-duration 1 \
|
||||||
|
--transition-pos "$cursorposx, $cursorposy_inverted"
|
||||||
|
}
|
||||||
|
|
||||||
if [ "$1" == "--noswitch" ]; then
|
if [ "$1" == "--noswitch" ]; then
|
||||||
imgpath=$(swww query | head -1 | awk -F 'image: ' '{print $2}')
|
imgpath=$(swww query | awk -F 'image: ' '{print $2}')
|
||||||
# imgpath=$(ags run-js 'wallpaper.get(0)')
|
# imgpath=$(ags run-js 'wallpaper.get(0)')
|
||||||
|
elif [[ "$1" ]]; then
|
||||||
|
switch $1
|
||||||
else
|
else
|
||||||
# Select and set image (hyprland)
|
# Select and set image (hyprland)
|
||||||
cd "$(xdg-user-dir PICTURES)"
|
|
||||||
imgpath=$(yad --width 1200 --height 800 --file --title='Choose wallpaper' --add-preview --large-preview)
|
cd "$(xdg-user-dir PICTURES)" || return 1
|
||||||
read scale screenx screeny screensizey < <(hyprctl monitors -j | jq '.[] | select(.focused) | .scale, .x, .y, .height' | xargs)
|
switch $(yad --width 1200 --height 800 --file --add-preview --large-preview --title='Choose wallpaper')
|
||||||
cursorposx=$(hyprctl cursorpos -j | gojq '.x' 2>/dev/null) || cursorposx=960
|
|
||||||
cursorposx=$(bc <<< "scale=0; ($cursorposx - $screenx) * $scale / 1")
|
|
||||||
cursorposy=$(hyprctl cursorpos -j | gojq '.y' 2>/dev/null) || cursorposy=540
|
|
||||||
cursorposy=$(bc <<< "scale=0; ($cursorposy - $screeny) * $scale / 1")
|
|
||||||
cursorposy_inverted=$(( screensizey - cursorposy ))
|
|
||||||
|
|
||||||
if [ "$imgpath" == '' ]; then
|
|
||||||
echo 'Aborted'
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# ags run-js "wallpaper.set('')"
|
|
||||||
# sleep 0.1 && ags run-js "wallpaper.set('${imgpath}')" &
|
|
||||||
swww img "$imgpath" --transition-step 100 --transition-fps 60 \
|
|
||||||
--transition-type grow --transition-angle 30 --transition-duration 1 \
|
|
||||||
--transition-pos "$cursorposx, $cursorposy_inverted"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate colors for ags n stuff
|
# Generate colors for ags n stuff
|
||||||
|
|||||||
@@ -99,4 +99,4 @@ label { # Status
|
|||||||
position = 30, -30
|
position = 30, -30
|
||||||
halign = left
|
halign = left
|
||||||
valign = top
|
valign = top
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user