diff --git a/scripts/.local/share/scripts/earth-view-wallpaper b/scripts/.local/share/scripts/earth-view-wallpaper new file mode 100755 index 0000000..9cfaf30 --- /dev/null +++ b/scripts/.local/share/scripts/earth-view-wallpaper @@ -0,0 +1,16 @@ +#!/bin/sh + +IMAGE_URL="https://earthview.withgoogle.com/download" +ID_FILE="${HOME}/Documents/Misc/earthview-ids" +MAX_ID="$(wc -l <"${ID_FILE}")" +OUTPUT_FILE=/tmp/earthview-wallpaper.jpg + +get_random_id() { + RANDOM_ID="$(shuf -n 1 -i 1-"${MAX_ID}")" + ID="$(sed -n "${RANDOM_ID}p" "$ID_FILE")" +} + +set -e +get_random_id +curl -fLs "${IMAGE_URL}/${ID}.jpg" -o "${OUTPUT_FILE}" +swaymsg "output * bg $OUTPUT_FILE fill" diff --git a/sway/.config/sway/config b/sway/.config/sway/config index 442fc63..53dd02f 100644 --- a/sway/.config/sway/config +++ b/sway/.config/sway/config @@ -297,6 +297,8 @@ bindsym $mod+Shift+a exec ~/.local/share/scripts/recurrent-actions bindsym $mod+Shift+s exec ~/.local/share/scripts/tmuxp-session # power menu bindsym $mod+Shift+p exec ~/.local/share/scripts/power-menu +# earth view wallpaper +bindsym $mod+Shift+w exec ~/.local/share/scripts/earth-view-wallpaper # theme switcher menu bindsym $mod+Shift+t mode "$Theme-switch"