Giter Site home page Giter Site logo

erikw / tmux-powerline Goto Github PK

View Code? Open in Web Editor NEW
3.3K 70.0 507.0 1.22 MB

⚡️ A tmux plugin giving you a hackable status bar consisting of dynamic & beautiful looking powerline segments, written purely in bash.

License: BSD 3-Clause "New" or "Revised" License

Shell 93.46% Makefile 0.27% AppleScript 2.04% C 4.05% Python 0.18%
tmux-powerline tmux powerline statusbar segments configuration hacktoberfest bash dynamic shell

tmux-powerline's Issues

Implement themes for tmux-powerline

I was wondering, why don't you mix some of your segments into themes? You know, tmux-powerline could work as a framework, and you can hold them on your repo. They could work as examples or starting point for cool powerline :)

Segment max length

An attribute that specifies the maximum output length to display. And maybe a global option setting the default max?

Network monitor

A segment showing network usage statistics would be handy. Use ntop or iftop?

IMAP

A segment that gives the the new mail count from a GMail account or even better IMAP.

Cycle themes

Just an idea, since we have themes now maybe we could add support for cycle through the available themes found. E.g. I would usually us the theme default.sh but now I'm going to to some coding so I want to use the theme coding.sh which has segments like vcs_* that are relevant.

More music players

While MPD is the best music player around not everyone has realized it yet. So support some more common players e.g. moc, Clementine, Nightingale, iTunes, Spotify.

Refactor np_*.sh

They share much common functionality. Break out the common stuff like trimming and rolling.

Segment update time

Maybe each segment should have an attribute update_period on how often it should be updated or next_update specifying the next time the script should be run again.

Print Working Directory Segment Not Working

I'm trying to get the working directory segment (pwd.sh) to work but it is refusing with tmux 1.6. Nothing related to the working directory appears in the right status bar.

Here are the relevant bits. If any more info is needed please let me know.

$ bash ~/.tmux/tmux-powerline/status-right.sh 
/Users/dylan/.tmux/tmux-powerline/status-right.sh: line 33: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
/Users/dylan/.tmux/tmux-powerline/status-right.sh: line 52: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
/Users/dylan/.tmux/tmux-powerline/status-right.sh: line 59: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
/Users/dylan/.tmux/tmux-powerline/status-right.sh: line 66: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
/Users/dylan/.tmux/tmux-powerline/status-right.sh: line 77: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
/Users/dylan/.tmux/tmux-powerline/status-right.sh: line 84: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
/Users/dylan/.tmux/tmux-powerline/status-right.sh: line 93: declare: -A: invalid optiondeclare: usage: declare [-afFirtx] [-p] [name[=value] ...]
/Users/dylan/.tmux/tmux-powerline/status-right.sh: line 100: declare: -A: invalid optiondeclare: usage: declare [-afFirtx] [-p] [name[=value] ...]
/Users/dylan/.tmux/tmux-powerline/status-right.sh: line 108: declare: -A: invalid optiondeclare: usage: declare [-afFirtx] [-p] [name[=value] ...]
/Users/dylan/.tmux/tmux-powerline/lib.sh: line 42: /Users/dylan/.tmux/tmux-powerline/segments/pwd.shcolour211colour89⮂: No such file or directory
/Users/dylan/.tmux/tmux-powerline/lib.sh: line 33: /Users/dylan/.tmux/tmux-powerline/segments/pwd.shcolour211colour89⮂: syntax error: operand expected (error token is "/Users/dylan/.tmux/tmux-powerline/segments/pwd.shcolour211colour89⮂")
/Users/dylan/.tmux/tmux-powerline/lib.sh: line 34: /Users/dylan/.tmux/tmux-powerline/segments/pwd.shcolour211colour89⮂: syntax error: operand expected (error token is "/Users/dylan/.tmux/tmux-powerline/segments/pwd.shcolour211colour89⮂")/Users/dylan/.tmux/tmux-powerline/lib.sh: line 35: /Users/dylan/.tmux/tmux-powerline/segments/pwd.shcolour211colour89⮂: syntax error: operand expected (error token is "/Users/dylan/.tmux/tmux-powerline/segments/pwd.shcolour211colour89⮂")/Users/dylan/.tmux/tmux-powerline/lib.sh: line 36: /Users/dylan/.tmux/tmux-powerline/segments/pwd.shcolour211colour89⮂: syntax error: operand expected (error token is "/Users/dylan/.tmux/tmux-powerline/segments/pwd.shcolour211colour89⮂")
$ bash ~/.tmux/tmux-powerline/segments/pwd.sh 
usage: grep [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
        [-e pattern] [-f file] [--binary-files=value] [--color=when]
        [--context[=num]] [--directories=action] [--label] [--line-buffered]
        [--null] [pattern] [file ...]
$ echo $PS1
\h:\W \u\$ $([ -n "$TMUX" ] && tmux setenv TMUXPWD_$(tmux display -p "#I_#P") "$PWD")

Patched Font Glyphs do not appear on the Tmux Powerline.

Issue: I do not see the Glyphs in the tmux powerline :-

Imgur

OS: Mac OS X 10.7.4
Terminal Application: iTerm 2

>> tmux -V
tmux 1.6

>> bash --version
GNU bash, version 4.2.37(2)-release (i386-apple-darwin11.2.0)

>> zsh --version
zsh 5.0.0 (x86_64-apple-darwin11.2.0)

>> ./status-left.sh 
#[bg=colour148] #[fg=colour148, bg=colour148]#[fg=colour234,bg=colour148]0:1.1 #[fg=colour148, bg=colour33]⮀#    
[fg=colour0,bg=colour33]   ilab #[fg=colour33, bg=colour24]⮀#[fg=colour255,bg=colour24]   ⓛ 10.50.203.149   #[fg=white,   
bg=colour24]⮁#[fg=colour255,bg=colour24]   ⓦ 212.201.44.246   #[fg=colour24, bg=colour235]⮀#[fg=red,bg=colour235]   #
[default]

