diff --git a/.config/go/env b/.config/go/env deleted file mode 100644 index 129f62f..0000000 --- a/.config/go/env +++ /dev/null @@ -1,2 +0,0 @@ -GOBIN=/home/ohad/.local/state/go/bin -GOPATH=/home/ohad/.cache/go diff --git a/.config/systemd/user/get-nasa-apod.service b/.config/systemd/user/get-nasa-apod.service index a3bf8d7..1da3c26 100644 --- a/.config/systemd/user/get-nasa-apod.service +++ b/.config/systemd/user/get-nasa-apod.service @@ -1,6 +1,5 @@ [Unit] Description=Refresh the wallpaper using the NASA Astronomy Picture of the Day -After=network-online.target Wants=get-nasa-apod.timer [Service] diff --git a/.config/systemd/user/get-nasa-apod.timer b/.config/systemd/user/get-nasa-apod.timer index 2585e34..4cac963 100644 --- a/.config/systemd/user/get-nasa-apod.timer +++ b/.config/systemd/user/get-nasa-apod.timer @@ -1,10 +1,9 @@ [Unit] Description=Daily NASA wallpaper fetch -After=network-online.target Requires=get-nasa-apod.service [Timer] -Unit=get-nasa-apod.service +Unit=nasa-apod.service OnCalendar=daily [Install] diff --git a/.local/bin/get-nasa-apod b/.local/bin/get-nasa-apod index c873456..f0f2724 100755 --- a/.local/bin/get-nasa-apod +++ b/.local/bin/get-nasa-apod @@ -8,47 +8,34 @@ if [ "${API_KEY}" = "DEMO_KEY" ]; then echo "No API key set! using demo key." fi -WALLPAPERS="$(systemd-path user)"/Pictures/nasa +WALLPAPERS="$(systemd-path user)"/Wallpapers mkdir --parents "${WALLPAPERS}" APOD_URL="https://api.nasa.gov/planetary/apod?api_key=${API_KEY}" -echo "Fetching data from API" -response="$(curl --silent --write-out '{"rate-limit": %header{x-ratelimit-remaining}}' "${APOD_URL}" | jq --slurp add)" -echo "Received response from API" -# shellcheck disable=SC2005 -echo "$(printf '%s' "${response}" | jq '.')" -echo "Parsing data" +response="$(curl --silent "${APOD_URL}")" picture_date="$(printf '%s' "${response}" | jq --raw-output .date)" picture_url="$(printf '%s' "${response}" | jq --raw-output .hdurl)" -rate_remaining="$(printf '%s' "${response}" | jq '."rate-limit"')" -echo "Remaining requests until rate limit: ${rate_remaining}" -echo "Generating output filename" extension="${picture_url##*.}" filename="${picture_date}.${extension}" outfile="${WALLPAPERS}/${filename}" if [ -f "${outfile}" ]; then echo "Target file already exists" -else - echo "Creating temporary file" - tempfile="$(mktemp)" - echo "Fetching the daily picture" - curl \ - --location \ - --output "${tempfile}" \ - --silent \ - "${picture_url}" - echo "Transaction-like file update" - mv "${tempfile}" "${outfile}" + exit 0 fi -echo "Updating the wallpaper image" +tempfile="$(mktemp)" +curl \ + --location \ + --output "${tempfile}" \ + --silent \ + "${picture_url}" +mv "${tempfile}" "${outfile}" ln \ --force \ --symbolic \ "${outfile}" \ "${WALLPAPERS}/today" -echo "Refreshing the desktop background" swaymsg output "*" bg "${SWAY_WALLPAPER}" fill diff --git a/.local/bin/take-screenshot b/.local/bin/take-screenshot index 32f4eaf..f2cf7c2 100755 --- a/.local/bin/take-screenshot +++ b/.local/bin/take-screenshot @@ -30,7 +30,7 @@ recording_filename() { echo ~/Pictures/screenshots/recording-"$(ts)".mp4 } -if [ -z "${1+exists}" ]; then +if [ -z "$1" ]; then option=$(listopts | fuzzel --dmenu) else option="$1"