1
0

calendar 802 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #! /bin/sh
  2. width=200
  3. height=200
  4. datefmt="+%a %d.%m.%Y %H:%M:%S"
  5. OPTIND=1
  6. while getopts ":f:W:H:" opt; do
  7. case $opt in
  8. f) datefmt="$OPTARG" ;;
  9. W) width="$OPTARG" ;;
  10. H) height="$OPTARG" ;;
  11. \?)
  12. echo "Invalid option: -$OPTARG" >&2
  13. exit 1
  14. ;;
  15. :)
  16. echo "Option -$OPTARG requires an argument." >&2
  17. exit 1
  18. ;;
  19. esac
  20. done
  21. case "$BLOCK_BUTTON" in
  22. 1|2|3)
  23. # the position of the upper left corner of the popup
  24. posX=$(($BLOCK_X - $width / 2))
  25. posY=$(($BLOCK_Y - $height))
  26. i3-msg -q "exec yad --calendar \
  27. --width=$width --height=$height \
  28. --undecorated --fixed \
  29. --close-on-unfocus --no-buttons \
  30. --posx=$posX --posy=$posY \
  31. > /dev/null"
  32. esac
  33. date "$datefmt"