Skip to main content

Package description here.

Project description

nr.powerline

Simple powerline implementation, only tested in Bash. It is recommended that you use a font from NerdFonts in order to have proper support for special characters (like the right triangle).

Simple Setup

$ pipx install nr.powerline
$ PS1='`nr powerline` '

The above get's you started quickly, but you will notice a delay in rendering the powerline. This is mostly because of the overhead of kickstarting the Python process. To improve performance, Powerline can be started in the background and communicated with over a Unix socket.

function _powerline_get() {
  echo "$PWD" | nc -U ~/.local/powerline/daemon.sock 2>/dev/null
  return $?
}
function _powerline() {
  _powerline_get
  if [ $? != 0 ]; then
    if which nr-powerline >/dev/null; then
      nr-powerline --start
      if ! ( nr-powerline --status --exit-code >/dev/null ); then
        echo "Could not start powerline daemon."
      else
        _powerline_get
      fi
    else
      printf "$HOSTNAME $PWD $ "
    fi
  fi
}
export PS1='`_powerline`'

Roadmap

  • Daemon to run in the background to speed up powerline rendering.
  • Pass previous status code into nr-powerline command.
  • Breadcrumb working directory
  • Truecolor and xterm-256 color support

Plugins

The entry point for powerline plugins is nr.powerline.plugins. Entry points must inherit from the nr.powerline.plugins.Plugin class.

Configuration

The powerline can be configured with environment variables.

Variable Description
NR_POWERLINE_SCRIPT Path to a Python script that uses the nr.powerline API to render a powerline to stdout.
NR_POWERLINE_CODE Actual Python code that uses the nr.powerline API to render a powerline to stdout.

Check the default configuration in src/nr/powerline/main.py for an example script.


Copyright © 2020 Niklas Rosenstein

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nr.powerline-0.0.3.tar.gz (8.8 kB view details)

Uploaded Source

File details

Details for the file nr.powerline-0.0.3.tar.gz.

File metadata

  • Download URL: nr.powerline-0.0.3.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

File hashes

Hashes for nr.powerline-0.0.3.tar.gz
Algorithm Hash digest
SHA256 3a3650e622e2a4dd056bf7c6587705b3d4275f3dda85df1b787a775d8525a752
MD5 a555c8f2c409589db722686d1e5e2ea5
BLAKE2b-256 5eda33a343a38f86d2a58041e9b4c94798d37ad7526f58d2526db2e21c48b60e

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page