>> ./status-right.sh
#[fg=colour237, bg=colour235]⮂#[fg=colour167,bg=colour237]    0.65 0.84 0.86 #[fg=colour37, bg=colour237]⮂#  
[fg=colour255,bg=colour37]   ✈ 26°C    #[fg=colour235, bg=colour37]⮂#[fg=colour136,bg=colour235]   Sat #[fg=default,   
bg=colour235]⮃#[fg=colour136,bg=colour235]   2012-07-28 #[fg=default, bg=colour235]⮃#[fg=colour136,bg=colour235]   14:07  
#[default]

My tmux configuration:

# split panes
bind | split-window -h
bind - split-window -v

# resize panes
bind -r h resize-pane -L 5
bind -r j resize-pane -D 5
bind -r k resize-pane -U 5
bind -r l resize-pane -R 5

# enable 256-colors
set -g default-terminal "screen-256color"

# enable utf-8 on status bar
set -g status on
set -g status-utf8 on

# status refresh interval
set -g status-interval 2

# status left
set -g status-left-length 60
set -g status-left "#(~/.tmux/tmux-powerline/status-left.sh)"

# status right
set -g status-right-length 90
set -g status-right "#(~/.tmux/tmux-powerline/status-right.sh)"

# solarized theme
source ~/.tmux/tmux-colors-solarized/tmuxcolors.conf

# window and pane start index
set -g base-index 1
set -g pane-base-index 1

# center the window list
set -g status-justify centre

# vi mode for the buffer
setw -g mode-keys vi

# command sequence for nested tmux session
bind-key a send-prefix

# remap prefix to ctrl-a
set -g prefix C-a

I am using a patched Ubuntu Mono font. I previously tried using the patched font available for download from the vim-powerline wiki page, but then I also tried patching it myself, but to no avail.

I personally do not see that the patched font is the issue, since running the scripts independently do produce the glyphs, they just don't appear on the tmux status line for some reason.

Google Weather API Rejecting Queries

Hello,

The Google weather API in use has decided I've hit my rate limit for weather queries. My powerline stopped displaying so I ran the scripts standalone; the following was pulled from the output of that:

We're sorry...

... but your computer or network may be sending automated queries. To protect our users, we can't process your request right now.

See Google Help for more information.

So sad...any ideas? For now, commenting out the line that curls allows the scripts to run and display in tmux, but I totally loved the weather feature...

Need a failsafe mode

Right now all the scripts will disappear or printing out some weird text when it fails, I would like to see a failsafe mode for each segment so it will at least display some text to indicate error but not some weird text or completely disappear from existence, or it would be quite difficult and annoying to find some script not working sometimes and didn't know where it went

wan_ip segment needs bc package

Something to add to the docs - the wan_ip segment script requires the bc package, which wasn't installed on my Ubuntu box by default.

Weather segment broken on Mac OS 10.7

According to @tommyolofsson the weather segment spawmed several new processes and opened several new files on Mac OS 10.7.

Pulled this from original author. Depleted resources - got loads of 'unable to fork' and 'too many open files'. Fucked. Shit. Up. (osx lion)

This bug was introduced by merge 4b14bb7.

In the meantime, anyone affected by this issue should checkout 490e8ab

git checkout 490e8ab

Anyone got time to debug with Mac OS 10.7?

Background on last separator wrong?

http://ompldr.org/vZ2t3ZA

I just got this set up and it looks like the background on the very last separator is wrong, which messes up something fierce with transparency enabled.

I don't always use transparency, but even when it's not enabled the background would be grey instead of black. I looked at it real quick but didn't really have enough time to work with anything. Anybody else with the same issue or know how I can fix it? Thanks!

Way to toggle powerline

Sometime we just want to get in the "zone" and leave the distractions at the door, we can do a simple:

bind S set-option -g status

but what if we have multiple tabs? We lose that valuable information, so what I propose is to find a way to disable only the scripts.

Bug in Lib Function

Hey there,

There is a bug in get_tmux_cwd() in lib.sh on OS X with tmux 1.7. The line that tries to get the current pane seems to be using the incorrect format specifier, "#D".

local env_name=$(tmux display -p "TMUXPWD_#D" | tr -d %)

In the man-page for tmux(1) it claims that "#D" is the pane unique ID however tmux show-environment doesn't have the ID. I propose that it is changed to use the "#I" and "#S" specifier so the window and pane can string can be constructed. Please see the following output to support this.

$ tmux -V
tmux 1.7
$ tmux display -p "TMUXPWD_#D"
TMUXPWD_%4
$ tmux show-environment
-DISPLAY
-SSH_AGENT_PID
-SSH_ASKPASS
SSH_AUTH_SOCK=/tmp/launch-4qmuFe/Listeners
-SSH_CONNECTION
TMUXPWD_0_0=/Users/dylan
TMUXPWD_1_0=/Users/dylan
TMUXPWD_2_0=/Users/dylan/Projects
TMUXPWD_3_0=/Users/dylan/Projects
-WINDOWID
-XAUTHORITY
$ tmux display -p "TMUXPWD_#I_#S"
TMUXPWD_3_0

Any objections?

Rewrite UI lib

The implementation of the printing functions are a bit fragile. Re-do it!

disappears if status-left-length/right too wide

when i had the config as you listed in my .tmux.conf, nothing showed up. you were showing an example, however i think it might be better to find a fairly universal environment variable to determine the area things are displayed in.(possibly $COLUMNS is universal enough?)

btw, it now works for me, but if you need to recreate me not seeing anything in the status with the 60/90, i'm running debian stable xmonad (mainly from cabal but parts from apt), rxvt-unicode (deb).

We're sorry... - google weather

"... but your computer or network may be sending automated queries. To protect our users, we can't process your request right now"

It would be cool if there was a choice of weather services.

weather.sh error'd

google has changed their url for weather (i guess?) and the script spits out html:

