calendar_conflict-20140929-161858.sh 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/sh
  2. #
  3. # date-menu.sh
  4. #
  5. # This is in the public domain. Honestly, how can you claim anything to something
  6. # this simple?
  7. #
  8. # Outputs a simple openbox pipe menu to display the date, time, and calendar.
  9. # You need 'date' and 'cal'. You should have these. Additionally, the calendar
  10. # only appears properly formated if you use a mono spaced font.
  11. # Outputs the selected row from the calender output.
  12. # If you don't use a mono spaced font, you would have to play with spacing here.
  13. # It would probably involve a very complicated mess. Is there a way to force a
  14. # different font per menu?
  15. function calRow() {
  16. cal | gawk -v row=$1 '{ if (NR==row) { print $0 } }'
  17. }
  18. # Build the menu
  19. cat << EOFMENU
  20. <openbox_pipe_menu>
  21. <separator label="`date +%A\ %I\:%M\ %p`" />
  22. <item label="`date +%B\ %d,\ %Y`" />
  23. <separator />
  24. <item label="`calRow 2`"/>
  25. <item label="`calRow 3`"/>
  26. <item label="`calRow 4`"/>
  27. <item label="`calRow 5`"/>
  28. <item label="`calRow 6`"/>
  29. <item label="`calRow 7`"/>
  30. </openbox_pipe_menu>
  31. EOFMENU