Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Hu now records which application is active (i.e. front-most).

  • Loading branch information...
commit 647e0957cdec41dff6ce0a4d27c36dbe9ad2bc02 1 parent 430b996
@scottjacksonx authored
Showing with 13 additions and 1 deletion.
  1. +10 −1 hu.py
  2. +3 −0  scripts/frontApplication.applescript
View
11 hu.py
@@ -48,6 +48,12 @@ def getOpenBrowserTabs(browser):
"""
return commands.getoutput("osascript scripts/urls.applescript")
+def getCurrentApp():
+ """
+ Gets the name of the front-most application.
+ """
+ return commands.getoutput("osascript scripts/frontApplication.applescript")
+
def takeSnapshot():
@@ -67,7 +73,10 @@ def takeSnapshot():
newFile.write(getWeather(myLocation) + "\n")
# put current track in file.
- newFile.write("Now Playing: " + str(getCurrentlyPlaying()) + "\n\n")
+ newFile.write("Now Playing: " + str(getCurrentlyPlaying()) + "\n")
+
+ # put front app in file.
+ newFile.write("Current Application: " + str(getCurrentApp()) + "\n\n")
tracks = getRecentTracks(myLastFmUsername)
for track in tracks:
View
3  scripts/frontApplication.applescript
@@ -0,0 +1,3 @@
+tell application "System Events"
+item 1 of (get name of processes whose frontmost is true)
+end tell
Please sign in to comment.
Something went wrong with that request. Please try again.