-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dashboard Tasks.glet
279 lines (254 loc) · 12.4 KB
/
Dashboard Tasks.glet
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Command</key>
<string># NotePlan Dashboard Tasks v4.5.3
# Changelog
# 4.5.3
# New: Added a nice message when there are no events, reminders, or tasks
# New: Added option to define custom NotePlan todo/list mark
# Update: Added code to accomodate custom todo/list marks
# 4.5.2
# Fix: Corrected code preventing area headings from displaying properly when events and reminder are visible
# 4.5.1
# Fix: Misplaced comment tag
# 4.5
# New: Added a Changelog
# New: Users can set customizable options for:
# Excluded calendars
# User directory
# Update: Reworked the Other heading to show/hide if there are events or reminders
# Fix: Bug preventing all focus areas from getting displayed
# Fix: Cleaned up the code
#---add custom options---#
#
excludedCals='' # comma separated list of calendars to not show in events
todoMark='' # add your custom todo mark - options are blank (''), asteriks (*), or dash (-)
userDir='/Users/XXX/Library/Mobile\ Documents/iCloud\~co\~noteplan\~NotePlan/Documents/Calendar'
#
#---end custom options---#
#---add variables---#
IFS=$'\n' # make let lines internal field separator
format_heading=$(printf '\033[1;44m') # ansi formatting for headings
format_reset=$(printf '\033[0m') # reset ansi formatting
format_board=$(printf '\033[1;30;47m') # ansi formatting for scoreboard
bullet='»' # bullet for headings
title_open='open:' # title for open tasks
title_done='done:' # title for completed tasks
title_sched='scheduled:' # title for scheduled tasks
title_canx='cancelled:' # title for cancelled tasks
title_cal='events' # heading for events
title_reminder='reminders' # heading for reminders
title_noarea='other' # heading for tasks without focus area
today=$(date +%Y%m%d) # store today's date as YYYYMMDD
tomorrow=$(date -v+1d +%Y%m%d) # store tomorrow's date as YYYYMMDD
#---end variables---#
eval cd "$userDir"
#---add task scoreboard---#
# determine task states
case $todoMark in
'')
open=$(grep -v $'\t' $today.txt | grep -c '^\-\s\[\s\]')
string='^\-\s\[\s\]'
trim_chars='7'
;;
'*')
open=$(grep -v $'\t' $today.txt | grep -c '^\*\s[^\[x]')
string='^\*\s[^\[x]'
trim_chars='3'
;;
'-')
open=$(grep -v $'\t' $today.txt | grep -c '^\-\s[^\[x]')
string='^\-\s[^\[x]'
trim_chars='3'
;;
esac
done=$(grep -v $'\t' $today.txt | grep -c '\[x\]')
sched=$(grep -v $'\t' $today.txt | grep -c '\[>\]')
canx=$(grep -v $'\t' $today.txt | grep -c '\[-\]')
subtasks=$(grep $'\t' $today.txt | grep -c '\[ \]')
echo "$format_board $title_open $open $title_done $done $title_sched $sched $title_canx $canx $format_reset\n" | tr [a-z] [A-Z]
#---end task scoreboard---#
#---add icalbuddy calendar events---#
# determine if there are any events
events=$(/usr/local/bin/icalBuddy -n -ec ${excludedCals} eventsToday)
# if there are events then display the events, if not display nothing
if [[ $events ]]
then
echo "$format_heading $bullet $title_cal $format_reset\n" | tr [a-z] [A-Z]
/usr/local/bin/icalBuddy -po datetime,title -eep location,url,notes,attendees -ps "| |" -b " • " -n -ec ${excludedCals} eventsToday
echo
else
printf ""
fi
#---end icalbuddy calendar events---#
#---add icalbuddy calendar reminders---#
# determine if there are any reminders
reminders=$(/usr/local/bin/icalBuddy tasksDueBefore:$'tomorrow')
if [[ $reminders ]]
then
echo "$format_heading $bullet $title_reminder $format_reset\n" | tr [a-z] [A-Z]
/usr/local/bin/icalBuddy -po title -etp location,url,notes,attendee,datetime s -ps "| |" -b " • " tasksDueBefore:$'tomorrow'
echo
else
printf ""
fi
#---end icalbuddy calendar reminders---#
#---add focus areas & tasks---#
# find & store focus areas in an array
areas=($(grep $string $today.txt | grep -o '\[\[[^$]*\]\]' | tr -d '[[|]]' | uniq ))
# loop through the stored focus areas & output related tasks
for (( i=0; i<${#areas[@]}; i++ ))
do
echo "$format_heading $bullet ${areas[$i]} $format_reset\n" | tr [a-z] [A-Z]
grep "${areas[$i]}" $today.txt | grep $string | grep -v $'\t' | sed 's/[<>].*//g' | sed 's/\[\[[^]]*\]\]//g' | cut -c $trim_chars- | sed -e 's/^/ • /'
printf "\n"
done
#---end focus areas & tasks---#
#---add tasks without areas---#
noarea=$(grep -v '\[\[[^$]*\]\]' $today.txt | grep -c $string | grep -v $'\t')
if [[ $reminders || $events ]] && [[ $i = 0 && $noarea = 0 ]]
then
printf ""
elif ! [[ $reminders || $events ]] && [[ $i = 0 && $noarea = 0 ]]
then
echo "Nothing to do!"
elif [[ $reminders || $events ]] && [[ $i = 0 && $noarea > 0 ]]
then
echo "$format_heading $bullet $title_noarea $format_reset\n" | tr [a-z] [A-Z]
grep -v '\[\[[^$]*' $today.txt | grep $string | grep -v $'\t' | sed 's/[<>].*//g' | cut -c $trim_chars- | sed -e 's/^/ • /'
elif [[ $reminders || $events ]] && [[ $i > 0 && $noarea > 0 ]]
then
echo "$format_heading $bullet $title_noarea $format_reset\n" | tr [a-z] [A-Z]
grep -v '\[\[[^$]*' $today.txt | grep $string | grep -v $'\t' | sed 's/[<>].*//g' | cut -c $trim_chars- | sed -e 's/^/ • /'
elif ! [[ $reminders || $events ]] && [[ $i = 0 && $noarea > 0 ]]
then
grep -v '\[\[[^$]*' $today.txt | grep $string | grep -v $'\t' | sed 's/[<>].*//g' | cut -c $trim_chars- | sed -e 's/^/ • /'
elif ! [[ $reminders || $events ]] && [[ $i > 0 && $noarea > 0 ]]
then
echo "$format_heading $bullet $title_noarea $format_reset\n" | tr [a-z] [A-Z]
grep -v '\[\[[^$]*' $today.txt | grep $string | grep -v $'\t' | sed 's/[<>].*//g' | cut -c $trim_chars- | sed -e 's/^/ • /'
fi
#---end tasks without areas---#
# find tasks assigned a focus area grep "${areas[$i]}" $today.txt
# find only open tasks grep '\[ \]'
# exclude indented tasks grep -v $'\t'
# remove "- [ ]" for nicer formatting cut -c 7-
# add space + bullet at start of line sed -e 's/^/ • /'
# removes the focus area in the line sed 's/\[\[[^]]*\]\]//g'
# removes "<" and everything after sed 's/\<[^]]*//'
# removes everything after "<" or ">" sed 's/[<>].*//g'</string>
<key>DisplayID</key>
<integer>69992768</integer>
<key>DropShadow</key>
<false/>
<key>FailureImage</key>
<data>
TU0AKgAABAj///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAGgAAACAAAAAaAAAA
DQAAAAAAAAAAAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAgAAQFYGBYWqyso
KOExLy/9Kygo4RgWFqoAAQFXAAAACAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAgG
BgZ8Rz4+8qWXl//c09P/6+Tl/93T0/+ll5f/Rz4+8gYGBnwAAAAIAAAAAAAAAAD///8A
AAAAAAAAAAQHAgJkSS0t9Kt9ff/ct7j/7NHS/+7T0//s0dL/3be4/6t9ff9JLS30BwIC
ZQAAAAUAAAAA////AAAAAAAAAAAmLhAQzJA+P/+1TEv/xmNe/8twav/LcGr/y3Bq/8Zj
Xf+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u
</data>
<key>FontFamily</key>
<string>Menlo-Regular</string>
<key>FontSize</key>
<real>12</real>
<key>GeekletFrame</key>
<string>{{500, 35}, {800, 1000}}</string>
<key>HasShadow</key>
<false/>
<key>Identifier</key>
<string>org.tynsoe.geeklet.shell</string>
<key>Name</key>
<string>NotePlan Dashboard Tasks</string>
<key>RefreshInterval</key>
<integer>10</integer>
<key>SetLocale</key>
<true/>
<key>SuccessImage</key>
<data>
TU0AKgAABAj///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAGgAAACAAAAAaAAAA
DQAAAAAAAAAAAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAgBAQFYFhUWqygn
KOEvLi/9KCco4RYVFqsBAQFYAAAACAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAgG
AwZ8Pj0+8peYl//S0tP/4+Tl/9LS0/+XmJf/Pj0+8gYDBnwAAAAIAAAAAAAAAAD///8A
AAAAAAAAAAUDAQJlLTEt9HqRff+40Ln/1efT/9jo1f/V59P/uNG5/3qRff8tMS30AwEC
ZQAAAAUAAAAA////AAAAAAAAAAAmEBYQyz1tP/9Xm03/eLJX/4e6YP+HuWL/h7pg/3ix
V/9Wmk3/PWw//xAWEMsAAAAmAAAAAP///wAAAAAAAAAAThY8Gvc8jjD/TJwb/2CnHf9r
ryz/bLEv/2ywLP9iqR7/TJ4b/zyQMP8WPBr3AAAATQAAAAD///8AAAAAAQAIAGgeYRv/
VaUq/2WvIP91uzb/gsZI/4bIS/+DyEj/d743/2exIP9WqSr/HmIb/wAIAGcAAAAB////
AAAAAAgADABsJ3MY/3C6Nv9/xz3/kNNT/57dYv+i32f/n99k/5HWVP+AyD3/cr02/yd0
GP8ADQBsAAAACf///wAAAAAMAAYAYydqEPB/yD7/lNhW/6PlZv+x8Xb/uPd8/7P0eP+k
6Gf/ldpX/4DLQP8maxDvAAYAYwAAAAv///8AAAAADwAAAE4XRwXLd8Y5/6foa/+393v/
wv6F/8r/i//F/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AAAAFGJYWVoAAAHoAAAAFHJUUkMAAAH8AAAADnZjZ3QAAAIMAAAAMG5kaW4A
AAI8AAAAPmNoYWQAAAJ8AAAALGJUUkMAAAH8AAAADmdUUkMAAAH8AAAADmRlc2MAAAAA
AAAAGkNhbGlicmF0ZWQgUkdCIENvbG9yc3BhY2UAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAdGV4dAAAAABDb3B5cmlnaHQgQXBwbGUgSW5jLiwgMjAxOAAAWFlaIAAAAAAA
APNRAAEAAAABFsxYWVogAAAAAAAAb6AAADj1AAADkFhZWiAAAAAAAABilwAAt4cAABjZ
WFlaIAAAAAAAACSfAAAPhAAAtsNjdXJ2AAAAAAAAAAEBzQAAdmNndAAAAAAAAAABAAEA
AAAAAAAAAQAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAAQAAbmRpbgAAAAAAAAA2AACj1wAA
VHsAAEzNAACZmgAAJmYAAA9cAABQDQAAVDkAAczOAAHMzgABzM4AAAAAAAAAAHNmMzIA
AAAAAAEMQgAABd7///MmAAAHkwAA/ZD///ui///9owAAA9wAAMBu
</data>
<key>TextColor</key>
<data>
BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm
ZmZmAYNS/n8/g27/fz8Bhg==
</data>
<key>TextStrikethrough</key>
<integer>0</integer>
<key>TextUnderline</key>
<integer>0</integer>
</dict>
</plist>