diff --git a/.gitignore b/.gitignore
index 73ea3acbe..255751113 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,2 @@
fix.sh
defaults.sh
-commit.sh
diff --git a/README.md b/README.md
index e10601a74..c979aa2a2 100644
--- a/README.md
+++ b/README.md
@@ -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 @@

+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
@@ -169,4 +195,4 @@ If you want to (of course you do!) send a pull request for a cool segment you wr
Usage of helper function to organize the work of a segment is encourage and should be named in the format `__helper_func`. If a segment has settings it should have a function `generate_rc` which outputs default values of all settings and a short explanation of the setting and its values. Study e.g. `segments/now_playing.sh` to see how it is done. A segment having settings should typically call a helper function `__process_settings` as the first statement in `run_segment` that sets default values to the settings that has not been set by the user.
-Also, don't use bash4 features as requiring bash4 complicates installation for OS X user quite a bit. Use tabs for indentation ([discussion](https://github.com/erikw/tmux-powerline/pull/92)),
+Also, don't use bash4 features as requiring bash4 complicates installation for OS X user quite a bit. Use tabs for indentation ([discussion](https://github.com/erikw/tmux-powerline/pull/92)),
diff --git a/powerline/powerline/color_palette.sh b/powerline/powerline/color_palette.sh
new file mode 100755
index 000000000..3762faed1
--- /dev/null
+++ b/powerline/powerline/color_palette.sh
@@ -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
diff --git a/powerline/powerline/config/defaults.sh b/powerline/powerline/config/defaults.sh
index c98c4fb07..bc79496b8 100644
--- a/powerline/powerline/config/defaults.sh
+++ b/powerline/powerline/config/defaults.sh
@@ -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"
diff --git a/powerline/powerline/config/paths.sh b/powerline/powerline/config/paths.sh
index 866fadd78..bf72be34e 100644
--- a/powerline/powerline/config/paths.sh
+++ b/powerline/powerline/config/paths.sh
@@ -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"
diff --git a/powerline/powerline/generate_rc.sh b/powerline/powerline/generate_rc.sh
old mode 100644
new mode 100755
diff --git a/powerline/powerline/lib/ourrcfile.sh b/powerline/powerline/lib/ourrcfile.sh
index 9532f9811..d9361b19d 100644
--- a/powerline/powerline/lib/ourrcfile.sh
+++ b/powerline/powerline/lib/ourrcfile.sh
@@ -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=""
diff --git a/powerline/powerline/lib/rcfile.sh b/powerline/powerline/lib/rcfile.sh
index 32e4b26bc..db88198fe 100644
--- a/powerline/powerline/lib/rcfile.sh
+++ b/powerline/powerline/lib/rcfile.sh
@@ -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
diff --git a/powerline/powerline/mute_powerline.sh b/powerline/powerline/mute_powerline.sh
old mode 100644
new mode 100755
diff --git a/powerline/powerline/powerline.sh b/powerline/powerline/powerline.sh
index c20ed7501..7e11aa927 100755
--- a/powerline/powerline/powerline.sh
+++ b/powerline/powerline/powerline.sh
@@ -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"
diff --git a/powerline/powerline/segments/battery.sh b/powerline/powerline/segments/battery.sh
old mode 100644
new mode 100755
diff --git a/powerline/powerline/segments/cpu.sh b/powerline/powerline/segments/cpu.sh
old mode 100644
new mode 100755
diff --git a/powerline/powerline/segments/date.sh b/powerline/powerline/segments/date.sh
old mode 100644
new mode 100755
index 073832954..32263d52c
--- a/powerline/powerline/segments/date.sh
+++ b/powerline/powerline/segments/date.sh
@@ -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
}
diff --git a/powerline/powerline/segments/date_day.sh b/powerline/powerline/segments/date_day.sh
old mode 100644
new mode 100755
diff --git a/powerline/powerline/segments/earthquake.sh b/powerline/powerline/segments/earthquake.sh
old mode 100644
new mode 100755
diff --git a/powerline/powerline/segments/hostname.sh b/powerline/powerline/segments/hostname.sh
old mode 100644
new mode 100755
index 0b8a2f339..c3dfbf9c0
--- a/powerline/powerline/segments/hostname.sh
+++ b/powerline/powerline/segments/hostname.sh
@@ -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"
diff --git a/powerline/powerline/segments/ifstat.sh b/powerline/powerline/segments/ifstat.sh
old mode 100644
new mode 100755
index 5b249ce7c..3331ba8b9
--- a/powerline/powerline/segments/ifstat.sh
+++ b/powerline/powerline/segments/ifstat.sh
@@ -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))
diff --git a/powerline/powerline/segments/ifstat_sys.sh b/powerline/powerline/segments/ifstat_sys.sh
old mode 100644
new mode 100755
diff --git a/powerline/powerline/segments/lan_ip.sh b/powerline/powerline/segments/lan_ip.sh
old mode 100644
new mode 100755
diff --git a/powerline/powerline/segments/load.sh b/powerline/powerline/segments/load.sh
old mode 100644
new mode 100755
diff --git a/powerline/powerline/segments/mailcount.sh b/powerline/powerline/segments/mailcount.sh
old mode 100644
new mode 100755
index aa1b81d23..d210b2719
--- a/powerline/powerline/segments/mailcount.sh
+++ b/powerline/powerline/segments/mailcount.sh
@@ -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;
}
diff --git a/powerline/powerline/segments/mailcount_apple_mail.script b/powerline/powerline/segments/mailcount_apple_mail.script
old mode 100644
new mode 100755
diff --git a/powerline/powerline/segments/now_playing.sh b/powerline/powerline/segments/now_playing.sh
old mode 100644
new mode 100755
index 34fe9b799..4c68edc29
--- a/powerline/powerline/segments/now_playing.sh
+++ b/powerline/powerline/segments/now_playing.sh
@@ -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)
diff --git a/powerline/powerline/segments/np_itunes.script b/powerline/powerline/segments/np_itunes.script
old mode 100644
new mode 100755
diff --git a/powerline/powerline/segments/np_pithos.py b/powerline/powerline/segments/np_pithos.py
new file mode 100755
index 000000000..9d022e600
--- /dev/null
+++ b/powerline/powerline/segments/np_pithos.py
@@ -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"]
diff --git a/powerline/powerline/segments/np_rdio_mac.script b/powerline/powerline/segments/np_rdio_mac.script
old mode 100644
new mode 100755
diff --git a/powerline/powerline/segments/np_spotify_mac.script b/powerline/powerline/segments/np_spotify_mac.script
old mode 100644
new mode 100755
diff --git a/powerline/powerline/segments/pwd.sh b/powerline/powerline/segments/pwd.sh
old mode 100644
new mode 100755
diff --git a/powerline/powerline/segments/rainbarf.sh b/powerline/powerline/segments/rainbarf.sh
new file mode 100755
index 000000000..a9c6c1f88
--- /dev/null
+++ b/powerline/powerline/segments/rainbarf.sh
@@ -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
+}
diff --git a/powerline/powerline/segments/time.sh b/powerline/powerline/segments/time.sh
old mode 100644
new mode 100755
index 6e34d36c1..e307399ec
--- a/powerline/powerline/segments/time.sh
+++ b/powerline/powerline/segments/time.sh
@@ -17,6 +17,7 @@ __process_settings() {
}
run_segment() {
+ __process_settings
date +"$TMUX_POWERLINE_SEG_TIME_FORMAT"
return 0
}
diff --git a/powerline/powerline/segments/tmux_mem_cpu_load.sh b/powerline/powerline/segments/tmux_mem_cpu_load.sh
old mode 100644
new mode 100755
index ccb51a8de..92bc1be65
--- a/powerline/powerline/segments/tmux_mem_cpu_load.sh
+++ b/powerline/powerline/segments/tmux_mem_cpu_load.sh
@@ -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
}
diff --git a/powerline/powerline/segments/tmux_session_info.sh b/powerline/powerline/segments/tmux_session_info.sh
old mode 100644
new mode 100755
diff --git a/powerline/powerline/segments/uptime.sh b/powerline/powerline/segments/uptime.sh
old mode 100644
new mode 100755
diff --git a/powerline/powerline/segments/utc_time.sh b/powerline/powerline/segments/utc_time.sh
old mode 100644
new mode 100755
diff --git a/powerline/powerline/segments/vcs_branch.sh b/powerline/powerline/segments/vcs_branch.sh
old mode 100644
new mode 100755
index f8d973d96..496e42272
--- a/powerline/powerline/segments/vcs_branch.sh
+++ b/powerline/powerline/segments/vcs_branch.sh
@@ -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}"
}
+
diff --git a/powerline/powerline/segments/vcs_branch_NN.sh b/powerline/powerline/segments/vcs_branch_NN.sh
index d767b2f3f..f447b6d77 100644
--- a/powerline/powerline/segments/vcs_branch_NN.sh
+++ b/powerline/powerline/segments/vcs_branch_NN.sh
@@ -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}"
}
+
diff --git a/powerline/powerline/segments/vcs_compare.sh b/powerline/powerline/segments/vcs_compare.sh
old mode 100644
new mode 100755
diff --git a/powerline/powerline/segments/vcs_compare_NN.sh b/powerline/powerline/segments/vcs_compare_NN.sh
index 59c7041a7..b8c2f9c29 100644
--- a/powerline/powerline/segments/vcs_compare_NN.sh
+++ b/powerline/powerline/segments/vcs_compare_NN.sh
@@ -73,7 +73,7 @@ __parse_svn_stats() {
local svn_ref=$(echo "${svn_info}" | sed -ne 's#^Revision: ##p')
REVISION=`svn info svn://svn.newznab.com/nn/branches/nnplus |grep '^Revision:' | sed -e 's/^Revision: //'`
-
+
if [[ $REVISION -gt 0 ]] ; then
behind=($REVISION-$svn_ref)
local ret="↓ $behind"
@@ -81,3 +81,4 @@ __parse_svn_stats() {
echo "$ret"
}
+
diff --git a/powerline/powerline/segments/vcs_modified.sh b/powerline/powerline/segments/vcs_modified.sh
old mode 100644
new mode 100755
diff --git a/powerline/powerline/segments/vcs_others.sh b/powerline/powerline/segments/vcs_others.sh
old mode 100644
new mode 100755
diff --git a/powerline/powerline/segments/vcs_revision.sh b/powerline/powerline/segments/vcs_revision.sh
old mode 100644
new mode 100755
index 861d5c470..aa563f573
--- a/powerline/powerline/segments/vcs_revision.sh
+++ b/powerline/powerline/segments/vcs_revision.sh
@@ -48,3 +48,4 @@ __parse_svn_stats(){
fi
}
+
diff --git a/powerline/powerline/segments/vcs_staged.sh b/powerline/powerline/segments/vcs_staged.sh
old mode 100644
new mode 100755
diff --git a/powerline/powerline/segments/wan_ip.sh b/powerline/powerline/segments/wan_ip.sh
old mode 100644
new mode 100755
diff --git a/powerline/powerline/segments/weather.sh b/powerline/powerline/segments/weather.sh
old mode 100644
new mode 100755
index 526bdcf53..95c0a43bd
--- a/powerline/powerline/segments/weather.sh
+++ b/powerline/powerline/segments/weather.sh
@@ -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
#
- unit=$(echo "$weather_data" | "$gnugrep" -PZo "]*/>" | sed 's/.*temperature="\([^"]*\)".*/\1/')
- condition=$(echo "$weather_data" | "$gnugrep" -PZo "]*/>")
+ unit=$(echo "$weather_data" | "$gnugrep" -PZo "]*/>" | sed 's/.*temperature="\([^"]*\)".*/\1/')
+ condition=$(echo "$weather_data" | "$gnugrep" -PZo "]*/>")
#
- 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
+ #
+ 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
}
diff --git a/powerline/powerline/segments/xkb_layout.sh b/powerline/powerline/segments/xkb_layout.sh
old mode 100644
new mode 100755
diff --git a/powerline/powerline/themes/.gitignore b/powerline/powerline/themes/.gitignore
index e1f8bda2b..c512f07a8 100644
--- a/powerline/powerline/themes/.gitignore
+++ b/powerline/powerline/themes/.gitignore
@@ -1 +1 @@
-default.sh
+tmux.sh
diff --git a/powerline/powerline/themes/default.start.sh b/powerline/powerline/themes/default.sh
similarity index 79%
rename from powerline/powerline/themes/default.start.sh
rename to powerline/powerline/themes/default.sh
index 45f29ac06..f67f96fa9 100644
--- a/powerline/powerline/themes/default.start.sh
+++ b/powerline/powerline/themes/default.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}" \
)
diff --git a/powerline/tmux.conf b/powerline/tmux.conf
index 8e3fc7f7c..d57260dd2 100644
--- a/powerline/tmux.conf
+++ b/powerline/tmux.conf
@@ -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'
+
diff --git a/start.sh b/start.sh
index 9a4568c10..95f7cfa2b 100755
--- a/start.sh
+++ b/start.sh
@@ -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