clock.scm.in 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!@GUILE@
  2. !#
  3. ;;; clock.scm --- Display clock OSD
  4. ;; Copyright © 2016 Alex Kost <alezost@gmail.com>
  5. ;; This program is free software; you can redistribute it and/or modify
  6. ;; it under the terms of the GNU General Public License as published by
  7. ;; the Free Software Foundation, either version 3 of the License, or
  8. ;; (at your option) any later version.
  9. ;;
  10. ;; This program is distributed in the hope that it will be useful,
  11. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ;; GNU General Public License for more details.
  14. ;;
  15. ;; You should have received a copy of the GNU General Public License
  16. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. ;;; Commentary:
  18. ;; This script displays clock (i.e., the current time updated every
  19. ;; second) in the center of your screen.
  20. ;;; Code:
  21. (use-modules (xosd bindings))
  22. (define (setup-clock osd)
  23. "Set up the OSD object to display the clock."
  24. (xosd-set-pos! osd 'middle)
  25. (xosd-set-align! osd 'center)
  26. (xosd-set-font! osd "-*-dejavu sans-bold-r-normal-*-*-600-*-*-p-*-*-1")
  27. (xosd-set-colour! osd "LimeGreen")
  28. (xosd-set-shadow-offset! osd 3))
  29. (define (display-clock osd)
  30. "Display the current time in the OSD object.
  31. This procedure never exits."
  32. (xosd-display-string osd 0 (strftime "%T" (localtime (current-time))))
  33. (sleep 1)
  34. (display-clock osd))
  35. (when (batch-mode?)
  36. (let ((osd (xosd-create 1)))
  37. (setup-clock osd)
  38. (display-clock osd)))
  39. ;;; clock.scm ends here