~kvikshaug/dotfiles

5191b4c5f567bdc42c67041fb02d5a8610f646a3 — Ali Kaafarani 11 months ago f1ea906
updates
6 files changed, 12 insertions(+), 49 deletions(-)

M .config/sway/config
M .gitignore
D .wallpaper/notes
D .wallpaper/wallpaper
D .wallpaper/wallpaperd
A bin/wallpaper
M .config/sway/config => .config/sway/config +1 -2
@@ 32,8 32,7 @@ exec swayws init
exec xrdb -load ~/.Xresources

# Wallpaper
# exec_always ~/.wallpaper/wallpaperd
bindsym $mod+Shift+e exec ~/.wallpaper/wallpaper
bindsym $mod+Shift+e exec ~/bin/wallpaper

# Screen color temperature
exec gammastep -l 55.7:12.5 -t 6500:4400 -m wayland -v &

M .gitignore => .gitignore +0 -1
@@ 1,4 1,3 @@
/.python-home/requirements.txt
/.vim/bundle/
/.wallpaper/files/
/.config/alacritty/theme.yml

D .wallpaper/notes => .wallpaper/notes +0 -5
@@ 1,5 0,0 @@
Simpledesktops:
  http://simpledesktops.com/

die.net earth projections
  https://static.die.net/earth/mercator/1600.jpg

D .wallpaper/wallpaper => .wallpaper/wallpaper +0 -22
@@ 1,22 0,0 @@
#!/usr/bin/env zsh

function setremote() {
  # Fetch random post from a subreddit of your liking.
  # Ideas: r/earthporn, r/spaceporn, r/wallpaper
  subreddit="r/wallpaper"
  curl -so /tmp/wallpaperd.image $(wget -O - -q https://www.reddit.com/${subreddit}/random.json | jq -r '.[0].data.children[0].data.url')
  setwallpaper -m fill /tmp/wallpaperd.image
  return $?
}

function setlocal() {
  # Pick a random locally stored wallpaper (pick a folder to your liking):
  setrandom -m fill -r $HOME/.wallpaper/files
}

echo "wallpaperd: setting remote background"
RETURNVALUE=$(setremote)
if [ $? -ne 0 ]; then
  echo "wallpaperd: failed to set remote; falling back to local"
  setlocal
fi

D .wallpaper/wallpaperd => .wallpaper/wallpaperd +0 -19
@@ 1,19 0,0 @@
#!/usr/bin/env zsh

echo "wallpaperd: initializing"
for pid in $(pgrep -f "wallpaperd"); do
  if [ $pid != $$ ]; then
    echo "wallpaperd: killing existing instance $pid"
    kill -TERM $pid
  fi
done

while true; do
  echo "wallpaperd: setting wallpaper"
  $HOME/.wallpaper/wallpaper

  echo "wallpaperd: sleeping 1 hour"
  sleep 3600
done

echo "wallpaperd: exiting unexpectedly"

A bin/wallpaper => bin/wallpaper +11 -0
@@ 0,0 1,11 @@
#!/usr/bin/env zsh

# Resources:
# Simpledesktops: http://simpledesktops.com/
# die.net earth projections: https://static.die.net/earth/mercator/1600.jpg

# Fetch random post from a subreddit of your liking.
# Ideas: r/earthporn, r/spaceporn, r/wallpaper
subreddit="r/wallpaper"
curl -so /tmp/wallpaperd.image $(wget -O - -q https://www.reddit.com/${subreddit}/random.json | jq -r '.[0].data.children[0].data.url')
setwallpaper -m fill /tmp/wallpaperd.image