diff options
| author | steven-na <noreply.github@stvnc.dev> | 2026-04-27 12:54:48 -0700 |
|---|---|---|
| committer | steven-na <noreply.github@stvnc.dev> | 2026-04-27 12:54:48 -0700 |
| commit | f131fac65e297c1322edf88bd571a4282171596d (patch) | |
| tree | 73ad47cdd31c2e76a1018ce2748851dbe051a9cf /arch | |
| parent | 525bb75b51c640f8960463d372ad599a6fe9f57e (diff) | |
new stuff
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/fastfetch/.config/fastfetch/config.jsonc | 44 | ||||
| -rwxr-xr-x | arch/install.sh | 2 | ||||
| -rwxr-xr-x | arch/scripts/.local/bin/get-new-wallpaper | 59 |
3 files changed, 105 insertions, 0 deletions
diff --git a/arch/fastfetch/.config/fastfetch/config.jsonc b/arch/fastfetch/.config/fastfetch/config.jsonc new file mode 100644 index 0000000..a860b0b --- /dev/null +++ b/arch/fastfetch/.config/fastfetch/config.jsonc @@ -0,0 +1,44 @@ +{ + "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json", + "logo": { + "type": "small", + "padding": { + "right": 1 + } + }, + "display": { + "size": { + "binaryPrefix": "si" + }, + "color": "blue", + "separator": " " + }, + "modules": [ + { + "type": "os", + "key": "OS {#keys}", + "format": "{pretty-name} {arch}" + }, + "kernel", + { + "type": "datetime", + "key": "Date ", + "format": "{1}-{3}-{11}" + }, + { + "type": "datetime", + "key": "Time ", + "format": "{14}:{17}:{20}" + }, + "break", + { + "type":"media", + "key":"media {#keys}" + }, + { + "type": "colors", + "key": "colors{#keys}", + "symbol": "square" + } + ] +} diff --git a/arch/install.sh b/arch/install.sh index 06a0ef2..648a26c 100755 --- a/arch/install.sh +++ b/arch/install.sh @@ -38,6 +38,7 @@ pacman_packages+=( pamixer playerctl pavucontrol + easyeffects ) # ── Display / input ─────────────────────────────────────────────────────────── @@ -48,6 +49,7 @@ pacman_packages+=( brightnessctl ydotool chafa + obs-studio ) # ── Notifications ───────────────────────────────────────────────────────────── diff --git a/arch/scripts/.local/bin/get-new-wallpaper b/arch/scripts/.local/bin/get-new-wallpaper new file mode 100755 index 0000000..1e97af1 --- /dev/null +++ b/arch/scripts/.local/bin/get-new-wallpaper @@ -0,0 +1,59 @@ +#!/usr/bin/env bash +set -euo pipefail + +subreddit="EarthPorn" +wallpaper_dir="$HOME/wallpapers" +min_width=1920 +mkdir -p "$wallpaper_dir" + +json=$(curl -sf -A "Mozilla/5.0 (X11; Linux x86_64) get-new-wallpaper/1.0" \ + "https://www.reddit.com/r/${subreddit}.json?limit=25") + +# Keep posts where: +# - preview source exists and is at least min_width wide +# - aspect ratio is wider than 4:3 +# For Reddit-hosted images use i.redd.it directly; for external images fall back +# to the signed preview.redd.it URL so hotlink protection doesn't bite us. +mapfile -t candidates < <(echo "$json" | jq -r \ + --argjson min "$min_width" ' + .data.children[].data | + select(.preview.images[0].source != null) | + select(.preview.images[0].source.width >= $min) | + select((.preview.images[0].source.width / .preview.images[0].source.height) > (4/3)) | + [ + .title, + (if (.url | test("^https://i\\.redd\\.it/")) then .url + else (.preview.images[0].source.url | gsub("&"; "&")) + end) + ] | @tsv +') + +if [[ ${#candidates[@]} -eq 0 ]]; then + echo "No suitable images found." >&2 + exit 1 +fi + +selected="${candidates[$((RANDOM % ${#candidates[@]}))]}" +title=$(printf '%s' "$selected" | cut -f1) +img_url=$(printf '%s' "$selected" | cut -f2) + +safe_name=$(printf '%s' "$title" \ + | tr '[:upper:]' '[:lower:]' \ + | sed 's/[^a-z0-9 ]//g' \ + | tr -s ' ' '-' \ + | sed 's/^-//; s/-$//' \ + | cut -c1-60) + +ext=$(printf '%s' "$img_url" | grep -oP '\.(jpg|jpeg|png|webp)' | tail -1 | tr -d '.') +[[ -z "$ext" ]] && ext="jpg" + +filename="${wallpaper_dir}/${safe_name}.${ext}" + +echo "Downloading: $title" +curl -sfL \ + -A "Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0" \ + --referer "https://www.reddit.com/" \ + -o "$filename" "$img_url" || { echo "Download failed." >&2; rm -f "$filename"; exit 1; } + +echo "Saved: $filename" +set-wallpaper "$filename" |