-
Notifications
You must be signed in to change notification settings - Fork 1
/
org-clock.applescript
executable file
·72 lines (31 loc) · 1.71 KB
/
org-clock.applescript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/osascript
on run argv
set cmd to item 1 of argv
if cmd is equal to "clock_in"
tell application "System Events" to set FrontAppName to name of first process where frontmost is true
set emacs_active to ""
if FrontAppName is "Emacs" then
set emacs_active to " t"
end if
set task_name to do shell script ". ~/.profile ; $EMACSCLIENT --no-wait --eval '(ym-clock-in-and-notify" & emacs_active & ")' | xargs echo"
do shell script "afplay ~/.emacs.d/org-clock-in.wav"
display notification task_name with title "clock in"
# tell application "org-clock-statusbar" to clock in task_name
else if cmd is equal to "clock_in_default"
set task_name to do shell script ". ~/.profile ; $EMACSCLIENT --no-wait --eval '(ym-clock-in-default-and-notify)' | xargs echo"
do shell script "afplay ~/.emacs.d/org-clock-in.wav"
display notification task_name with title "clock in default"
# tell application "org-clock-statusbar" to clock in task_name
else if cmd is equal to "clock_out"
set task_name to do shell script ". ~/.profile ; $EMACSCLIENT --no-wait --eval '(ym-clock-out-and-notify)' | xargs echo"
do shell script "afplay ~/.emacs.d/org-clock-out.wav"
display notification "--- " & task_name with title "clock out"
# display notification "--- " with title "clock out"
# tell application "org-clock-statusbar" to clock out
else if cmd is equal to "show_current"
do shell script ". ~/.profile ; $EMACSCLIENT --no-wait --eval '(ym-clock-show-current)'"
tell application "Emacs"
activate
end tell
end if
end run