powerline-hs
powerline-hs copied to clipboard
Cannot get it to work due to several problems
Hi! I tried today to use powerline-hs but cannot seem to get it work properly. To begin with I installed the latest binary from the release section so that powerline-hs gives:
Powerline-hs v0.1.3.0, compiled with resources from Powerline 2.5.2
I tried to use it with my current powerline config which can be found here: https://github.com/petobens/dotfiles/tree/master/config/powerline
The first problem I've encountered when running export POWERLINE_COMMAND=$HOME/.local/bin/powerline-hs was the following:
...
Error in $.segments: key "right" not present when parsing merged JSON from:
I was able to workaround the error by adding a new key to my custom powerline theme https://github.com/petobens/dotfiles/blob/master/config/powerline/themes/shell/my_default_leftonly.json:
diff --git a/config/powerline/themes/shell/my_default_leftonly.json b/config/powerline/themes/shell/my_default_leftonly.json
index 6f4f2e0..f1bed68 100644
--- a/config/powerline/themes/shell/my_default_leftonly.json
+++ b/config/powerline/themes/shell/my_default_leftonly.json
@@ -29,6 +29,7 @@
"function": "powerline.segments.shell.last_status",
"priority": 10
}
- ]
+ ],
+ "right": []
}
}
However when I tried running the export command again I now get:
pedro Matebook-X-Pro Could not find styles with names [HighlightGroup {hlGroup = "background", hlValue = Nothing},HighlightGroup {hlGroup = "background", hlValue = Nothing}]
CallStack (from HasCallStack):
I error, called at src/Rendering.hs:161:13 in main:Rendering
which I have no idea how to solve.
Could please try my config and let me know if you can reproduce these issues? Thanks in advance!
PS: Why is powerline-hs compiled with resources from Powerline 2.5.2 when AFAICT the latest Powerline version is 2.7?
Thanks for the detailed bug report. I'm able to repro the problem.
HighlightGroup {hlGroup = "background", hlValue = Nothing}
is the default style used in a few different places.The specific one triggering this problem is missingHandler in src/Segments.hs. The styles are defined in powerline/powerline/config_files/colorschemes/default.json and config/powerline/colorschemes/onedarkish.json. Looking in my own config, I see:
"background": { "fg": "white", "bg": "gray0", "attrs": [] },
"background:divider": { "fg": "gray5", "bg": "gray0", "attrs": [] },
Adding these entries to that file causes the prompt to render like so:

This means that it's failing to resolve the function for rendering the git status. Supported functions are defined here - changing themes/shell/my_default_leftonly.json to use powerline.segments.common.vcs.branch and adding the appropriate style to onedarkish.json results in the prompt rendering as expected.

PS: Why is powerline-hs compiled with resources from Powerline 2.5.2 when AFAICT the latest Powerline version is 2.7?
The version of the resources used is pinned via git submodules, to ensure reproducible builds. I haven't bumped it since I originally wrote powerline-hs as there hasn't been any reason to.
Thanks for the quick reply. I've managed to get this to work doing your suggested modifications however
Now powerline (top) and powerline-hs are rendered like this:

Seeing the image I have two questions:
i) powerline-hs doesn't seem to pick my "true colors". Is this a bug or a feature? You can see in my config.json thay I do have:
"common": {
"term_truecolor": true
},
ii) can I somehow replicate the gitstatus icons from my powerline setup? they don't seem to be shown even though I've added the following to my config:
{
"function": "powerline.segments.common.vcs.branch",
"priority": 40
},
{
"function": "powerline_gitstatus.gitstatus_ahead",
"priority": 40
},
{
"function": "powerline_gitstatus.gitstatus_behind",
"priority": 40
},
{
"function": "powerline_gitstatus.gitstatus_staged",
"priority": 40
},
{
"function": "powerline_gitstatus.gitstatus_unmerged",
"priority": 40
},
{
"function": "powerline_gitstatus.gitstatus_changed",
"priority": 40
},
{
"function": "powerline_gitstatus.gitstatus_untracked",
"priority": 40
},
Thanks once again
Another thing I've detected is that when I press ctrl-c I get the following errors:

Friendly ping