«

»

Mar
29

OBS Screensaver

screensaverSome of you might know that I was and in part still am a Gentoo user as well. I always found something reassuring in watching terminal with compilation going on. It is a nice sight. Compiler crunching all those sources and preparing something new for you. On some conference I even saw Gentoo guys showing a recording of Gentoo installation – a lot of compilation in there. I really liked it and I thought that it would make a nice screensaver.

So how can I have such a nice experience in binary distribution like openSUSE? All the packages are built by OBS and I get only binaries. No obvious way how to heat up my apartment with my computer. But I can still get the nice almost warm feeling of packages being compiled! Solution is pretty easy, I just configured xscreensaver to use my script and show me what OBS is working on! The outcome is, I have a screensaver that shows in the cool way compilation output of what OBS is working on right now. I still can smell fresh packages being baked, but without heating up my CPU.

How to do it? Quite simple. You need the following simple script:

  1. #!/bin/bash
  2.  
  3. mkdir -p ~/.obs-saver
  4. cd ~/.obs-saver
  5.  
  6. while true; do
  7. URL="$(curl --connect-timeout 2 'https://build.opensuse.org/monitor/old' 2> /dev/null | \
  8. sed -n 's|.*/package/live_build_log/\([^"]*\)/\([^/]*\)/\([^/]*\)/\([^/]*\)".*|https://build.opensuse.org/build/\1/\3/\4/\2/_log|p' | \
  9. sed -n "`expr 5 + \( ${RANDOM} \* 10 / 32767 \)` p")"
  10. if [ "$URL" ]; then
  11. curl --connect-timeout 2 "$URL" 2> /dev/null | tee "`date +%s`"
  12. LAST_BL="`ls -1 | tail -n 1`"
  13. if [ "`wc -l "$LAST_BL" | sed 's|\ .*||'`" -lt 5 ]; then
  14. rm "$LAST_BL"
  15. cat "`ls -1 | sort -R | tail -n 1`" 2> /dev/null
  16. else
  17. rm -f "`ls -1 | head -n -10`"
  18. fi
  19. else
  20. cat "`ls -1 | sort -R | tail -n 1`" 2> /dev/null
  21. fi
  22. done

Save it as obs-saver in your ~/bin and make sure it is executable. Then if you are using xscreensaver, select “Phosphor” screen saver and in settings -> advanced, use following command line:

phosphor -root -scale 3 -ticks 5 -delay 2000 -program ~/bin/obs-saver

Now if you are connected to the internet and you will wait for screensaver to kick in, it will randomly select one of the latest packages being build on OBS and it will start showing you it’s build log 🙂 I hope you will enjoy it as much as I do! Feeling of stuff being compiled without actually wasting that much of electricity is great 😉

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>