Allow anonymous experiments
[khome.git] / home / bin / wallpaper_fav
CommitLineData
11b7df8d
SK
1#! /bin/sh
2
3set -e
4
fdc87852
SK
5case "$1" in
6 '')
7 current_wallpaper_file=$(
8 awk '
9 NR == 2 {
10 if (NF > 3) {
11 # XXX Assume feh wrote a N>4-field command line, like:
12 # feh --no-fehbg --bg-scale $file
13 sub("^" $1 " +" $2 " +" $3 " +", "")
14 } else if (NF < 4) {
15 # XXX Assume feh wrote a N<4-field command line, like:
16 # feh --bg-scale $file
17 sub("^" $1 " +" $2 " +", "")
18 } else {
19 printf "[error] Unexpected number of fields in ~/.fehbg command: %s\n" $0 > "/dev/stderr"
20 exit 1
21 }
22 print
23 exit 0
24 }
25 ' \
26 ~/.fehbg \
27 | xargs # Unquote the filename, which feh puts in single quotes.
28 );;
29 *)
30 current_wallpaper_file="$1"
31esac
32
33sha256sum "$current_wallpaper_file" >> "$FILE_WALLPAPER_FAVS"
787359d1 34sort -u "$FILE_WALLPAPER_FAVS" | sponge "$FILE_WALLPAPER_FAVS"
This page took 0.032551 seconds and 4 git commands to generate.