-
Notifications
You must be signed in to change notification settings - Fork 40
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
Background set prior to initial Nitrogen launch not preserved #36
Comments
This is in part why I brought up the "nav" branch - not sure if I ever implemented this part of it but it was always the goal. This it the most robust way to handle the "edge case" discussed in #33. I'm happy to merge that without solving this first, however. It can come after (but before a release). |
Trying to find other programs that might do this. conky has a "pseudo-tranparent" setting implemented here: if (set_transparent) {
Window parent = win;
unsigned int i;
for (i = 0; i < 50 && parent != RootWindow(display, screen); i++) {
Window r, *children;
unsigned int n;
XSetWindowBackgroundPixmap(display, parent, ParentRelative);
XQueryTree(display, parent, &r, &parent, &children, &n);
XFree(children);
}
} else if (colour_set != background_colour) {
XSetWindowBackground(display, win, background_colour);
colour_set = background_colour;
} |
The proper way to handle this is to read the XProp that controls the background pixmap on the root window as we start Nitrogen. Normally, when we first set any bg with Nitrogen, this pixmap is destroyed/freed. If instead of destroying that pixmap, we keep a reference to it until Nitrogen closes, we can get this desired behavior of reverting as if Nitrogen did nothing. This opens up a possibility of a leak of that old Pixmap if Nitrogen crashed at any point before it was able to commit, but this is not a large concern. Conky/terminals with "pseudo-transparency" set that |
I've just had a look at my nav branch (uploaded now: e621b04), but that was an item I hadn't gotten to. |
Yes, the reason I brought conky & Xlib's This one sounds close (but it's in gtk+-3.0 only): But,
So, still not what we need... |
We already have this ability in source: https://github.com/l3ib/nitrogen/blob/master/src/SetBG.cc#L149-L164 Instead of calling You can make a GdkPixmap from a "foreign" ref like the actual X id like we have here, if for some reason we need to put it into the Gdk world, but for the purpose of this I don't think we need anything different, except maybe to convince the root window to repaint - but I think we can find an Xlib call that'd take care of that. |
Just like #34, as of 53135f0, the initial background prior to Nitrogen's launch is preserved and restored. The previous background does not need to be set with Nitrogen in the first place - it will just read whatever's currently there, set by any application. This needs testing. I've only had a chance on Xinerama setups so far. |
It would be good if on startup, Nitrogen stored the current state of the desktop to use for example as a fallback in the case discussed in #34 of (no config file->preview background->delete window->"No" to apply changes dialog)
This case happens in general on first launch of Nitrogen if the user chooses "No" to the apply dialog.
I don't know how feasible this is.
The text was updated successfully, but these errors were encountered: