baskerville / bspwm

A tiling window manager based on binary space partitioning
BSD 2-Clause "Simplified" License
7.74k stars 414 forks source link

Help needed to configure a setup with a disabled monitor #1106

Closed gustavo-hms closed 4 years ago

gustavo-hms commented 4 years ago

Hi! I have an external monitor I plug to my laptop. I use Kscreen to disable my laptop's monitor whenever I plug the external monitor's HDMI cable. I also have the following lines in bspwmrc:

bscp config remove_disabled_monitors true
bspc config remove_unplugged_monitor true
bspc config pointer_follows_monitor true # this one will be important later

In this setup (with the external monitor plugged and laptop's monitor disabled), if I run xrand --listmonitors, it gives me:

Monitors: 1
 0: +*HDMI1 1920/600x1080/340+0+0  HDMI1

However, the command bspc query --monitors --names lists:

HDMI1
eDP1

Shouldn't it show only the HDMI1 monitor? Or am I misunderstanding the behaviour of the remove_disabled_monitors option?

Also, suppose I have no desktop configuration (no bspc monitor -d ... in my bspwmc). Whenever I log into my session, bspwm creates two desktops (each named Desktop). But, whenever I change to another desktop, bspwm acts like I'm changing to another monitor (it centers the pointer on the screen since I've set pointer_follows_monitor), even if everything is displayed in the same monitor.

It's annoying because, if I'm in the “wrong” desktop (the one that is supposed to belong to the laptop's monitor), Krunner loses focus whenever I type something into it. It doesn't happen in the “right” monitor though. This losing-focus-thing also happens if I try to configure a Plasma panel and, since it loses focus, the UI elements used to configure it disappear.

Am I doing something wrong? Is there a configuration option I'm missing?

Thanks!

SeerLite commented 4 years ago
bscp config remove_disabled_monitors true

Is that bscp a typo in your config file or only here? Maybe that's the problem?

gustavo-hms commented 4 years ago

Ops! Sorry, that typo doesn't occur in my bspwmrc. Only here.

Even if I run just this line on the terminal

bspc config remove_disabled_monitors true

nothing happens.

SeerLite commented 4 years ago

Ah I see.

Actually this is the first time I hear about this configuration option. I'm testing it out right now and, as you described, the monitor isn't removed in bspwm when unplugged. I wonder why it doesn't work.

SeerLite commented 4 years ago

I think I found a relevant issue: #384

gustavo-hms commented 4 years ago

Sorry for the delay!

I think both issues are related. But that one doesn't make me do any progress here. In that issue, we can read

with both remove_unplugged_monitors and remove_disabled_monitors set to true, a monitor will be removed once you remove its output via xrandr

But, as I said, xrandr does not list my eDP1 monitor with xrandr --listmonitors when I disable it, and yet it is shown in bspc query --monitors --names.

If I have my eDP1 monitor disabled and then I enable it, bspc subscribe monitor will output

monitor_geometry 0x01400002 1920x1080+1919+0
monitor_geometry 0x01400004 1920x1080+0+0
monitor_geometry 0x01400002 1920x1080+1919+0
monitor_geometry 0x01400004 1920x1080+0+0

While xrandr --listmonitors outputs:

Monitors: 2
 0: +eDP1 1920/290x1080/170+1919+0  eDP1
 1: +HDMI1 1920/600x1080/340+0+0  HDMI1

Finally, bspc query -M -m eDP1:

0x01400002

If I then disable it, bspc subscribe monitor outputs:

monitor_geometry 0x01400004 1920x1080+0+0
monitor_geometry 0x01400004 1920x1080+0+0

xrandr --listmonitors outputs:

Monitors: 1
 0: +HDMI1 1920/600x1080/340+0+0  HDMI1

and bspc query -M -m eDP1 still prints:

0x01400002

It seem that the option

bspc config remove_disabled_monitors true

does nothing, unless I misunderstood its meaning.

SeerLite commented 4 years ago

Yeah, I couldn't reproduce your issue. It seems to work fine on my end (unless there's more to the remove_**_monitors options).

First I set both remove_disabled_monitors and remove_unplugged_monitors to true. Then I connect external monitor HDMI1 and enable it with

xrandr --output HDMI1 --mode (etc...) --above eDP1

By now, xrandr --listmonitors and bspc query -M --names show both monitors, as expected.

Then, I disable HDMI1 with

xrandr --output HDMI1 --off

Both xrandr --listmonitors and bspc query -M --names show only eDP1 now.

Unfortunately I don't know much about external monitors and Xorg (xrandr), and how bspwm handles this under the hoods. I can only provide comparisons from my system.

Hopefully someone that knows more about this can help out!

gustavo-hms commented 4 years ago

Thank you very much for your help.

That's strange... Normally I use bspwm with the Plasma Desktop, so I thought it could have something to do with this setup. Then I tested a minimal setup:

First, I reduced my bspwmrc to just the following lines:

sxhkd &
bspc config remove_disabled_monitors true
bspc config remove_unplugged_monitor true

Then, I rebooted my computer. Once rebooted, both my monitors (eDP1 and HDMI1) were enabled in SDDM, with the screen being mirrored. In SDDM, I chose the plain bspwm session (that is, without any plasma session; just bspwm).

Once logged in, xrandr --listmonitors listed both monitors as expected, and so did bspc query -M --name.

Then, I disabled eDP1 running xrandr --output eDP1 --off like you did. By doing so, xrandr --listmonitors started to list only my HDMI1 monitor, but bspc query -M --names still listed both.

So, I think we have to wait until someone else brings new information.

jwijenbergh commented 4 years ago

@gustavo-hms What happens if you restart bspwm after doing xrandr --output eDP1 --off? With restarting I mean: bspc wm -r

gustavo-hms commented 4 years ago

Hi! Thanks for helping!

Actually, nothing changes: still the same issue. After doing what you suggest, the command bspc query -M --names still lists both monitors.

jaimet commented 4 years ago

First, I reduced my bspwmrc to just the following lines:

sxhkd &
bspc config remove_disabled_monitors true
bspc config remove_unplugged_monitor true

Personally, I'd place my bet on the typo again: it's

bspc config remove_unplugged_monitors true

not

bspc config remove_unplugged_monitor true

(and that typo would cause exactly the problem that you are experiencing).

HTH.

gustavo-hms commented 4 years ago

And you are right! It's ridiculous the amount of time a simple character can take from us.

Thank you all for the help! And sorry for the time spent in such a simple problem.

jaimet commented 4 years ago

No problem - I'm pleased it's fixed now. :thumbsup: