Permalink
Browse files

absolute paths for loading and idle detection for local notifications

  • Loading branch information...
1 parent 4fcb5b7 commit c8e84c6dd7b2f6617bbbb5bf4a35d5bd5d907904 Russell Jennings committed Feb 24, 2012
Showing with 10 additions and 5 deletions.
  1. BIN OF-AQL.scpt
  2. +10 −5 momma.rb
View
Binary file not shown.
View
@@ -3,10 +3,13 @@
require 'date'
require 'time'
# files
-require 'config'
-require 'lib'
+require File.join(File.dirname(__FILE__), 'config')
+require File.join(File.dirname(__FILE__), 'lib')
runcommand =%x[#{AQL_COMMAND} #{AQL_QUERY}]
+
+idletime = %x[ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print $NF/1000000000; exit}'].to_i.round
+p idletime
headers = AQL_SELECTION.split ','
data = runcommand.chomp.split "\n"
@@ -21,11 +24,13 @@
result_hash.each do |t|
hours = t[1]["due_hours_ago"]
case
- when hours <= 3
+ when hours <= 8
+ unless (idletime >= 600)
local_alert(t)
- when hours <= 5
+ end
+ when hours <= 16
email_alert(t)
- when hours >= 6
+ when hours >= 24
text_alert(t)
end
end

0 comments on commit c8e84c6

Please sign in to comment.