Skip to content

Instantly share code, notes, and snippets.

@pronto
Created November 6, 2013 19:11
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 pronto/7342275 to your computer and use it in GitHub Desktop.
Save pronto/7342275 to your computer and use it in GitHub Desktop.
Space API for tmux output
#! /usr/bin/env python
import simplejson
import urllib2
url="http://www.uasstatus.com/spaceapi.json"
out=urllib2.urlopen(url).read()
json=simplejson.loads(out)
if json['open']== True:
line= "#[fg=green,bold]|{0}|"
else:
line= "#[fg=red]|{0}|"
print line
#put this file somewhere;
#change for your space; list of spaces use space api is http://spaceapi.net/directory
#then in .tmux.conf
#set -g status-right "#[fg=red]#( ~/path.to.script.py)"
#if tmux is already loaded you can do a ctrl-modkey : to bring up the prompot and do source-file ~/.tmux.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment