dylanaraps / pywal

🎨 Generate and change color-schemes on the fly.
MIT License
8.23k stars 313 forks source link

pywal occasionally breaks elvish (exhibits strange behavior) #626

Open crinklywrappr opened 2 years ago

crinklywrappr commented 2 years ago

Original ticket: https://github.com/elves/elvish/issues/1380

The problem

When running wal -i from inside elvish, terminals occasionally stop accepting keyboard input. I have tried this in both kitty and gnome-terminal. Kitty also displays a random character in the prompt, which you can see in the screenshot. This works fine in bash.

Screenshot from 2021-08-13 16-35-28

Technology used

wal 3.3.0 Check the neofetch output in the screenshot for lots of information.

kylosus commented 2 years ago

Hello. I was not able to reproduce your issue exactly, but I noticed the cursor flickering for a second after running wal -i in kitty/elvish. Looking at kitty logs reveals that it is unable to parse OSC codes 13 and 708 defined here.

[250 14:47:11.359849] [PARSE ERROR] Unknown OSC code: 13
[250 14:47:11.359972] [PARSE ERROR] Unknown OSC code: 708

I am not too sure how well this relates to the issue, as I was never able to get the OSC sequences to leak into elvish like in your screenshot, but it is nonetheless likely that it is related. Could you please try wal --vte -i and wal -s -t -i and report back if the issue persists? Also please post your kitty version and try a different terminal if possible.

crinklywrappr commented 2 years ago

Interesting. When I first posted about this issue I was able to replicate the behavior in gnome-terminal. Right now the issue is only present in kitty.

--vte and -s -t do not fix the issue. I am using v0.20.3 which is a few versions behind. I will attempt on a more recent build.

crinklywrappr commented 2 years ago

I am able to replicate the issue on kitty 0.23.1, which is the latest version I believe

kylosus commented 2 years ago

I can't reproduce this no matter what I try with the same elvish and kitty versions. I initially thought the random characters were pywal sending sequences to active terminals as mentioned in the original thread, but if -s -t doesn't help, that possibility is eliminated unless I am missing something big in the source code. Perhaps it's due to some intricacies of logging and palette printing? Could you try commenting out line 96 in ./pywal/reload.py and try again with -s -t --vte? It's a bit far-fetched, but also try to remove lines 205, 206, 227, in ./pywal/__main__.py and line 42 ./pywal/reload.py if that has no effect. You can run pip install --user . in the repo root to install it.

crinklywrappr commented 2 years ago

Aw man that stinks. Thanks for trying!!!

When I get some time I will try these suggestions.

horvus commented 2 years ago

I had the exact same issue. I use fish with kitty and my kitty terminals break/spill random characters at spawn. Only kitty has this issue as gnome-terminal works fine. I start my X session using startx and I get the same kitty error messages as jokersus showed. Some troubleshooting showed that wal was responsible for breaking kitty, which brought me here. I used to have wal -R -n >/dev/null in my config.fish to make themes persistent across reboots, and found that taking it off entirely or replacing it with cat ~/.cache/wal/sequences seems to fix the issue. I still get the OSC sequences error logs when I drop back to console, but now kitty works normally at least. To keep themes across reboots I placed wal -R &>/dev/null in my .xinitrc.