Closed polyzen closed 5 years ago
Would it be feasible to make the xrandr dep optional? Should I create a separate issue for that?
@polyzen Well, if we drop xrandr, we have to replace it with something. Otherwise, a wallpaper app without multi-monitor support doesn't make much sense, right? (If it does, reverting https://github.com/himdel/hsetroot/commit/20001ccd41b3254c3de8001901b348f4e8f84972 would be the right place to start.)
But.. this idea of calling the xrandr
binary was definitely not my first choice,
I had an implementation using libxrandr
.. which would work if only the library didn't always return zeroes for everything.
You can see my attempts at using libxrandr in https://github.com/himdel/hsetroot/commit/6d26599466b9df5b140c888e4b448350f50af4fe , maybe you can figure out why it isn't working.
As it is, hsetroot
depends on xrandr
, grep
, and sed
being in the PATH.
@polyzen Well, if we drop xrandr, we have to replace it with something. Otherwise, a wallpaper app without multi-monitor support doesn't make much sense, right?
1.0.2
works here with dual-monitor, but I only use it to make the desktop black again.
You can see my attempts at using libxrandr in 6d26599 , maybe you can figure out why it isn't working.
I will try and see, but I'm not much of a programmer. ^^
1.0.2 works here with dual-monitor, but I only use it to make the desktop black again.
Well, you're right, it would work for colors. But for images, it would just stretch it over all the monitors (not each).
I will try and see, but I'm not much of a programmer. ^^
Ah, well, I can certainly try reviving that code, maybe it will work now, it's been almost 3 years since I last tried. And we shall see :)
Looks like libxinerama
could also do the job.
Edit: Hrm, or not. Saw it used for multi-monitor support, but apparently it's used to unify them.
It actually might.. looks like xrandr is providing a xinerama compatibility api. Will investigate :)
Solved... looks like there's absolutely no documentation except for the xinerama header file, but turns out listing the outputs via xinerama is really easy...
Display *display = XOpenDisplay(NULL);
int nscreens = 0;
XineramaScreenInfo *xisi = XineramaQueryScreens(display, &nscreens);
for (int i = 0; i < nscreens; i++) {
printf("screen %d\n", i);
printf("\tscreen_number: %d\n", xisi[i].screen_number);
printf("\tx_org:\t%d\n", xisi[i].x_org);
printf("\ty_org:\t%d\n", xisi[i].y_org);
printf("\twidth:\t%d\n", xisi[i].width);
printf("\theight:\t%d\n", xisi[i].height);
}
XFree(xisi);
XCloseDisplay(display);
outputs
screen 0
screen_number: 0
x_org: 1920
y_org: 0
width: 1920
height: 1080
screen 1
screen_number: 1
x_org: 0
y_org: 0
width: 1920
height: 1080
Xinerama doesn't seem to support screens
(in the old X sense), so that feature (-screens
) may have to be dropped. I've never seen that in the wild, but people with multi-head setups may be affected.
I'll try to update hsetroot soon :)