ï¼ <title>Sorry...</title><style> body { font-family: verdana, arial, sans-serif; background-color: #fff; color: #000; }</style>

Google
Sorry...

We're sorry...

... but your computer or network may be sending automated queries. To protect our users, we can't process your request right now.

See Google Help for more information.

© 2009 Google - Google Home
°C

(this is with the default location and temperature setting)

Powerline did not show when use ZSH.

I am using Z-Shell and followed the README instruction to config the Tmux-powerline.

I changed config.sh => PLATFORM="mac", used Patched font to true.

Other files remain the same, it did not work.

I changed absolute path of cwd instead of variable in status-left.sh file, and it still did not work.

I installed the fontpatcher and patch font for my ternimal, and it stilll did not work.

Did I do anything wrong or miss any steps?

Tried google search and still no answers. Please, help. Thanks.

List of dependencies

It would simplify the installation process if all dependencies, including those of the segments, were listed in the README file.
Segment wan_ip is dependent on curl.

Weather bug

I've seen, on an alien system, than the parsing of the weather data failed. Investigate when it happens again.

Strange output from/with segments not producing output.

If a segment does not produce any output nothing is to be printed. However it the segments vcs_compare.sh or vcs_staged.sh does not have anything to output (which they don't) it looks like this (brown segment after vcs_branch should not exist.

scrnsht

exited with code 127

For some reason my right status bar always aborted with code 127
I'm running on lastet Mountain lion, installed the latest bash from brew, and using zsh.

And if I run the script individually with bash, it shows no error message

segments/mail_count_gmail.sh: line 48: 1350230809 - : syntax error: operand expected (error token is "- ")

Hey tmux-powerline devs, thanks for making this possible, I can't believe there is a powerline for tmux already when I tried tmux, this is a wonderful news for me, however there are some issues for some segments that causes other segments not showing at all, I think this has to be fixed sooner or later.

Anyway, I found out that my gmail count is acting bad, so I pull it out and execute with bash -x and here is the log produced from the command (usename is cleared)

+ username=
+ password=
+ server=gmail.com
+ interval=5
+ tmp_file=/tmp/tmux-powerline_gmail_count.txt
+ override=false
+ '[' '!' -f /tmp/tmux-powerline_gmail_count.txt ']'
+ let 'interval=60*5'
+ '[' '' == mac ']'
++ stat -c %Y /tmp/tmux-powerline_gmail_count.txt
stat: illegal option -- c
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
+ last_update=
++ date +%s
segments/mail_count_gmail.sh: line 48: 1350230809 -  : syntax error: operand expected (error token is "-  ")
+ let 'interval=300*60'
++ cat /tmp/tmux-powerline_gmail_count.txt
+ mailcount=
+ echo '✉ '
✉ 
+ exit 0

I have no idea what the hell happened.

License

The project should be governed by a permissible license so people know that they can steal the code any way they want, pretty much :P What to use? Plain old BSD?

Add support for Powerline (Python port)

I'm the author of Powerline for vim, and I'm currently working on a Python port of Powerline's functionality for usage in other applications like shell prompts and tmux statuslines. The Python port aims to create a common code base for all Powerline-based projects so we don't have to reinvent the wheel every time someone wants to have a fancy statusline in their project.

The current Python port is located at Lokaltog/powerline. All the common Python code is stable and I'm using it in vim daily now, and I don't expect the API to change significantly in the future.

A working example of how statuslines can be rendered to tmux is available here.

I just wanted to let you know about the new Powerline project, and I would love some feedback on whether this is something you'd like to include in your project (e.g. as a git submodule).

segment XXX exited with code 1. Aborting.

Both CPU and Mail-count does this, and prints it on the right status bar (instead of the working segments).
Before updating to the latest commit, if something didn't work, at least it didn't print an error.
Further, why doesn't cpu.sh works for me?
I'm using ubuntu linux, and the other segments seem to work just fine.

Cheers,
Elad.

arrows not displayed correctly in terminal.app

I'm currently using Terminal.app running tmux and zsh

After struggling with the bash and path, now it is finally working, but this is what I saw
http://cl.ly/image/2U3b071w0L0y

Even in iTerm2 too
http://cl.ly/image/3f053a2Q0K0U

Pretty ugly, so I went to the preference and check the font I use, I can confirm it is using the patched fonts from vim-powerline "Monaco for Powerline 11pt"

So I'm curious what is happening to the arrows, why are they so small?

Weather glyph improvement suggestion

The glyph used for dust, foggy, haze, smoky, blustery, and mist is ♨, but this is strange since the origin of this glyph is hot-springs (at least that's how it's used here in Japan). Plus, in my opinion, vertical wavy lines convey convection, while dust/foggy should be a settled visible impairment (horizontal).

Generally, I would suggest using (FOGGY), but I am not sure how well supported this glyph is in fonts. It doesn't seem very well supported and it looks bad in the terminal on OSX. So, I would suggest ﹌ (DOUBLE WAVY OVERLINE) or 〰 (WAVY DASH) as they are easy to understand and not a big departure from the original intent of using HOT SPRING.

Proper configurability

Add proper configurability by separating the config from the repo.
Tmux allows setting and reading environment variables, this could be placed in a file sourced by tmux.conf.
A sample or default configuration should be provided for quick installation.
Each such env var should be namespaced to prevent collisions with system variables.
This would allow each segment to provide its own configuration as well.

Configuration options

Implement the configuration file. One idea is to set the platform in use and let the segments use this variable to determine how to produce the output e.g. GNU Linux and OS X have different commands battery status etc.

VCS info not updating

Running in Debian.

If I start tmux from within a git/hg/svn repo it shows the vcs info and if I switch branches in that repo it updates...
But if I change directory it still displays the vcs info for the directory I was in before starting tmux and if I started from a non-version controlled directory it never shows up.

VCS branch segment when there's no branch

As long as there's a git (or any other) repository, the branch is showing fine.
The issue arises whenever I go to a directory that is not under version control.
In that case I get a message instead:
"/location/to/vcs_branch.sh:" (I'm not sure if there's anything else, since it overflows its space.

Any ideas?

Config in $HOME

Write a default config somewhere in $HOME and let the configuration of what segments to use be done there.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.