From 814bbbc1b59b07082c1c9233eeb26c24ebff7c61 Mon Sep 17 00:00:00 2001 From: coolneng Date: Fri, 13 Jan 2023 21:36:18 +0100 Subject: [PATCH] Add Earth View wallpaper download script --- .../.local/share/scripts/earth-view-wallpaper | 16 ++++++++++++++++ sway/.config/sway/config | 2 ++ 2 files changed, 18 insertions(+) create mode 100755 scripts/.local/share/scripts/earth-view-wallpaper 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"