osx.plugin.zsh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. alias showfiles='defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder'
  2. alias hidefiles='defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder'
  3. # Recursively delete .DS_Store files
  4. alias rm-dsstore="find . -name '*.DS_Store' -type f -delete"
  5. function savepath() {
  6. pwd > ~/.current_path~
  7. }
  8. function tab() {
  9. savepath
  10. osascript >/dev/null <<EOF
  11. on do_submenu(app_name, menu_name, menu_item, submenu_item)
  12. -- bring the target application to the front
  13. tell application app_name
  14. activate
  15. end tell
  16. tell application "System Events"
  17. tell process app_name
  18. tell menu bar 1
  19. tell menu bar item menu_name
  20. tell menu menu_name
  21. tell menu item menu_item
  22. tell menu menu_item
  23. click menu item submenu_item
  24. end tell
  25. end tell
  26. end tell
  27. end tell
  28. end tell
  29. end tell
  30. end tell
  31. end do_submenu
  32. do_submenu("Terminal", "Shell", "New Tab", 1)
  33. EOF
  34. }
  35. function itab() {
  36. savepath
  37. osascript >/dev/null <<EOF
  38. on do_submenu(app_name, menu_name, menu_item)
  39. -- bring the target application to the front
  40. tell application app_name
  41. activate
  42. end tell
  43. tell application "System Events"
  44. tell process app_name
  45. tell menu bar 1
  46. tell menu bar item menu_name
  47. tell menu menu_name
  48. click menu item menu_item
  49. end tell
  50. end tell
  51. end tell
  52. end tell
  53. end tell
  54. end do_submenu
  55. do_submenu("iTerm", "Shell", "New Tab")
  56. EOF
  57. }