Skip to content

Instantly share code, notes, and snippets.

@klapvogn
Last active February 19, 2024 07:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klapvogn/c8caa8179cdd67700fe549bcad4aaeef to your computer and use it in GitHub Desktop.
Save klapvogn/c8caa8179cdd67700fe549bcad4aaeef to your computer and use it in GitHub Desktop.
Powerline symbols on Putty/Kitty

Here is how I did to get Powerline symbols to work

In my setup I use tmux I compiled it my self and you should do the same:

Installing Tmux

  1. Login to your Putty or Kitty terminal
  2. To get and build the latest from version control - note that this requires autoconf, automake and pkg-config
  3. git clone https://github.com/tmux/tmux.git
  4. cd tmux
  5. sh autogen.sh
  6. ./configure && make

Installing Powerline (Different config options)

  1. Add the Universe repository:
  2. sudo add-apt-repository universe
  3. sudo apt install --yes powerline

Configure tmux (Different environment)

To configure Powerline in tmux, add the following to your ~/.tmux.conf file:

set -g default-terminal "screen-256color" source "/usr/share/powerline/bindings/tmux/powerline.conf"
⚠️ You must set the correct value for your terminal using the default-terminal setting. If you don’t configure the correct value for your terminal, you might run into some issues. For example, Vim inside of tmux doesn’t show colored Powerline segments. The screen-256color or xterm-256color values work fine in our environments.

Configure Bash To configure Powerline for bash, add the following lines to your $HOME/.bashrc file:

# Powerline configuration
if [ -f /usr/share/powerline/bindings/bash/powerline.sh ]; then
  powerline-daemon -q
  POWERLINE_BASH_CONTINUATION=1
  POWERLINE_BASH_SELECT=1
  source /usr/share/powerline/bindings/bash/powerline.sh
fi

To apply the changes to your current terminal:
source ~/.bashrc

⚠️ After running the previous command or restarting your terminal, the Powerline segments appear in your prompt.

Edit your Powerline configuration

You can customize what segments appear in Powerline, or even the behavior of specific segments. Follow these instructions to customize your Powerline installation:

  1. Copy the /usr/share/powerline/config_files/ folder to $HOME/.config/powerline
  2. mkdir -p $HOME/.config/powerline cp -R /usr/share/powerline/config_files/* \ $HOME/.config/powerline/
  3. Edit the files there according to your needs. A good starting point is the $HOME/.config/powerline/config.json file.
  4. Reload the Powerline daemon
  5. powerline-daemon --replace

You can customize what powerline feature it should show

Available segments
https://powerline.readthedocs.io/en/master/configuration/segments.html

If you would like to play with Powerline in your tmux session, then you need to edit the following file:
/home/username/.config/powerline/themes/tmux

This is my default.json

{
	"segments": {
		
		"right": [
			{
				"function": "powerline.segments.common.sys.uptime",
				"before": "Uptime: ",
				"priority": 50
			},	
			{
				"function": "powerline.segments.common.net.internal_ip",
				"before": "IP: ",
				"args":
				{
				"interface": "enp0s31f6",
				"ipv": "4"

				},
				"priority": 50
				},
			{
				"function": "powerline.segments.common.net.network_load",
				"args":
                {
                "interface": "enp0s31f6",
				"si_prefix": "True",
				"recv_format": "Down: {value:>8} ",
				"sent_format": "UP: {value:>8}"

                },
                "priority": 50
			},					
			{
				"function": "powerline.segments.common.sys.cpu_load_percent",
				"before": "CPU: ",
				"args": {
					"format": "{0:.0f}%"
				},				
				"priority": 50
			},			
			{
				"function": "powerline.segments.common.time.date",
				"args": {
					"format": "%d-%m-%Y"
				}
			},
			{
				"function": "powerline.segments.common.time.date",
				"name": "time",
				"args": {
					"format": "%H:%M",
					"istime": true
				}
			},
			{
				"function": "powerline.segments.common.net.hostname"
			}
		]
	}
}

⚠️
Remember you also need to find a Powerline font that works with Powerline

powerline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment