bspwm icon indicating copy to clipboard operation
bspwm copied to clipboard

"bspc query -M" report wrong number of screens

Open DanTheDane opened this issue 10 years ago • 8 comments

I'm using bspwm with a laptop, where I also attach and detach external screens while running.

I've noticed that once a screen has been attached, it's still listed with "bspc query -M" even though it has been detached physically (and verified that the system see it as detached via xrandr).

So e.g. with laptop only, the output is: eDP1

Attaching the screen, output is: eDP1 DP1

Detaching the screen, output is: eDP1 DP1

Currently I use the following as a workaround: xrandr | grep " connected" | grep -oE "(^[a-zA-Z0-9-]*)"

DanTheDane avatar Jan 30 '16 20:01 DanTheDane

bspc config remove_unplugged_monitors true
bspc config remove_disabled_monitors true

?

baskerville avatar Feb 01 '16 19:02 baskerville

Didn't make a difference.

However when checking the xrandr out, I can see that DP1 is reported as primary, despite I have told eDP1 to be primary (I will look into this independently) Don't know if this can have any effect....

$ xrandr

Screen 0: minimum 8 x 8, current 5760 x 1200, maximum 32767 x 32767
eDP1 connected 1920x1080+3840+0 (normal left inverted right x axis y axis) 309mm x 173mm
   1920x1080      60.0*+   59.9  
   1680x1050      60.0     59.9  
   1600x1024      60.2  
   1400x1050      60.0  
   1280x1024      60.0  
   1440x900       59.9  
   1280x960       60.0  
   1360x768       59.8     60.0  
   1152x864       60.0  
   1024x768       60.0  
   800x600        60.3     56.2  
   640x480        59.9  
DP1 disconnected primary (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
DP2-1 disconnected (normal left inverted right x axis y axis)
DP2-2 disconnected (normal left inverted right x axis y axis)
DP2-3 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

$ bspc query -M

eDP1
DP1

DanTheDane avatar Feb 02 '16 07:02 DanTheDane

Please enclose program outputs in code blocks.

What's the effect of xrandr --output DP1 --off on the output of bspc query -M -m DP1?

What's the output of xev -root and bspc subscribe monitor while detaching the screen?

baskerville avatar Apr 16 '16 09:04 baskerville

The effect of the query command is the same before and after disabling the output 0x00A00003

xev output:

EnterNotify event, serial 18, synthetic NO, window 0xaf,
    root 0xaf, subw 0x0, time 23586722, (2488,723), root:(2488,723),
    mode NotifyGrab, detail NotifyInferior, same_screen YES,
    focus NO, state 272

KeymapNotify event, serial 18, synthetic NO, window 0x0,
    keys:  4294967175 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

LeaveNotify event, serial 18, synthetic NO, window 0xaf,
    root 0xaf, subw 0x0, time 23586733, (2488,723), root:(2488,723),
    mode NotifyUngrab, detail NotifyInferior, same_screen YES,
    focus NO, state 272

subscribe output:

RRNotify event, serial 18, synthetic NO, window 0xaf,
    subtype XRROutputPropertyChangeNotifyEvent
    output DP1, property EDID, timestamp 23597510, state Delete

RRScreenChangeNotify event, serial 18, synthetic NO, window 0xaf,
    root 0xaf, timestamp 23561369, config_timestamp 23597532
    size_index 65535, subpixel_order SubPixelUnknown
    rotation RR_Rotate_0
    width 3840, height 1200, mwidth 1013, mheight 316

RRNotify event, serial 18, synthetic NO, window 0xaf,
    subtype XRROutputChangeNotifyEvent
    output DP1, crtc 64, mode 1920x1200 (1920x1200)
    rotation RR_Rotate_0
    connection RR_Disconnected, subpixel_order SubPixelUnknown

ConfigureNotify event, serial 18, synthetic NO, window 0xaf,
    event 0xaf, window 0x1c00003, (3732,0), width 105, height 18,
    border_width 0, above 0x1e00003, override NO

DanTheDane avatar Apr 24 '16 19:04 DanTheDane

In the latest version, with both remove_unplugged_monitors and remove_disabled_monitors set to true, a monitor will be removed once you remove its output via xrandr. A window manager should not be responsible for keeping track of the physical monitor state, this is outside their scope. It only responds to the reported virtual state, in the case of bspwm via xrandr. So in order to achieve what you want, to remove a bspwm monitor once the corresponding physical monitor is disconnected, you would have to make the appropriate calls to xrandr once a change in the physical monitor state has been reported by the system, which can be done e.g. by using udev and a callback script. Then bspwm will also be notified of the changes made and will act accordingly.

msteen avatar Aug 13 '17 09:08 msteen

This can probably be closed! I had the same issue as the OP and the above solution (the two remove_* commands) resolved it when I added them to my bspwmrc and reloaded the config.

Thanks!

distek avatar Jan 05 '20 03:01 distek

@DanTheDane please close the issue unless you are still experiencing this bug on the most recent version of bspwm.

jallbrit avatar Aug 10 '20 05:08 jallbrit

Not using Linux anymore, so unfortunately cannot verify the suggested solution. But since it seems to be working per feedback, I will close it.

DanTheDane avatar Aug 11 '20 11:08 DanTheDane