updated powerline, thanks to McFuzz for the updated images

This commit is contained in:
jonnyboy
2013-03-19 17:52:14 -04:00
parent ca30bfaa8b
commit afd5edc12b
60 changed files with 285 additions and 185 deletions
-1
View File
@@ -1,3 +1,2 @@
fix.sh
defaults.sh
commit.sh
+4 -2
View File
@@ -80,7 +80,7 @@
* If you connect using **putty**, then under Window/Translation set Remote character set to UTF-8 and check "Copy and paste line drawing characters". To use 256 colors, you must set Connection/Data Terminal-type string to "xterm-256color" and in Window/Colours check the top three boxes, otherwise only 16 colors are displayed. If you are using FreeBSD, you will need to add export TERM=xterm-256color to your .bashrc file to show 256 colors.
* If you are using the powerline status bar, you will most likely need a patched font. The Consolas ttf from [powerline-fonts](https://github.com/jonnyboy/powerline-fonts) is the only one that I have found to be nearly complete and work with putty and Win7. The otf fonts should be fine, although I am not able to test.
* The powerline status bar has many options that are not enabled by default. To enable any of the additional options, simply uncomment the option in the file powerline/powerline/themes/tmux.sh. If you are using the powerline status bar, you will most likely need a patched font. The Consolas ttf from [powerline-fonts](https://github.com/jonnyboy/powerline-fonts) is the only one that I have found to be nearly complete and work with putty and Win7. The otf fonts should be fine, although I am not able to test. For linux users it may not be necessary to install the patched font. You can follow the instructions of [Fontonfig](https://powerline.readthedocs.org/en/latest/installation/linux.html#font-installation) and that could possibly be an easier path.
* I have included a few scripts for mysql, [mysql-tuning-primer](https://launchpad.net/mysql-tuning-primer), [mysqlreport](http://hackmysql.com/mysqlreport) and [mysqltuner.pl](https://github.com/sunfoxcz/MySQLTuner-perl/blob/master/mysqltuner.pl) to assist in tuning your mysql installation. They are located in the scripts folder.
@@ -102,8 +102,10 @@
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=N4AJV5FHZDBFE"><img src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" alt="PayPal - The safer, easier way to pay online!" /></a><a href='http://www.pledgie.com/campaigns/18980'><img alt='Click here to lend your support to: Newznab-tmux and make a donation at www.pledgie.com !' src='http://www.pledgie.com/campaigns/18980.png?skin_name=chrome' border='0' /></a>
<hr>
![Newznab-tmux](https://raw.github.com/jonnyboy/newznab-tmux/master/images/newznab-tmux.png)
![Newznab-tmux](https://raw.github.com/jonnyboy/newznab-tmux/master/images/newznab-tmux-1.png)
![Newznab-tmux](https://raw.github.com/jonnyboy/newznab-tmux/master/images/newznab-tmux-2.png)
![Newznab-tmux](https://raw.github.com/jonnyboy/newznab-tmux/master/images/newznab-tmux-3.png)
![Newznab-tmux](https://raw.github.com/jonnyboy/newznab-tmux/master/images/newznab-tmux-4.png)
![Newznab-tmux](https://raw.github.com/jonnyboy/newznab-tmux/master/images/newznab-tmux-5.png)
![Newznab-tmux](https://raw.github.com/jonnyboy/newznab-tmux/master/images/newznab-tmux-6.png)
+1 -1
View File
@@ -2,7 +2,7 @@
require(dirname(__FILE__)."/config.php");
require(WWW_DIR.'/lib/postprocess.php');
$version="0.1r730";
$version="0.1r735";
$db = new DB();
Executable
+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
commit=`git log | grep "^commit" | wc -l`
commit=`expr $commit + 1`
echo "\nCreating new revision number - $commit"
sed -i -e "s/\$version=.*$/\$version=\"0.1r$commit\";/" bin/monitor.php
git commit -a
Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

+4
View File
@@ -28,3 +28,7 @@ Jeff Felchner
tobetoby
Matthew Lanigan
Hadret <hadret@gmail.com>
antiAgainst <antiAgainst@gmail.com>
Alexander Luberg <alex@luberg.me>
Stanislaw Pusep <stas@sysd.org>
Austin Beam
+35 -9
View File
@@ -3,7 +3,7 @@ This is a set of scripts for making a nice and dynamic tmux statusbar consisting
The following segments exists for now:
* LAN & WAN IP addresses.
* Now Playing for MPD, Spotify (GNU/Linux native or wine, OS X), iTunes (OS X), Rhythmbox, Banshee, MOC, Audacious, Rdio (OS X), cmus and Last.fm (last scrobbled track).
* Now Playing for MPD, Spotify (GNU/Linux native or wine, OS X), iTunes (OS X), Rhythmbox, Banshee, MOC, Audacious, Rdio (OS X), cmus, Pithos and Last.fm (last scrobbled track).
* New mail count for GMail, Maildir, mbox and Apple Mail.
* GNU/Linux and Macintosh OS X battery status (uses [richo/dotfiles/bin/battery](https://github.com/richoH/dotfiles/blob/master/bin/battery)).
* Weather in Celsius, Fahrenheit and Kelvin using Yahoo Weather.
@@ -20,37 +20,37 @@ The following segments exists for now:
# Screenshots
**Full screenshot**
![Full screenshot](https://github.com/erikw/tmux-powerline/raw/master/img/full.png)
![Full screenshot](img/full.png)
**left-status**
Current tmux session, window and pane, hostname and LAN & WAN IP address.
![left-status](https://github.com/erikw/tmux-powerline/raw/master/img/left-status.png)
![left-status](img/left-status.png)
**right-status**
New mails, now playing, average load, weather, date and time.
![right-status](https://github.com/erikw/tmux-powerline/raw/master/img/right-status.png)
![right-status](img/right-status.png)
Now I've read my inbox so the mail segment disappears!
![right-status, no mail](https://github.com/erikw/tmux-powerline/raw/master/img/right-status_no_mail.png)
![right-status, no mail](img/right-status_no_mail.png)
After pausing the music there's no need for showing NP anymore. Also the weather has become much nicer!
![right-status, no mpd](https://github.com/erikw/tmux-powerline/raw/master/img/right-status_no_mpd.png)
![right-status, no mpd](img/right-status_no_mpd.png)
Remaining battery.
![right-status, weather and battery](https://github.com/erikw/tmux-powerline/raw/master/img/right-status_weather_battery.png)
![right-status, weather and battery](img/right-status_weather_battery.png)
# Requirements
Requirements for the lib to work are:
* Recent tmux version
* `bash --version` >= 3.2
* `bash --version` >= 3.2 (Does not have to be your default shell.)
* A patched font. Follow instructions at [Lokaltog/vim-powerline/fontpatcher](https://github.com/Lokaltog/vim-powerline/tree/develop/fontpatcher) or [download](https://github.com/Lokaltog/vim-powerline/wiki/Patched-fonts) a new one. However you can use other substitute symbols as well; see `config.sh`.
## Segment Requirements
@@ -62,6 +62,7 @@ Requirements for some segments. You only need to fulfill the requirements for th
* `mailcount.sh` (gmail): wget.
* `ifstat.sh`: ifstat (there is a simpler segment not using ifstat but samples /sys/class/net)
* `tmux_mem_cpu_load.sh`: [tmux-mem-cpu-load](https://github.com/thewtex/tmux-mem-cpu-load)
* `rainbarf.sh`: [rainbarf](https://github.com/creaktive/rainbarf)
* `weather.sh`: GNU `grep` with Perl regexp enabled (FreeBSD specific)
## OS X specific requirements
@@ -73,6 +74,13 @@ The `grep` tool is outdated on OS X 10.8 Mountain Lion so you might have to upgr
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/grep.rb
```
or if you have heightened security set up, just tap the homebrew dupes and install grep
```bash
brew tap homebrew/dupes
brew install homebrew/dupes/grep
```
## FreeBSD specific requirements
Preinstalled `grep` in FreeBSD doesn't support Perl regexp. Solution is rather simple -- you need to use `textproc/gnugrep` port instead. You also need to make sure, that it has support for PCRE and is compiled with `--enable-perl-regexp` flag.
@@ -123,7 +131,7 @@ PS1="$PS1"'$([ -n "$TMUX" ] && tmux setenv TMUXPWD_$(tmux display -p "#D" | tr -
# Configuration
The default segments that are shown are defined in `themes/default.sh`. You will probably want to change those to fit your needs. To do so you can edit that file directly but preferable, for easier updating of the repo, you can make a copy and edit that one (or see how to use custom themes directory below).
The default segments that are shown are defined in `themes/default.sh`. You will probably want to change those to fit your needs. To do so you can edit that file directly but preferable, for easier updating of the repo, you can make a copy and edit that one (or see how to use custom themes directory below). A palette of colors that can be used can be obtained by running the script `color_palette.sh`.
```console
$ cp themes/default.sh themes/mytheme.sh
@@ -146,6 +154,22 @@ Some segments might not work on your system for various reasons such as missing
$ bash -x powerline.sh (left|right)
```
To debug smaller portions of code, say if you think the problem lies in a specific segment, insert these lines at the top and bottom of that file (or region you want to inspect there)
```bash
set -x
exec 2>/tmp/tmux-powerline.log
<code to debug>
set +x
```
and then inspect the outputs like
```console
less /tmp/tmux-powerline.log
tail -f /tmp/tmux-powerline.log # or follow output like this.
```
If you can not solve the problems you can post an [issue](https://github.com/erikw/tmux-powerline/issues?state=open) and be sure to include relevant information about your system and script output (from bash -x) and/or screenshots if needed.
## Common problems
@@ -159,6 +183,8 @@ You have edited `~/.tmux.conf` but no powerline is displayed. This might be beca
```console
$ tmux source-file ~/.tmux.conf
```
### Multiple lines in bash or no powerline in zsh using iTerm (OS X)
If your tmux looks like [this](https://github.com/erikw/tmux-powerline/issues/125) then you may have to in iTerm uncheck [Unicode East Asian Ambiguous characters are wide] in Preferences -> Settings -> Advanced.
# Hacking
+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# Print tmux color palette.
# Idea from http://superuser.com/questions/285381/how-does-the-tmux-color-palette-work
for i in $(seq 0 4 255); do
for j in $(seq $i $(expr $i + 3)); do
for k in $(seq 1 $(expr 3 - ${#j})); do
printf " "
done
printf "\x1b[38;5;${j}mcolour${j}"
[[ $(expr $j % 4) != 3 ]] && printf " "
done
printf "\n"
done
+1 -1
View File
@@ -1,5 +1,5 @@
# Default values for non segment configuration options.
export TMUX_POWERLINE_DEBUG_MODE_ENABLED_DEFAULT="false"
export TMUX_POWERLINE_PATCHED_FONT_IN_USE_DEFAULT="false"
export TMUX_POWERLINE_PATCHED_FONT_IN_USE_DEFAULT="true"
export TMUX_POWERLINE_THEME_DEFAULT="default"
+1 -1
View File
@@ -2,7 +2,7 @@
export TMUX_POWERLINE_DIR_LIB="$TMUX_POWERLINE_DIR_HOME/lib"
export TMUX_POWERLINE_DIR_SEGMENTS="$TMUX_POWERLINE_DIR_HOME/segments"
export TMUX_POWERLINE_DIR_TEMPORARY="/tmp/tmux-powerline"
export TMUX_POWERLINE_DIR_TEMPORARY="/tmp/tmux-powerline_${USER}"
export TMUX_POWERLINE_DIR_THEMES="$TMUX_POWERLINE_DIR_HOME/themes"
export TMUX_POWERLINE_RCFILE="$HOME/.tmux-powerlinerc"
export TMUX_POWERLINE_RCFILE_DEFAULT="$HOME/.tmux-powerlinerc.default"
View File
+8 -6
View File
@@ -9,7 +9,7 @@
# Use patched font symbols.
export TMUX_POWERLINE_PATCHED_FONT_IN_USE="true"
# The theme to use.
export TMUX_POWERLINE_THEME="default"
export TMUX_POWERLINE_THEME="tmux"
# Overlay dirctory to look for themes. There you can put your own themes outside the repo. Fallback will still be the "themes" directory in the repo.
export TMUX_POWERLINE_DIR_USER_THEMES=""
# Overlay dirctory to look for segments. There you can put your own segments outside the repo. Fallback will still be the "segments" directory in the repo.
@@ -24,7 +24,7 @@
# }
# date.sh {
# date(1) format for the date. If you don't, for some reason like ISO 8601 format, you might want to have "%D" or "%m/%d/%Y".
# date(1) format for the date. If you don't, for some reason, like ISO 8601 format you might want to have "%D" or "%m/%d/%Y".
export TMUX_POWERLINE_SEG_DATE_FORMAT="%F"
# }
@@ -46,7 +46,7 @@
# }
# hostname.sh {
# Use short or long format for the hostname. Can be "short, long"
# Use short or long format for the hostname. Can be {"short, long"}.
export TMUX_POWERLINE_SEG_HOSTNAME_FORMAT="short"
# }
@@ -71,15 +71,15 @@
## Maildir
# Path to the maildir to check.
export TMUX_POWERLINE_SEG_MAILCOUNT_MAILDIR_INBOX="/home/xihuitl/.mail/inbox/new"
export TMUX_POWERLINE_SEG_MAILCOUNT_MAILDIR_INBOX="/home/jonnyboy/.mail/inbox/new"
## mbox
# Path to the mbox to check.
export TMUX_POWERLINE_SEG_MAILCOUNT_MBOX_INBOX="/var/mail/xihuitl"
export TMUX_POWERLINE_SEG_MAILCOUNT_MBOX_INBOX="/var/mail/jonnyboy"
# }
# now_playing.sh {
# Music player to use. Can be any of {audacious, banshee, cmus, itunes, lastfm, mocp, mpd, mpd_simple, rdio, rhythmbox, spotify, spotify_wine}.
# Music player to use. Can be any of {audacious, banshee, cmus, itunes, lastfm, mocp, mpd, mpd_simple, pithos, rdio, rhythmbox, spotify, spotify_wine}.
export TMUX_POWERLINE_SEG_NOW_PLAYING_MUSIC_PLAYER=""
# Maximum output length.
export TMUX_POWERLINE_SEG_NOW_PLAYING_MAX_LEN="40"
@@ -92,6 +92,8 @@
export TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_HOST="localhost"
# Port the MPD server is running on.
export TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_PORT="6600"
# Song display format for mpd_simple. See mpc(1) for delimiters.
export TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_SIMPLE_FORMAT="%artist% - %title%"
# Username for Last.fm if that music player is used.
export TMUX_POWERLINE_SEG_NOW_PLAYING_LASTFM_USERNAME=""
+1 -1
View File
@@ -50,9 +50,9 @@ EORC
source "$segment"
if declare -f generate_segmentrc >/dev/null; then
segmentrc=$(generate_segmentrc | sed -e 's/^/\\t/g')
unset -f generate_segmentrc
local seg_name="${segment##*/}"
rccontents="${rccontents}\n\n# ${seg_name} {\n${segmentrc}\n# }"
unset -f generate_segmentrc
fi
done
View File
+2 -2
View File
@@ -5,7 +5,8 @@ export TMUX_POWERLINE_DIR_HOME="$(dirname $0)"
source "${TMUX_POWERLINE_DIR_HOME}/config/helpers.sh"
source "${TMUX_POWERLINE_DIR_HOME}/config/paths.sh"
source "${TMUX_POWERLINE_DIR_HOME}/config/shell.sh"
source "${TMUX_POWERLINE_DIR_HOME}/config/defaults.sh"
source "${TMUX_POWERLINE_DIR_HOME}/config/tmux.sh"
source "${TMUX_POWERLINE_DIR_LIB}/arg_processing.sh"
source "${TMUX_POWERLINE_DIR_LIB}/formatting.sh"
source "${TMUX_POWERLINE_DIR_LIB}/muting.sh"
@@ -15,7 +16,6 @@ source "${TMUX_POWERLINE_DIR_LIB}/rcfile.sh"
# Load our rc file
source "${TMUX_POWERLINE_DIR_LIB}/ourrcfile.sh"
if ! powerline_muted "$1"; then
process_settings
check_arg_side "$1"
View File
View File
+2 -1
View File
@@ -4,7 +4,7 @@ TMUX_POWERLINE_SEG_DATE_FORMAT_DEFAULT="%F"
generate_segmentrc() {
read -d '' rccontents << EORC
# date(1) format for the date. If you don't, for some reason like ISO 8601 format, you might want to have "%D" or "%m/%d/%Y".
# date(1) format for the date. If you don't, for some reason, like ISO 8601 format you might want to have "%D" or "%m/%d/%Y".
export TMUX_POWERLINE_SEG_DATE_FORMAT="${TMUX_POWERLINE_SEG_DATE_FORMAT_DEFAULT}"
EORC
echo "$rccontents"
@@ -17,6 +17,7 @@ __process_settings() {
}
run_segment() {
__process_settings
date +"$TMUX_POWERLINE_SEG_DATE_FORMAT"
return 0
}
View File
View File
+1 -1
View File
@@ -4,7 +4,7 @@ TMUX_POWERLINE_SEG_HOSTNAME_FORMAT_DEFAULT="short"
generate_segmentrc() {
read -d '' rccontents << EORC
# Use short or long format for the hostname. Can be "short, long"
# Use short or long format for the hostname. Can be {"short, long"}.
export TMUX_POWERLINE_SEG_HOSTNAME_FORMAT="${TMUX_POWERLINE_SEG_HOSTNAME_FORMAT_DEFAULT}"
EORC
echo "$rccontents"
+11 -5
View File
@@ -6,22 +6,28 @@ run_segment() {
return 1
fi
data=$(ifstat -S -q 1 1)
sed="sed"
type gsed >/dev/null 2>&1
if [ "$?" -eq 0 ]; then
sed="gsed"
fi
data=$(ifstat -z -S -q 1 1)
interfaces=$(echo -e "${data}" | head -n 1)
flow_data=$(echo -e "${data}" | tail -n 1 | sed "s/\s\{1,\}/,/g")
flow_data=$(echo -e "${data}" | tail -n 1 | ${sed} "s/\s\{1,\}/,/g")
index=1
for inf in ${interfaces}; do
type=""
case ${inf} in
eth*) type=""
eth*) type=""
;;
wlan*) type=""
wlan*) type=""
;;
en*) type=" "
;;
esac
if [ -n "${type}" ]; then
formate=$(echo "${formate} ${type}%.2f %.2f")
formate=$(echo "${formate} %.2f %.2f")
holder=$(echo "${holder},\$$((index)),\$$((index+1))")
fi
index=$((index+2))
View File
View File
View File
+3 -8
View File
@@ -78,7 +78,6 @@ run_segment() {
return $exitcode
fi
if [[ -n "$count" && "$count" -gt 0 ]]; then
echo "${count}"
fi
@@ -97,7 +96,7 @@ __count_gmail() {
local override_passget="false" # When true a force reloaded will be done.
# Create the cache file if it doesn't exist.
if [ ! -f $tmp_file ]; then
if [ ! -f "$tmp_file" ]; then
touch $tmp_file
override_passget=true
fi
@@ -135,7 +134,6 @@ __count_gmail() {
fi
fi
# echo "$(( $(date +"%s") - $(stat -f %m $tmp_file) ))"
count=$(cat $tmp_file)
echo "$count"
return 0;
@@ -165,12 +163,9 @@ __count_mbox() {
# This matches the From_ line (see man 5 mbox) e.g.
# From noreply@github.com Sun Dec 2 03:52:25 2012
# See https://github.com/erikw/tmux-powerline/pull/91#issuecomment-10926053 for discussion.
nbr_new=$(grep -c '^From [^[:space:]]\+ ... ... .. ..:..:.. ....$' ${TMUX_POWERLINE_SEG_MAILCOUNT_MBOX_INBOX})
if [ "${nbr_new}" -gt "0" ]; then
echo "${nbr_new}"
fi
count=$(grep -c '^From [^[:space:]]\+ ... ... .. ..:..:.. ....$' ${TMUX_POWERLINE_SEG_MAILCOUNT_MBOX_INBOX})
echo "$count"
return 0;
}
View File
+29 -17
View File
@@ -8,10 +8,11 @@ TMUX_POWERLINE_SEG_NOW_PLAYING_ROLL_SPEED_DEFAULT="2"
TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_HOST_DEFAULT="localhost"
TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_PORT_DEFAULT="6600"
TMUX_POWERLINE_SEG_NOW_PLAYING_LASTFM_UPDATE_PERIOD_DEFAULT="30"
TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_SIMPLE_FORMAT_DEFAULT="%artist% - %title%"
generate_segmentrc() {
read -d '' rccontents << EORC
# Music player to use. Can be any of {audacious, banshee, cmus, itunes, lastfm, mocp, mpd, mpd_simple, rdio, rhythmbox, spotify, spotify_wine}.
# Music player to use. Can be any of {audacious, banshee, cmus, itunes, lastfm, mocp, mpd, mpd_simple, pithos, rdio, rhythmbox, spotify, spotify_wine}.
export TMUX_POWERLINE_SEG_NOW_PLAYING_MUSIC_PLAYER=""
# Maximum output length.
export TMUX_POWERLINE_SEG_NOW_PLAYING_MAX_LEN="${TMUX_POWERLINE_SEG_NOW_PLAYING_MAX_LEN_DEFAULT}"
@@ -24,6 +25,8 @@ export TMUX_POWERLINE_SEG_NOW_PLAYING_ROLL_SPEED="${TMUX_POWERLINE_SEG_NOW_PLAYI
export TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_HOST="${TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_HOST_DEFAULT}"
# Port the MPD server is running on.
export TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_PORT="${TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_PORT_DEFAULT}"
# Song display format for mpd_simple. See mpc(1) for delimiters.
export TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_SIMPLE_FORMAT="${TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_SIMPLE_FORMAT_DEFAULT}"
# Username for Last.fm if that music player is used.
export TMUX_POWERLINE_SEG_NOW_PLAYING_LASTFM_USERNAME=""
@@ -50,6 +53,7 @@ run_segment() {
"mocp") np=$(__np_mocp) ;;
"mpd") np=$(__np_mpd) ;;
"mpd_simple") np=$(__np_mpd_simple) ;;
"pithos") np=$(__np_pithos) ;;
"rdio") np=$(__np_rdio) ;;
"rhythmbox") np=$(__np_rhythmbox) ;;
"spotify") np=$(__np_spotify) ;;
@@ -92,6 +96,9 @@ __process_settings() {
if [ -z "$TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_PORT" ]; then
export TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_PORT="${TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_PORT_DEFAULT}"
fi
if [ -z "$TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_SIMPLE_FORMAT" ]; then
export TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_SIMPLE_FORMAT="${TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_SIMPLE_FORMAT_DEFAULT}"
fi
if [ -z "$TMUX_POWERLINE_SEG_NOW_PLAYING_LASTFM_UPDATE_PERIOD" ]; then
export TMUX_POWERLINE_SEG_NOW_PLAYING_LASTFM_UPDATE_PERIOD="${TMUX_POWERLINE_SEG_NOW_PLAYING_LASTFM_UPDATE_PERIOD_DEFAULT}"
fi
@@ -112,6 +119,18 @@ __np_mpd() {
echo "$np"
}
__np_mpd_simple() {
np=$(MPD_HOST="$TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_HOST" MPD_PORT="$TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_PORT" mpc current -f "$TMUX_POWERLINE_SEG_NOW_PLAYING_MPD_SIMPLE_FORMAT" 2>&1)
if [ $? -eq 0 ] && [ -n "$np" ]; then
mpc | grep "paused" > /dev/null
if [ $? -eq 0 ]; then
return 1
fi
echo "$np"
fi
}
__np_audacious() {
audacious_pid=$(pidof audacious)
if [ -n "$audacious_pid" ]; then
@@ -168,14 +187,14 @@ __np_lastfm() {
fi
time_now=$(date +%s)
up_to_date=$(echo "(${time_now}-${last_update}) < ${update_period}" | bc)
up_to_date=$(echo "(${time_now}-${last_update}) < ${TMUX_POWERLINE_SEG_NOW_PLAYING_LASTFM_UPDATE_PERIOD}" | bc)
if [ "$up_to_date" -eq 1 ]; then
np=$(cat ${tmp_file})
fi
fi
if [ -z "$np" ]; then
np=$(curl --max-time 2 -s http://ws.audioscrobbler.com/1.0/user/${username}/recenttracks.txt | head -n 1 | sed -e 's/^[0-9]*,//' | sed 's/\xe2\x80\x93/-/')
np=$(curl --max-time 2 -s http://ws.audioscrobbler.com/1.0/user/${TMUX_POWERLINE_SEG_NOW_PLAYING_LASTFM_USERNAME}/recenttracks.txt | head -n 1 | sed -e 's/^[0-9]*,//' | sed 's/\xe2\x80\x93/-/')
if [ "$?" -eq "0" ] && [ -n "$np" ]; then
echo "${np}" > $tmp_file
fi
@@ -183,6 +202,13 @@ __np_lastfm() {
echo "$np"
}
__np_pithos() {
if [ "$(dbus-send --reply-timeout=10 --print-reply --dest=net.kevinmehall.Pithos /net/kevinmehall/Pithos net.kevinmehall.Pithos.IsPlaying 2>/dev/null | grep boolean | cut -d' ' -f5)" == "true" ]; then
np=$(${TMUX_POWERLINE_DIR_SEGMENTS}/np_pithos.py)
echo "$np"
fi
}
__np_mocp() {
mocp_pid=$(pidof mocp)
if [ -n "$mocp_pid" ]; then
@@ -194,20 +220,6 @@ __np_mocp() {
fi
}
# Simple np script for mpd. Works with streams!
# Only tested on OS X... should work the same way on other platforms though.
__np_mpd_simple() {
np=$(mpc current 2>&1)
if [ $? -eq 0 ] && [ -n "$np" ]; then
mpc | grep "paused" > /dev/null
if [ $? -eq 0 ]; then
return 1
fi
echo "$np"
fi
return 1
}
__np_rdio() {
[ ! shell_is_osx ] && return 1
np=$(osascript ${TMUX_POWERLINE_DIR_SEGMENTS}/np_rdio_mac.script)
View File
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env python
import dbus
pithos_bus = dbus.SessionBus()
pithos = pithos_bus.get_object('net.kevinmehall.Pithos', '/net/kevinmehall/Pithos')
props = pithos.get_dbus_method('GetCurrentSong', 'net.kevinmehall.Pithos')
print props()["artist"] + " - " + props()["title"]
View File
View File
View File
+15
View File
@@ -0,0 +1,15 @@
# Print out Memory and CPU using https://github.com/creaktive/rainbarf
run_segment() {
type rainbarf >/dev/null 2>&1
if [ "$?" -ne 0 ]; then
return
fi
# Customize via ~/.rainbarf.conf
stats=$(rainbarf --tmux)
if [ -n "$stats" ]; then
echo "$stats";
fi
return 0
}
+1
View File
@@ -17,6 +17,7 @@ __process_settings() {
}
run_segment() {
__process_settings
date +"$TMUX_POWERLINE_SEG_TIME_FORMAT"
return 0
}
+10 -10
View File
@@ -1,14 +1,14 @@
# Print out Memory, cpu and load using https://github.com/thewtex/tmux-mem-cpu-load
mem_app=bin/./tmux-mem-cpu-load
mem_app=bin/tmux-mem-cpu-load
run_segment() {
type bin/tmux-mem-cpu-load >/dev/null 2>&1
if [ "$?" -ne 0 ]; then
return
fi
type $mem_app >/dev/null 2>&1
if [ "$?" -ne 0 ]; then
return
fi
stats=$($mem_app)
if [ -n "$stats" ]; then
echo "$stats";
fi
return 0
stats=$($mem_app)
if [ -n "$stats" ]; then
echo "$stats";
fi
return 0
}
View File
View File
View File
+2 -1
View File
@@ -4,7 +4,7 @@
source "${TMUX_POWERLINE_DIR_LIB}/tmux_adapter.sh"
branch_symbol="⭠"
git_colour="5"
git_colour="226"
svn_colour="220"
hg_colour="45"
@@ -88,3 +88,4 @@ __parse_hg_branch() {
local branch=$(echo "$summary" | grep 'branch:' | cut -d ' ' -f2)
echo "#[fg=colour${hg_colour}]${branch_symbol} #[fg=colour${TMUX_POWERLINE_CUR_SEGMENT_FG}]${branch}"
}
@@ -88,3 +88,4 @@ __parse_hg_branch() {
local branch=$(echo "$summary" | grep 'branch:' | cut -d ' ' -f2)
echo "#[fg=colour${hg_colour}]${branch_symbol} #[fg=colour${TMUX_POWERLINE_CUR_SEGMENT_FG}]${branch}"
}
View File
@@ -81,3 +81,4 @@ __parse_svn_stats() {
echo "$ret"
}
View File
View File
+1
View File
@@ -48,3 +48,4 @@ __parse_svn_stats(){
fi
}
View File
View File
+97 -98
View File
@@ -1,7 +1,5 @@
# Prints the current weather in Celsius, Fahrenheits or lord Kelvins. The forecast is cached and updated with a period of $update_period.
unit="f"
# The update period in seconds.
update_period=600
@@ -35,7 +33,7 @@ run_segment() {
case "$TMUX_POWERLINE_SEG_WEATHER_DATA_PROVIDER" in
"yahoo") weather=$(__yahoo_weather) ;;
*)
echo "Unknown weahter provider [${$TMUX_POWERLINE_SEG_WEATHER_DATA_PROVIDER}]";
echo "Unknown weather provider [${$TMUX_POWERLINE_SEG_WEATHER_DATA_PROVIDER}]";
return 1
esac
if [ -n "$weather" ]; then
@@ -48,126 +46,127 @@ __process_settings() {
export TMUX_POWERLINE_SEG_WEATHER_DATA_PROVIDER="${TMUX_POWERLINE_SEG_WEATHER_DATA_PROVIDER_DEFAULT}"
fi
if [ -z "$TMUX_POWERLINE_SEG_WEATHER_UNIT" ]; then
export TMUX_POWERLINE_SEG_WEATHER_UNIT="${TMUX_POWERLINE_SEG_WEATHER_UNIT_DEFAULT_DEFAULT}"
export TMUX_POWERLINE_SEG_WEATHER_UNIT="${TMUX_POWERLINE_SEG_WEATHER_UNIT_DEFAULT}"
fi
if [ -z "$TMUX_POWERLINE_SEG_WEATHER_UPDATE_PERIOD" ]; then
export TMUX_POWERLINE_SEG_WEATHER_UPDATE_PERIOD="${TMUX_POWERLINE_SEG_WEATHER_UPDATE_PERIOD_DEFAULT}"
fi
if [ -z "$TMUX_POWERLINE_SEG_WEATHER_LOCATION" ]; then
echo "No weather location specified.";
exit 8
fi
}
__yahoo_weather() {
degree=""
if [ -f "$tmp_file" ]; then
if shell_is_osx || shell_is_bsd; then
last_update=$(stat -f "%m" ${tmp_file})
elif shell_is_linux; then
last_update=$(stat -c "%Y" ${tmp_file})
fi
time_now=$(date +%s)
if shell_is_osx || shell_is_bsd; then
last_update=$(stat -f "%m" ${tmp_file})
elif shell_is_linux; then
last_update=$(stat -c "%Y" ${tmp_file})
fi
time_now=$(date +%s)
up_to_date=$(echo "(${time_now}-${last_update}) < ${update_period}" | bc)
if [ "$up_to_date" -eq 1 ]; then
__read_tmp_file
fi
up_to_date=$(echo "(${time_now}-${last_update}) < ${update_period}" | bc)
if [ "$up_to_date" -eq 1 ]; then
__read_tmp_file
fi
fi
if [ -z "$degree" ]; then
weather_data=$(curl --max-time 4 -s "http://weather.yahooapis.com/forecastrss?w=${TMUX_POWERLINE_SEG_WEATHER_LOCATION}&u=${TMUX_POWERLINE_SEG_WEATHER_UNIT}")
if [ "$?" -eq "0" ]; then
error=$(echo "$weather_data" | grep "problem_cause\|DOCTYPE");
if [ -n "$error" ]; then
echo "error"
exit 1
fi
weather_data=$(curl --max-time 4 -s "http://weather.yahooapis.com/forecastrss?w=${TMUX_POWERLINE_SEG_WEATHER_LOCATION}&u=${TMUX_POWERLINE_SEG_WEATHER_UNIT}")
if [ "$?" -eq "0" ]; then
error=$(echo "$weather_data" | grep "problem_cause\|DOCTYPE");
if [ -n "$error" ]; then
echo "error"
exit 1
fi
# Assume latest grep is in PATH
gnugrep="grep"
if shell_is_bsd; then
# You will need textproc/gnugrep with --enable-perl-regexp and PCRE compiled.
gnugrep="/usr/local/bin/grep"
else
gnugrep="grep"
fi
# <yweather:units temperature="F" distance="mi" pressure="in" speed="mph"/>
unit=$(echo "$weather_data" | "$gnugrep" -PZo "<yweather:units [^<>]*/>" | sed 's/.*temperature="\([^"]*\)".*/\1/')
condition=$(echo "$weather_data" | "$gnugrep" -PZo "<yweather:condition [^<>]*/>")
unit=$(echo "$weather_data" | "$gnugrep" -PZo "<yweather:units [^<>]*/>" | sed 's/.*temperature="\([^"]*\)".*/\1/')
condition=$(echo "$weather_data" | "$gnugrep" -PZo "<yweather:condition [^<>]*/>")
# <yweather:condition text="Clear" code="31" temp="66" date="Mon, 01 Oct 2012 8:00 pm CST" />
degree=$(echo "$condition" | sed 's/.*temp="\([^"]*\)".*/\1/')
condition=$(echo "$condition" | sed 's/.*text="\([^"]*\)".*/\1/')
echo "$degree" > $tmp_file
echo "$condition" >> $tmp_file
elif [ -f "$tmp_file" ]; then
__read_tmp_file
fi
degree=$(echo "$condition" | sed 's/.*temp="\([^"]*\)".*/\1/')
condition=$(echo "$condition" | sed 's/.*text="\([^"]*\)".*/\1/')
# Pull the times for sunrise and sunset so we know when to change the day/night indicator
# <yweather:astronomy sunrise="6:56 am" sunset="6:21 pm"/>
sunrise=$(date -d"$(echo "$weather_data" | "$gnugrep" "yweather:astronomy" | sed 's/^\(.*\)sunset.*/\1/' | sed 's/^.*sunrise="\(.*m\)".*/\1/')" +%H%M)
sunset=$(date -d"$(echo "$weather_data" | "$gnugrep" "yweather:astronomy" | sed 's/^.*sunset="\(.*m\)".*/\1/')" +%H%M)
elif [ -f "${tmp_file}" ]; then
__read_tmp_file
fi
fi
if [ -n "$degree" ]; then
if [ "$TMUX_POWERLINE_SEG_WEATHER_UNIT" == "k" ]; then
degree=$(echo "${degree} + 273.15" | bc)
fi
condition_symbol=$(__get_condition_symbol "$condition")
echo "${condition_symbol} ${degree}°$(echo "$TMUX_POWERLINE_SEG_WEATHER_UNIT" | tr '[:lower:]' '[:upper:]')"
if [ "$TMUX_POWERLINE_SEG_WEATHER_UNIT" == "k" ]; then
degree=$(echo "${degree} + 273.15" | bc)
fi
condition_symbol=$(__get_condition_symbol "$condition" "$sunrise" "$sunset")
echo "${condition_symbol} ${degree}°$(echo "$TMUX_POWERLINE_SEG_WEATHER_UNIT" | tr '[:lower:]' '[:upper:]')" | tee "${tmp_file}"
fi
}
# Get symbol for condition. Available conditions: http://developer.yahoo.com/weather/#codes
__get_condition_symbol() {
local condition=$(echo "$1" | tr '[:upper:]' '[:lower:]')
case "$condition" in
"sunny" | "hot")
hour=$(date +%H)
if [ "$hour" -ge "22" -o "$hour" -le "5" ]; then
#echo "☽"
echo "☾"
else
#echo "☀"
echo "☼"
fi
;;
"rain" | "mixed rain and snow" | "mixed rain and sleet" | "freezing drizzle" | "drizzle" | "light drizzle" | "freezing rain" | "showers" | "mixed rain and hail" | "scattered showers" | "isolated thundershowers" | "thundershowers" | "light rain with thunder" | "light rain")
#echo "☂"
echo "☔"
;;
"snow" | "mixed snow and sleet" | "snow flurries" | "light snow showers" | "blowing snow" | "sleet" | "hail" | "heavy snow" | "scattered snow showers" | "snow showers" | "light snow" | "snow/windy" | "snow grains")
#echo "☃"
echo "❅"
;;
"cloudy" | "mostly cloudy" | "partly cloudy" | "partly cloudy/windy")
echo "☁"
;;
"tornado" | "tropical storm" | "hurricane" | "severe thunderstorms" | "thunderstorms" | "isolated thunderstorms" | "scattered thunderstorms")
#echo "⚡"
echo "☈"
;;
"dust" | "foggy" | "fog" | "haze" | "smoky" | "blustery" | "mist")
#echo "♨"
#echo "﹌"
echo "〰"
;;
"windy" | "fair/windy")
#echo "⚐"
echo "⚑"
;;
"clear" | "fair" | "cold")
hour=$(date +%H)
if [ "$hour" -ge "22" -o "$hour" -le "5" ]; then
echo "☾"
else
echo ""
fi
;;
*)
echo "?"
;;
esac
local condition=$(echo "$1" | tr '[:upper:]' '[:lower:]')
local sunrise="$2"
local sunset="$3"
case "$condition" in
"sunny" | "hot")
hourmin=$(date +%H%M)
if [ "$hourmin" -ge "$sunset" -o "$hourmin" -le "$sunrise" ]; then
#echo "☽"
echo "☾"
else
#echo "☀"
echo "☼"
fi
;;
"rain" | "mixed rain and snow" | "mixed rain and sleet" | "freezing drizzle" | "drizzle" | "light drizzle" | "freezing rain" | "showers" | "mixed rain and hail" | "scattered showers" | "isolated thundershowers" | "thundershowers" | "light rain with thunder" | "light rain" | "rain and snow")
#echo "☂"
echo "☔"
;;
"snow" | "mixed snow and sleet" | "snow flurries" | "light snow showers" | "blowing snow" | "sleet" | "hail" | "heavy snow" | "scattered snow showers" | "snow showers" | "light snow" | "snow/windy" | "snow grains" | "snow/fog")
#echo "☃"
echo "❅"
;;
"cloudy" | "mostly cloudy" | "partly cloudy" | "partly cloudy/windy")
echo "☁"
;;
"tornado" | "tropical storm" | "hurricane" | "severe thunderstorms" | "thunderstorms" | "isolated thunderstorms" | "scattered thunderstorms")
#echo "⚡"
echo "☈"
;;
"dust" | "foggy" | "fog" | "haze" | "smoky" | "blustery" | "mist")
#echo "♨"
#echo "﹌"
echo "〰"
;;
"windy" | "fair/windy")
#echo "⚐"
echo "⚑"
;;
"clear" | "fair" | "cold")
hourmin=$(date +%H%M)
if [ "$hourmin" -ge "$sunset" -o "$hourmin" -le "$sunrise" ]; then
echo ""
else
echo ""
fi
;;
*)
echo "?"
;;
esac
}
__read_tmp_file() {
if [ ! -f "$tmp_file" ]; then
return
fi
IFS_bak="$IFS"
IFS=$'\n'
lines=($(cat ${tmp_file}))
IFS="$IFS_bak"
degree="${lines[0]}"
condition="${lines[1]}"
if [ ! -f "$tmp_file" ]; then
return
fi
cat "${tmp_file}"
exit
}
View File
+1 -1
View File
@@ -1 +1 @@
default.sh
tmux.sh
@@ -23,21 +23,19 @@ TMUX_POWERLINE_DEFAULT_RIGHTSIDE_SEPARATOR=${TMUX_POWERLINE_DEFAULT_RIGHTSIDE_SE
if [ -z $TMUX_POWERLINE_LEFT_STATUS_SEGMENTS ]; then
TMUX_POWERLINE_LEFT_STATUS_SEGMENTS=(
"tmux_session_info 14 234" \
#"hostname 13 128" \
"ifstat 12 255" \
"tmux_session_info 148 234" \
#"hostname 33 0" \
"ifstat 30 255" \
#"ifstat_sys 30 255" \
#"lan_ip 24 255 ${TMUX_POWERLINE_SEPARATOR_RIGHT_THIN}" \
#"wan_ip 24 255" \
"vcs_branch_NN 6 235" \
"vcs_revision 229 0" \
#"vcs_compare_NN 60 255" \
"vcs_branch_NN 29 88" \
"vcs_revision 229 0" \
#"vcs_compare_NN 60 255" \
"vcs_branch 28 235" \
"vcs_compare 60 255" \
#"vcs_compare_NN 60 255" \
#"vcs_staged 64 255" \
#"vcs_modified 9 255" \
#"vcs_revision 245 0" \
#"vcs_others 245 0" \
)
fi
@@ -49,14 +47,15 @@ if [ -z $TMUX_POWERLINE_RIGHT_STATUS_SEGMENTS ]; then
#"mailcount 9 255" \
#"now_playing 234 37" \
#"cpu 240 136" \
#"load 33 148" \
"uptime 9 255" \
#"load 237 167" \
"uptime 9 255" \
"tmux_mem_cpu_load 33 148" \
#"battery 137 127" \
#"weather 37 255" \
#"rainbarf 0 0" \
#"xkb_layout 125 117" \
#"date_day 148 234 ${TMUX_POWERLINE_SEPARATOR_LEFT_THIN}" \
"date 148 234" \
#"date_day 235 136" \
"date 234 148" \
"time 148 234" \
#"utc_time 235 136 ${TMUX_POWERLINE_SEPARATOR_LEFT_THIN}" \
)
+3 -1
View File
@@ -12,6 +12,7 @@ set -g default-terminal "screen-256color"
set-option -g status on
set-option -g status-interval 2
set-option -g status-utf8 on
set -g status-bg black
set -g status-fg white
@@ -32,7 +33,7 @@ set-window-option -g window-status-current-format "#[fg=colour235, bg=colour27]
set-window-option -g window-status-format "#[fg=colour255, bg=colour27]#[fg=colour255, bg=colour27] #I ⮁ #W #[fg=colour27, bg=colour255]"
#reduce memory and scrollback buffer
set -g history-limit 100
set -g history-limit 200
## Mouse Settings ##
#mouse - allows selct pane and resize with mouse
@@ -55,3 +56,4 @@ bind M \
set -g mouse-select-window off \;\
display 'Mouse: OFF'
+3 -3
View File
@@ -86,9 +86,9 @@ else
echo "password=$DB_PASSWORD" >> ./conf/my.cnf
chmod 600 ./conf/my.cnf
#create powerline default.sh
if [ ! -f "powerline/powerline/themes/default.sh" ]; then
cp powerline/powerline/themes/default.start.sh powerline/powerline/themes/default.sh
#create powerline tmux.sh
if [ ! -f "powerline/powerline/themes/tmux.sh" ]; then
cp powerline/powerline/themes/default.sh powerline/powerline/themes/tmux.sh
fi
#Get the path to tmpunrar