-
Notifications
You must be signed in to change notification settings - Fork 208
Description
I have two displays, one positioned lower than the other. To make swapping between the two monitors flawless, I configured them with the following xrandr
command:
xrandr --output DP-1 --primary --mode 2560x1440 --pos 1920x0 --rotate normal --output DP-2 --mode 1920x1080 --pos 0x300 --rotate normal --output DP-3 --off --output HDMI-1 --off
This configuration adds a 300-pixel vertical offset for the second monitor. While the bar is correctly positioned, windows on the second monitor are not respecting the offset and are shifted up by 300 px exceeding the screen size.
After inspecting dwm.c
, I found that the arrangemon
function had an incorrect wy
value for the second monitor. To address this, I implemented a quick fix that excludes the monocle layout (as full-sized windows work correctly) and temporarily adjusts m->wy
during the arrangement process.
Temporary Fix
Here’s my updated arrangemon
function:
void arrangemon(Monitor *m) {
updatebarpos(m);
updatesystray();
XMoveResizeWindow(dpy, m->tabwin, m->wx + m->gappov, m->ty, m->ww - 2 * m->gappov, th);
XMoveWindow(dpy, m->tagwin, m->wx + m->gappov, m->by + (m->topbar ? (bh + m->gappoh) : (- (m->mh / scalepreview) - m->gappoh)));
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol);
if (m->mh == 1080 && m->lt[m->sellt]->arrange != monocle) {
m->wy -= 300;
}
if (m->lt[m->sellt]->arrange) {
m->lt[m->sellt]->arrange(m);
}
// Restore wy to its original value after arrangement
if (m->mh == 1080 && m->lt[m->sellt]->arrange != monocle) {
m->wy += 300;
}
}
I suspect the root cause lies in how the Monitor
struct (m
) is handled, as the values appear correct in updategeom
.
I don’t really have the time or the technical knowledge to implement a proper fix myself, so I’m sharing this quick fix as an example in case someone else encounters the same problem. Hopefully, this can serve as a starting point for a more robust solution.