Last active
August 1, 2017 15:08
-
-
Save tamanugi/846648cc2fe85c3fc52d49a33b5365c9 to your computer and use it in GitHub Desktop.
org-modeでclock-inしているタスクをMacのメニューバーに表示する ref: http://qiita.com/tamanugi/items/ef43056d5c9709e4f7ab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ brew cask install bitbar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{任意の名前}.{更新間隔}.{拡張子} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar clockin-task-file "~/.clockin_task") | |
(defun write-clockin-task-file () | |
(with-temp-buffer | |
(insert (concat (format-time-string "%s" org-clock-start-time) | |
"\t" | |
org-clock-heading)) | |
(write-region (point-min) (point-max) clockin-task-file)) | |
) | |
(defun delete-clockin-task-file () | |
(delete-file clockin-task-file)) | |
(add-hook 'org-clock-in-hook 'write-clockin-task-file) | |
(add-hook 'org-clock-out-hook 'delete-clockin-task-file) | |
(add-hook 'org-clock-cancel-hook 'delete-clockin-task-file) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -e ~/.clockin_task ]; then | |
task_name=`cat ~/.clockin_task | cut -f 2` | |
start_time=`cat ~/.clockin_task | cut -f 1` | |
elapsed=$(expr `date +%s` - $start_time) | |
h=$(expr $elapsed / 3600) | |
m=$(expr $elapsed % 3600 / 60) | |
disph=`printf %02d $h` | |
dispm=`printf %02d $m` | |
echo ":hourglass_flowing_sand: [$disph:$dispm] $task_name" | |
else | |
echo ":coffee: Break Time" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment