bakkeby / dwm-flexipatch

A dwm build with preprocessor directives to decide which patches to include during build time

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Status bar cropped after changing monitor resolution

IamGianluca opened this issue · comments

Hi,

This is likely an issue with dwm, and not dwm-flexipatch, but I'll ask anyway, as I'm sure there are a decent number of experts here who might have already found a solution to this issue.

When at home, I often dock my laptop and use a wider monitor. I use the following aliases to adjust the monitor resolution.

alias home_screen="xrandr --output eDP-1 --off --output DP-1 --mode 3840x2160"  
alias xps_screen="xrandr --output eDP-1 --mode 3200x1800"

home_screen turns off the laptop monitor and uses the large desktop monitor. xps_screen reverts the OS to using the laptop's monitor.

One issue I found is that when switching back from home_screen to xps_screen, the status bar in dwm is cropped (missing the right-most part where I have the dwmblocks icons) and the tab indicator is frozen and set to 1, no matter what tab I'm currently on.

Large monitor:
image

Laptop monitor:
image

Everything else works fine, including dmenu. The issue is limited to the status bar.

Is there a fix for this issue?

Thanks for reporting; I like puzzles.

I am unable to replicate any bad behaviour of dwm when changing resolution of a single screen.

In your particular case you are switching from a laptop display to solely using a monitor (as opposed to taking advantage of both displays).

Then you switch back to solely using your laptop display.

I think that this has to do with your xrandr commands and let me explain why.

alias home_screen="xrandr --output eDP-1 --off --output DP-1 --mode 3840x2160"

When you use the home alias the output of monitor eDP-1 is turned off and DP-1 is turned on; dwm will get a configurenotify message for the root window which will result in updategeom to be called which resizes the monitor, the working area and the size of the bar.

Then when you are done you hit the xps alias.

alias xps_screen="xrandr --output eDP-1 --mode 3200x1800"

In this case monitor output eDP-1 is turned on, but likely we are still outputting to DP-1 at the resolution of 3840x2160.

Another configurenotify event comes in and we call updategeom. Xinerama is used and it finds that we have two displays. In this case we don't have positioning of the monitors so they are both placed at position 0x0 and are as such overlapping. Monitor 0 will keep all the tags and clients just as you had it, while Monitor 1 will be empty with an empty bar. As such, having been created last, the bar on Monitor 1 is placed above the bar for Monitor 0. What you see in the bottom screenshot is the bar for Monitor 1.

I think that if you change your xps alias to this then it should behave better.

alias xps_screen="xrandr --output eDP-1 --mode 3200x1800 --output DP-1 --off"

WOW! That fixed it! Thank you so much @bakkeby!!