Skip to content

Commit 7359e3d

Browse files
committed
update a couple plugins
1 parent fdf9b6e commit 7359e3d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+14509
-23
lines changed

PluginDirectories/1/1688.bundle/2.version

Lines changed: 0 additions & 1 deletion
This file was deleted.

PluginDirectories/1/alibaba.bundle/1.version

Lines changed: 0 additions & 1 deletion
This file was deleted.

PluginDirectories/1/aliexpress.bundle/1.version

Lines changed: 0 additions & 1 deletion
This file was deleted.

PluginDirectories/1/bing.bundle/1.version

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
e0fee9e43da82e24bb02a31d0d5479d7c7ebadc9d66b46416b1bb64be9130b28
59.7 KB
Loading
164 KB
Loading
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/python
2+
3+
# via http://www.leancrew.com/all-this/2013/03/combining-python-and-applescript/
4+
5+
import subprocess
6+
7+
def asrun(ascript):
8+
"Run the given AppleScript and return the standard output and error."
9+
10+
osa = subprocess.Popen(['osascript', '-'],
11+
stdin=subprocess.PIPE,
12+
stdout=subprocess.PIPE)
13+
return osa.communicate(ascript)[0]
14+
15+
def asquote(astr):
16+
"Return the AppleScript equivalent of the given string."
17+
18+
astr = astr.replace('"', '" & quote & "')
19+
return '"{}"'.format(astr)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from applescript import asrun, asquote
2+
3+
def create_event(name, from_date, to_date, location):
4+
import datetime
5+
def timestamp_to_applescript(timestamp):
6+
string = datetime.datetime.fromtimestamp(timestamp).strftime("%m/%d/%Y %I:%M:%S %p")
7+
return ' date "{0}"'.format(string)
8+
9+
props = {"summary": asquote(name), "start date": timestamp_to_applescript(from_date), "end date": timestamp_to_applescript(to_date)}
10+
if location:
11+
props['location'] = asquote(location)
12+
props_str = u"{" + u", ".join([u"{0}:{1}".format(key, value) for (key, value) in props.iteritems()]) + u"}"
13+
14+
script = u"""
15+
tell application "Calendar"
16+
activate
17+
set newEvent to make new event at end of events of calendar "Home" with properties {0}
18+
show newEvent
19+
end tell
20+
""".format(props_str)
21+
print script
22+
asrun(script)
23+
24+
if __name__ == '__main__':
25+
create_event("test event", None, None, "hell")
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def dark_mode():
2+
import Foundation
3+
return Foundation.NSUserDefaults.standardUserDefaults().persistentDomainForName_(Foundation.NSGlobalDomain).objectForKey_("AppleInterfaceStyle") == "Dark"

0 commit comments

Comments
 (0)