Title: I made a status bar ticker for Tmux Post by: phungus on February 24, 2012, 08:15:01 AM I love to spend time in the terminal and since I only have one screen I wanted to have the MtGox ticker data displayed. I switched from using Screen to using Tmux and have come up with a quick way to put the ticker data in the status bar. Check it out: https://i.imgur.com/QAnTO.png In case anyone else wants to do this, here is how it is accomplished. You only need to install one Perl module, WebService::MtGox. How to add a neat-o MTGox ticker to your Tmux status bar: Write the following script to ~/getMtgox, replace the shebang path to the perl binary if you need to. #!/usr/bin/perl # Returns MTGox ticker output to shell use warnings; use strict; use WebService::MtGox; my $m = WebService::MtGox->new; my $t = $m->get_ticker; my $last = $t->{ticker}->{last}; my $vol = $t->{ticker}->{vol}; my $high = $t->{ticker}->{high}; my $low = $t->{ticker}->{low}; my $buy = $t->{ticker}->{buy}; my $sell = $t->{ticker}->{sell}; my $spread = $buy > $sell ? $buy - $sell : $sell - $buy; my $pspread = sprintf("%0.5f", $spread); print "MtGox: Last:" . $last . " :: Bid: " . $buy . " :: Ask: " . $sell . " :: Spread: " . $pspread . " "; ## End of script Run these commands: tee -a ~/.tmux.conf <<EOF set -g status-fg green set -g status-bg black set -g status-attr bright set-window-option -g window-status-current-bg green set-window-option -g window-status-current-fg black set-window-option -g window-status-current-attr dim set -g status-right '#[fg=cyan,bright]#(perl ~/getMtgox)' set -g status-right-length 75 EOF Now install the perl module. You may or may not use sudo, Ubuntu does: sudo perl -MCPAN -e 'install WebService::MtGox' Sometimes the perl package installation process can take awhile. You don't need to install all of the test modules if you don't want to. It does speed things up for future module installations though. You can change the getMtgox output fairly easily. I've also modified the default tmux color scheme because I found the green background hard to read properly. By default the refresh time is 15 seconds. You can change this by setting a variable in .tmux.conf: set status-interval 15 Cheers everyone. I hope someone finds it useful. I really love tmux. The code is supposed to be much nicer than screen and they've maintained some compatibility, at least in some of the keybindings. |