diff options
author | Filipp Lepalaan <filipp@mac.com> | 2017-01-05 09:17:45 +0200 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2017-01-05 09:17:45 +0200 |
commit | f33638664835a99b2e11584251a19e6f2374f998 (patch) | |
tree | a8786704c092eb3ae6bd07dbcc1c740c6750df22 /machammer | |
parent | 532bc175b9016daff1a5465122bd8268072ee8f8 (diff) | |
download | machammer-f33638664835a99b2e11584251a19e6f2374f998.tar.gz machammer-f33638664835a99b2e11584251a19e6f2374f998.tar.bz2 machammer-f33638664835a99b2e11584251a19e6f2374f998.zip |
Fixed login hook decorator test
Diffstat (limited to 'machammer')
-rw-r--r-- | machammer/hooks.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/machammer/hooks.py b/machammer/hooks.py index 8826ad9..40b7986 100644 --- a/machammer/hooks.py +++ b/machammer/hooks.py @@ -29,3 +29,15 @@ def reboot(path=None): def shutdown(path=None): """Set shutdown hook to path, or disable shutdown hook.""" pass + + +def mount(mountpoint, path=None): + """Execute path if mountpoint is mounted. Set path to None to disable.""" + label = 'com.github.filipp.machammer.mounthook' + defaults.set('/Library/LaunchAgents/%s' % label, 'Label', label) + defaults.set('/Library/LaunchAgents/%s' % label, 'Program', path) + defaults.set('/Library/LaunchAgents/%s' % label, 'StartOnMount', + '-boolean', + 'TRUE') + defaults.set('/Library/LaunchAgents/%s' % label, 'WatchPaths', '-array', + mountpoint) |