-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reset color data when program exits #34
Comments
Thanks for submitting this! I think I know what's up. It has to do with how curses does custom colors and which color I'm overwriting in getDominantColor. Lines 412 to 422 in 845ea54
I think I might have a fix but to be sure, could you post a copy of your ncmpcpp config and which terminal emulator you are using? |
The terminal emulator I'm using is void
focus(XEvent *ev)
{
XFocusChangeEvent *e = &ev->xfocus;
if (e->mode == NotifyGrab)
return;
if (ev->type == FocusIn) {
if (xw.ime.xic)
XSetICFocus(xw.ime.xic);
win.mode |= MODE_FOCUSED;
xseturgency(0);
if (IS_SET(MODE_FOCUS))
ttywrite("\033[I", 3, 0);
if (!focused) {
focused = 1;
//xloadcols();
xloadcolor(bgUnfocused, NULL, &dc.col[defaultbg]);
xloadalpha();
tfulldirt();
}
} else {
if (xw.ime.xic)
XUnsetICFocus(xw.ime.xic);
win.mode &= ~MODE_FOCUSED;
if (IS_SET(MODE_FOCUS))
ttywrite("\033[O", 3, 0);
if (focused) {
focused = 0;
//xloadcols();
xloadcolor(bg, NULL, &dc.col[defaultbg]);
xloadalpha();
tfulldirt();
}
}
} You can see I've commented out the Anyway, here's the ncmpcpp config. Had to use markdown since github doesn't like the file for some reason.
Additionally, I've noticed that |
Thanks for this. I will put out a fix (or a band-aid) in the next release. The problem is that, atm, miniplayer overwrites color 7 ( The fix I propose is overwriting color 255 instead (which is supposed to be white and is a part of the grays in the ANSI colors) and then resetting it to pure white when miniplayer exits. I could also include a config option that allows the user to specify a color to which miniplayer will reset the color 255, if they so wish. What are your thoughts on this? |
Wouldn't resetting it like this just make ncmpcpp be pure wite as well? Either way I don't think a config option for this is necessary, from what I can tell it seems like kind of an edge case where this might occur. My gut feeling tells me there's got to be a way to parse Xresources so that I'm not a programmer, mind you, so please excuse me if this all sounds like nonsense 😅 |
I think ncmpcpp normally uses colors below 16 so changing color 255 (or some other random color like 171) willl not affect most users. You are right though, I should probably look into parsing the config but I suspect this will be too complex due to the fact that there is no standard way to configure colors in terminal emulators. |
For fun I tried it out on an unpatched I'm happy to test this out whenever you get around to writing your proposed fix! |
Hey again, I noticed that when I have colors set to
auto
in the config file, these colors tend to persist and bleed into other TUI apps that are launched from within the same terminal, iencmpcpp
running
miniplayer
, colors get applied based on artwork:running
ncmpcpp
, colors which miniplayer applied persist:I'm not 100% on this, but I believe ColorThief applies colors via escape sequences, which would probably explain why this happens. I suspect that if there is a way to clear all color values set by miniplayer once the program exits that this would no longer occur. Would sourcing colors from xresources upon exit be a good idea?
What do you think?
The text was updated successfully, but these errors were encountered: