Skip to content

Instantly share code, notes, and snippets.

@jlord
Last active August 29, 2015 14:17
Show Gist options
  • Save jlord/04a9fa443cfb81ced0f0 to your computer and use it in GitHub Desktop.
Save jlord/04a9fa443cfb81ced0f0 to your computer and use it in GitHub Desktop.
Atom Shell menubar app with @maxogden's menubar module

Using the existing command line gopdx node module as an easy proof of concept. I already had the module installed globally (npm install -g gopdx) and had a json of my favorite stops by id (as it requires). But in about 3 minutes I was able to turn it into a quick and dirty menubar app. ❇️

var menubar = require('menubar')
var exec = require('child_process').exec
var fs = require('fs')
var mb = menubar()
mb.on('ready', function ready () {
console.log('Ready!')
fetchTimes()
})
mb.on('show', function show () {
fetchTimes()
})
function fetchTimes () {
exec('gopdx -f', function (err, stdout, stderr) {
if (err) return console.log('ERR OH NOE')
fs.writeFileSync('index.html', '<pre>' + stdout + '</pre>')
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment