powerline / powerline

Powerline is a statusline plugin for vim, and provides statuslines and prompts for several other applications, including zsh, bash, tmux, IPython, Awesome and Qtile.

Home Page:https://powerline.readthedocs.org/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

POWERLINE_THEME_OVERRIDES not working for powerline in BASH

jessebot opened this issue ยท comments

Thanks to everyone still working on this project. I use powerline everyday and I really love it ๐Ÿ’™

The documentation for theme overrides located at configuration/local.html#environment-variables-overrides seems to be out of date:

POWERLINE_THEME_OVERRIDES

Overrides values from powerline/themes/ext/key.json. Top-level key is treated as a name of the theme for which overrides are used: e.g. to disable cwd segment defined in powerline/themes/shell/default.json one needs to use:

POWERLINE_THEME_OVERRIDES=default.segment_data.cwd.display=false

I want to submit a PR to fix it, but I can't seem to get it to work myself.

Here's a snippet of the top of my ~/.config/powerline/themes/shell/default.json:

{
    "segments": {
        "above": [{
                "left": [
                    {
                        "function": "powerline.segments.common.net.internal_ip",
                        "priority": 10
                    },
                    {
                        "function": "powerline.segments.common.net.hostname",
                        "priority": 20
                    },
                    {
                        "function": "powerline.segments.common.env.cwd",
                        "display": true,
                        "before": "๎—พ  ",
                        "priority": 30,
                        "args": {
                            "use_shortened_path": true
                        }
                    }

This actually works fine, but I can't get override to work (using BASH), and I'm unsure how it can, given that there's no name for the block that actually contains the powerline.segments.common.env.cwd function.

Is there interest in transitioning to YAML by any of the maintainers? (I could help with that if you want help, btw, happy to throw in some effort :) ) I saw #2012 (comment) but I didn't see anything else related to it.

Either way, to be able to query parameters related to, for instance, cwd (current working directory) I think we'd need at least more structured json, like:

{
    "segments": {
        "above": [{
                "left": [
                    "internal_ip": {
                        "function": "powerline.segments.common.net.internal_ip",
                        "priority": 10
                    },
                    "hostname": {
                        "function": "powerline.segments.common.net.hostname",
                        "priority": 20
                    },
                    "cwd": {
                        "function": "powerline.segments.common.env.cwd",
                        "display": true,
                        "before": "๎—พ  ",
                        "priority": 30,
                        "args": {
                            "use_shortened_path": true
                        }
                    }

Then I could see something like this working, to disable the cwd:

export POWERLINE_THEME_OVERRIDES="shell.default.segments.above.left.cwd.display=false"

Thanks in advance for your time, and any guidance you can provide.