Created
May 15, 2013 20:36
-
-
Save morganrallen/5587161 to your computer and use it in GitHub Desktop.
Open Stava upload new content page when Garmin Edge 305 is plugged in. NodeJS, node-udev
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var udev = require("udev"); | |
var monitor = udev.monitor(); | |
monitor.on("add", function(device) { | |
// change vendor and model IDs to match your device if not Garmin Edge 305 | |
if(device.ID_VENDOR_ID === "091e" && device.ID_MODEL_ID === "0003") { | |
require("child_process").spawn("xdg-open", ["http://app.strava.com/upload/garmin_new"], { | |
env: process.env | |
}); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Only tested on Linux. I'd imagine if udev compiles on OSX changing
xdg-open
to justopen
will allow it to work there also.