Skip to content

Instantly share code, notes, and snippets.

@2shortplanks
Created February 5, 2014 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2shortplanks/8835467 to your computer and use it in GitHub Desktop.
Save 2shortplanks/8835467 to your computer and use it in GitHub Desktop.
Keyboard Maestro Macro to pop open a big dialog when you're about to run out of power (rather than OSX 10.9's small notification)
<?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">
<array>
<dict>
<key>Activate</key>
<string>Normal</string>
<key>IsActive</key>
<true/>
<key>Macros</key>
<array>
<dict>
<key>Actions</key>
<array>
<dict>
<key>IsActive</key>
<true/>
<key>IsDisclosed</key>
<true/>
<key>MacroActionType</key>
<string>Comment</string>
<key>Text</key>
<string></string>
<key>Title</key>
<string>Check if we've been triggered already</string>
</dict>
<dict>
<key>Conditions</key>
<dict>
<key>ConditionList</key>
<array>
<dict>
<key>ConditionType</key>
<string>Variable</string>
<key>Variable</key>
<string>Power</string>
<key>VariableConditionType</key>
<string>Is</string>
<key>VariableValue</key>
<string>Triggered</string>
</dict>
</array>
<key>ConditionListMatch</key>
<string>All</string>
</dict>
<key>ElseActions</key>
<array>
<dict>
<key>IsActive</key>
<true/>
<key>IsDisclosed</key>
<true/>
<key>MacroActionType</key>
<string>Comment</string>
<key>Text</key>
<string></string>
<key>Title</key>
<string>Check to see if we're a) discharging and b) at or below 5% charge</string>
</dict>
<dict>
<key>DisplayKind</key>
<string>Variable</string>
<key>IsActive</key>
<true/>
<key>IsDisclosed</key>
<true/>
<key>MacroActionType</key>
<string>ExecuteShellScript</string>
<key>Path</key>
<string></string>
<key>Text</key>
<string>perl -e '$_=`pmset -g batt`; exit if /discharding/; my ($p) = /(\d+)%/; exit if $p&gt;5; print "$p"'</string>
<key>TimeOutAbortsMacro</key>
<true/>
<key>TrimResults</key>
<true/>
<key>TrimResultsNew</key>
<true/>
<key>UseText</key>
<true/>
<key>Variable</key>
<string>Power</string>
</dict>
<dict>
<key>Conditions</key>
<dict>
<key>ConditionList</key>
<array>
<dict>
<key>ConditionType</key>
<string>Variable</string>
<key>Variable</key>
<string>Power</string>
<key>VariableConditionType</key>
<string>IsNotEmpty</string>
<key>VariableValue</key>
<string>value</string>
</dict>
</array>
<key>ConditionListMatch</key>
<string>All</string>
</dict>
<key>ElseActions</key>
<array/>
<key>IsActive</key>
<true/>
<key>IsDisclosed</key>
<true/>
<key>MacroActionType</key>
<string>IfThenElse</string>
<key>ThenActions</key>
<array>
<dict>
<key>Action</key>
<string>DisplayWindow</string>
<key>IsActive</key>
<true/>
<key>IsDisclosed</key>
<true/>
<key>MacroActionType</key>
<string>InsertText</string>
<key>Paste</key>
<false/>
<key>StyledText</key>
<data>
cnRmZAAAAAAD
AAAAAgAAAAcA
AABUWFQucnRm
AQAAAC4oAQAA
KwAAAAEAAAAg
AQAAe1xydGYx
XGFuc2lcYW5z
aWNwZzEyNTJc
Y29jb2FydGYx
MjY1CntcZm9u
dHRibFxmMFxm
bmlsXGZjaGFy
c2V0MCBMdWNp
ZGFHcmFuZGU7
fQp7XGNvbG9y
dGJsO1xyZWQy
NTVcZ3JlZW4y
NTVcYmx1ZTI1
NTt9ClxwYXJk
XHR4NTYwXHR4
MTEyMFx0eDE2
ODBcdHgyMjQw
XHR4MjgwMFx0
eDMzNjBcdHgz
OTIwXHR4NDQ4
MFx0eDUwNDBc
dHg1NjAwXHR4
NjE2MFx0eDY3
MjBccGFyZGly
bmF0dXJhbAoK
XGYwXGZzMjYg
XGNmMCBXYXJu
aW5nLCBvbmx5
ICVWYXJpYWJs
ZSVQb3dlciUg
cGVyY2VudCBi
YXR0ZXJ5IGxl
ZnR9AQAAACMA
AAABAAAABwAA
AFRYVC5ydGYQ
AAAAbcfyUrYB
AAAAAAAAAAAA
AA==
</data>
<key>Text</key>
<string>Warning, only %Variable%Power% percent battery left</string>
</dict>
<dict>
<key>IsActive</key>
<true/>
<key>IsDisclosed</key>
<true/>
<key>MacroActionType</key>
<string>Comment</string>
<key>Text</key>
<string></string>
<key>Title</key>
<string>Set the status to "Triggered" so we don't show again until after we've charged</string>
</dict>
<dict>
<key>IsActive</key>
<true/>
<key>IsDisclosed</key>
<true/>
<key>MacroActionType</key>
<string>SetVariableToText</string>
<key>Text</key>
<string></string>
<key>Variable</key>
<string>Triggered</string>
</dict>
</array>
<key>TimeOutAbortsMacro</key>
<true/>
</dict>
</array>
<key>IsActive</key>
<true/>
<key>IsDisclosed</key>
<true/>
<key>MacroActionType</key>
<string>IfThenElse</string>
<key>ThenActions</key>
<array>
<dict>
<key>IsActive</key>
<true/>
<key>IsDisclosed</key>
<true/>
<key>MacroActionType</key>
<string>Comment</string>
<key>Text</key>
<string></string>
<key>Title</key>
<string>We're in the "Triggered" status. See if we're charging, so we clear out of this</string>
</dict>
<dict>
<key>DisplayKind</key>
<string>Variable</string>
<key>IsActive</key>
<true/>
<key>IsDisclosed</key>
<true/>
<key>MacroActionType</key>
<string>ExecuteShellScript</string>
<key>Path</key>
<string></string>
<key>Text</key>
<string>perl -e '$_=`pmset -g batt`; print /discharging/ ? "Triggered" : "Discharging Again"'</string>
<key>TimeOutAbortsMacro</key>
<true/>
<key>TrimResults</key>
<true/>
<key>TrimResultsNew</key>
<true/>
<key>UseText</key>
<true/>
<key>Variable</key>
<string>Power</string>
</dict>
</array>
<key>TimeOutAbortsMacro</key>
<true/>
</dict>
</array>
<key>IsActive</key>
<true/>
<key>ModificationDate</key>
<real>413335151.24349999</real>
<key>Name</key>
<string>Low Battery Alert</string>
<key>Triggers</key>
<array>
<dict>
<key>ExecuteType</key>
<string>While</string>
<key>MacroTriggerType</key>
<string>Time</string>
<key>Repeat</key>
<true/>
<key>RepeatTime</key>
<integer>60</integer>
<key>TimeFinishHour</key>
<integer>23</integer>
<key>TimeFinishMinutes</key>
<integer>59</integer>
<key>TimeHour</key>
<integer>0</integer>
<key>TimeMinutes</key>
<integer>0</integer>
<key>WhichDays</key>
<integer>127</integer>
</dict>
</array>
<key>UID</key>
<string>749D1A10-5337-4BB6-B8D1-531FFB124469</string>
</dict>
</array>
<key>Name</key>
<string>Low Battery</string>
<key>UID</key>
<string>FD3040BF-4D5A-4CA7-AFBF-94CD102D73FD</string>
</dict>
</array>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment