Advertisement
13minutes-yt

date-pipemenu-obarun

Mar 13th, 2022
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. #!/bin/bash
  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.  
  12. # Outputs the selected row from the calender output.
  13. # If you don't use a mono spaced font, you would have to play with spacing here.
  14. # It would probably involve a very complicated mess. Is there a way to force a
  15. # different font per menu?
  16. function calRow() {
  17. cal | gawk -v row=$1 '{ if (NR==row) { print $0 } }'
  18. }
  19. London=$(TZ='Europe/London' date +"%H:%M")
  20. Paris=$(TZ='Europe/Paris' date +"%H:%M")
  21. Newyork=$(TZ='America/New_York' date +"%H:%M")
  22. Tokyo=$(TZ='Asia/Tokyo' date +"%H:%M")
  23. Sydney=$(TZ='Australia/Sydney' date +"%H:%M")
  24. Auckland=$(TZ='Pacific/Auckland' date +"%H:%M")
  25. Noumea=$(TZ='Pacific/Noumea' date +"%H:%M")
  26. Greenwich=$(TZ='Greenwich' date +"%H:%M")
  27. # Build the menu
  28. cat << EOFMENU
  29. <openbox_pipe_menu>
  30. <item label="`date +%A\ \ \ \ \ \ \ \ \ \ \ \ %H:%M`" />
  31. <item label="`date +%B\ %d,\ %Y`" />
  32. <separator />
  33. <item label="`calRow 2`" />
  34. <item label="`calRow 3`" />
  35. <item label="`calRow 4`" />
  36. <item label="`calRow 5`" />
  37. <item label="`calRow 6`" />
  38. <item label="`calRow 7`" />
  39. <separator />
  40. <item label="London $London"/>
  41. <item label="Paris $Paris"/>
  42. <item label="New York $Newyork"/>
  43. <item label="Tokyo $Tokyo"/>
  44. <item label="Sydney $Sydney"/>
  45. <item label="Auckland $Auckland"/>
  46. <item label="Noumea $Noumea"/>
  47. <item label="Greenwich $Greenwich"/>
  48. </openbox_pipe_menu>
  49. EOFMENU
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement