Skip to content

mKaloer/powerline_mem_segment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Powerline Memory Segment

Segment for Powerline showing the current memory usage in percent or absolute values.

Installation

pip install powerline-mem-segment

Usage

To apply the segment, add the following to the Powerline configuration file:

{
    "function": "powerlinemem.mem_usage.mem_usage"
}

For a percentage status, use the mem_usage_percent callable:

{
    "function": "powerlinemem.mem_usage.mem_usage_percent"
}

The format can be configured using the format argument:

{
    "function": "powerlinemem.mem_usage.mem_usage_percent",
    "priority": 50,
	"args": {
	    "format": "Mem: %d%%"
	}
}

The type of memory to use can be configured by passing the desired psutil attribute name as the mem_type argument (the default is "used"):

{
    "function": "powerlinemem.mem_usage.mem_usage",
    "priority": 50,
	"args": {
	    "mem_type": "active"
	}
}

The short form of size units (i.e. "K", "M", "G"...) can be used by passing the short argument (the default is False):

{
    "function": "powerlinemem.mem_usage.mem_usage",
	"args": {
	    "short": true
	}
}

For swap memory usage, use the mem_swap callable which accepts the same arguments as mem_usage:

{
    "function": "powerlinemem.mem_usage.mem_swap"
}

One or two highlight groups named mem_usage and mem_usage_gradient have to be defined in the colorscheme json file. For example:

"mem_usage":                 { "fg": "gray8", "bg": "gray0", "attrs": [] },
"mem_usage_gradient":        { "fg": "green_yellow_orange_red", "bg": "gray0", "attrs": [] }

Dependencies

The only dependency is psutil.