baskerville / bspwm

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

Dock app (Plank, Docky, LatteDock) doesn't go behind full-screen app #696

Closed gspe closed 7 years ago

gspe commented 7 years ago

Hi, I'm trying bspwm with KDE Plasma 5 and everything seams to work quite nicely except that all dock apps doesn't go behind when an application is maximized to full-screen, I've tried with F11 and mod-f and the result is the same the application goes to full-screen but the dock stay above the application. With other wm like Xmonad this not happens so I think that is a problem with bspwm or with my config.

This is my bspwmrc

#! /bin/sh

sxhkd &

bspc monitor -d I II III "4: Web" "5: Mail"

bspc config border_width                  2
bspc config normal_border_color           "#555555"
bspc config focused_border_color          "$COLOR_HIGHLIGHT"
bspc config window_gap                    10
bspc config top_padding                   18
bspc config bottom_padding                45
bspc config single_monocle                false
bspc config borderless_monocle            true
bspc config gapless_monocle               false
bspc config pointer_follows_monitor       true
bspc config focus_follows_pointer         true
bspc config click_to_focus                true
bspc config presel_feedback_color         "$COLOR_HIGHLIGHT"
bspc config split_ratio          0.55

bspc rule -a mplayer2 state=floating
bspc rule -a Kupfer.py focus=on
bspc rule -a Screenkey manage=off
#bspc rule -a Plasma state=floating border=off layer=normal
#bspc rule -a plasmashell state=floating border=off layer=normal
#bspc rule -a plasma-desktop state=floating border=off layer=normal
bspc rule -a krunner layer=ABOVE state=floating border=off center=true
#bspc rule -a Plasma manage=off
#bspc rule -a plasmashell manage=off
#bspc rule -a plasma-desktop manage=off
bspc rule -a Plank state=floating layer=below manage=off border=off
bspc rule -a lattedock layer=below manage=off border=off
#bspc rule -a lattedock manage=off
bspc rule -a python3 state=floating
bspc rule -a yakuake layer=above state=floating
bspc rule -a Firefox desktop=^4
bspc rule -a Thunderbird desktop=^5
msteen commented 7 years ago

The policy so far with unmanaged windows has been that bspwm does nothing for them. This includes their depth placement (z-index? not sure what the correct term is). A consequence of this is that if you do nothing those windows will appear on top of fullscreen windows and will not respond to mouse input if you use focus_follows_pointer. The best way to solve this right now is to add the manage=off rules to your external rules script and run xdo above -t "$(xdo id -N Bspwm -n root | sort | head -n 1)" $wid. Here is an example, note that xdo lower $wid is enough to fix your fullscreen issue, but if you have problems with mouse input as well, you will need to run the more complex xdo above -t ... command shown above.

The author @baskerville agrees that it would be better that bspwm does this bit, but until this is implemented, you are required to call this command yourself.

gspe commented 7 years ago

I've tried this:

#!/usr/bin/env bash

wid=$1
class=$2
instance=$3
title=$(xtitle $wid)

if [[ "$class" == Plank ]]; then
  echo manage=off
  xdo above -t "$(xdo id -N Bspwm -n root | sort | head -n 1)" $wid
fi

and doesn't work, Plank dock always stay above full-screen apps. The output of xprop is:

WM_CLASS(STRING) = "plank", "Plank"
msteen commented 7 years ago

Those commands work correct for my status bar (lemonbar). Instead of trying to get it working via the external rules, you should first try running those command in your shell to see if they work for you to begin with. Maybe e.g. something is incorrect in you configuration. You can use e.g. xwininfo to get a window's id and then the xdo above -t ... command with the window id of Plank.

msteen commented 7 years ago

Ow, almost forgot, what version of xdo do you have? Like I mentioned in the external rule example I linked, older versions than the latest (0.5.6) do not always sync their requests to the X server, making them unreliable.

gspe commented 7 years ago

I've tied the command and works, but the result is not exactly what I want, with:

if [[ "$class" == Plank ]]; then
  echo manage=off
  xdo above -t "$(xdo id -N Bspwm -n root | sort | head -n 1)" $wid
fi

Plank dock go above Bspwm but below everything else, so it works correctly only if you set the appropriate padding value and you lose the effect because they go behind the window. I've found a better solution using shxkd

# set the window state
super + {t,shift + t,s}
    bspc node -t {tiled,pseudo_tiled,floating}; \
    xdo raise -N Plank

super + {f}
    bspc node -t {fullscreen}; \
    xdo lower -N Plank

it works but only if you full-screen application with super+f but not with F11 or similar but is better than previously solution.

A better solution should be an external rule like this:

#! /bin/sh

wid=$1
class=$2
instance=$3
title=$(xtitle $wid)

if xprop -id $wid _NET_WM_STATE | grep -q _NET_WM_STATE_FULLSCREEN; then
  xdo lower -N Plank
else
  xdo raise -N Plank
fi

but this not work because rule are not called when window state change only when window are created.

msteen commented 7 years ago

Ah, I understand, so your use case is a bit more complex. There is a better way to solve your use case in bspwm than using shxkd. You can listen to fullscreen events and make the appropriate xdo calls there. That way it will also work if the application goes fullscreen without explicitly calling bspc node --state fullscreen. I am using it myself to send fullscreen windows to my main monitor. Here is an example for your use case (untested):

bspc subscribe node_state | while read -r _ _ _ _ state flag; do
  if [[ "$state" != fullscreen ]]; then continue; fi
  if [[ "$flag" == on ]]; then
    xdo lower -N Plank
  else
    xdo raise -N Plank
  fi
done &
gspe commented 7 years ago

Thanks, this solution works perfectly.