Skip to content

Commit

Permalink
Merge pull request #11 from yaitaimo/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
yaitaimo committed Jul 25, 2014
2 parents 16db324 + d355b4c commit 5b100ac
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.scpt diff=applescript
Binary file modified stickies_activate.scpt
Binary file not shown.
14 changes: 8 additions & 6 deletions stickies_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from os.path import expanduser, getmtime, exists
from subprocess import Popen, PIPE
import json
import re

home = expanduser('~')

Expand Down Expand Up @@ -42,12 +43,10 @@ def main(wf):
(out, error) = pr.communicate(rtf)
out = unicodedata.normalize('NFC', out.decode('utf-8'))
stickies.append(out)
json_stickies = json.dumps(stickies)
f.write(json_stickies)
json.dump(stickies, f)
else:
f = open(filename)
json_stickies = f.read()
stickies = json.loads(json_stickies)
stickies = json.load(f)
query = unicodedata.normalize('NFC', argv[1].decode('utf-8'))
item_isset = False
if query == u"clear":
Expand All @@ -56,11 +55,14 @@ def main(wf):
arg=u'clear',
valid=True)
item_isset = True

query = re.compile(query, re.IGNORECASE)
for stickie in stickies:
if query in stickie:
m = query.search(stickie)
if m:
index = m.start(0)
title = stickie[:50]
arg = stickie[:26]
index = stickie.index(query)
start_offset = 23
end_offset = 65
start = index - start_offset if index > start_offset else 0
Expand Down

0 comments on commit 5b100ac

Please sign in to comment.