Skip to content

Reloading doesn't respect bottom padding on second monitor #1536

Description

@promitheas17j

When reloading the config using the sxhkd binding, often bspwm seems to ignore the bottom padding assigned to windows of the second monitor, leading to a rather large gap below them.

Screenshot with red line roughly where my monitors are separated

I have my secondary monitor above my primary, and in the screenshot above I drew a red line to represent roughly where one ends and the other begins.

Here is my bspwmrc:

#! /bin/sh

# pgrep -x sxhkd > /dev/null || sxhkd -s &
# pgrep -io "sxhkd" || { killall sxhkd; sxhkd > /dev/null 2>&1 & }
pgrep -io "sxhkd" | xargs kill
sxhkd -s &

pgrep -x copyq > /dev/null || copyq &
pgrep -x xfce4-power-manager > /dev/null || xfce4-power-manager &
pgrep -x dunst > /dev/null || dunst &
pgrep -x nm-applet > /dev/null || nm-applet &

pgrep -x picom > /dev/null | xargs kill
picom -b

pgrep -x polybar > /dev/null | xargs kill
$HOME/.config/polybar/launch.sh

# $HOME/.fehbg &
# On startup, bottom monitor's background is stretched and generally looks bad (its just a bunch of lines), until I restart my bspwm session. Placing the feh command a second time to test if this solves it.
# $HOME/.fehbg & 

setxkbmap us
$HOME/.bin/remap-caps-esc

bspc config border_width         2
bspc config window_gap           10
# bspc config 

bspc config split_ratio          0.52
bspc config borderless_monocle   true
bspc config gapless_monocle      true

# Dracula theme
bspc config normal_border_color "#44475a"
bspc config active_border_color "#6272a4"
bspc config focused_border_color "#8be9fd"
bspc config presel_feedback_color "#6272a4"

sleep 3
xrandr --auto
connected_monitors=$(xrandr --listmonitors | grep "^Monitors:" | cut -d' ' -f2)
if [[ "$connected_monitors" -gt 1 ]];
then
	xrandr --output HDMI-A-0 --primary --mode 1920x1080 --pos 0x0 --rotate normal
	xrandr --output HDMI-A-1 --mode 1920x1080 --rotate inverted --above HDMI-A-0
	bspc monitor HDMI-A-0 -d 1 2 3 4 5
	bspc monitor HDMI-A-1 -d 6 7 8 9 0
	
	# pgrep -x polybar > /dev/null || $HOME/.config/polybar/launch.sh

	# Fix gap appearing above windows on first monitor after restarting bspwm
	bspc config -m HDMI-A-0 top_padding 3
	bspc config -m HDMI-A-0 bottom_padding 40
	
	# Fix top/bottom margins for secondary monitor
	bspc config -m HDMI-A-1 bottom_padding 3
	bspc config -m HDMI-A-1 top_padding 40

	bspc wm -O HDMI-A-0 HDMI-A-1
	$HOME/.fehbg & 
	xset s off
	xset s noblank
	xset -dpms
else
	monitor_name="$(xrandr --listmonitors | awk 'NR==2 {print $4}')"
	xrandr --output "$monitor_name" --scale 1.0x1.0 --mode 1920x1080 --primary
	# bspc monitor -d I II III IV V VI VII VIII IX X
	bspc monitor "$monitor_name" -d 1 2 3 4 5 6
	# xinput set-button-map 9 1 2 3 5 4 6 7
	xinput set-prop 'SYNA8007:00 06CB:CD8C Touchpad' 318 1
	# pgrep -x polybar > /dev/null || $HOME/.config/polybar/launch.sh
	$HOME/.fehbg & 
fi


# Make sure theme cursor is shown when mouse is not over a window, instead of the standard default one
xsetroot -cursor_name left_ptr

bspc rule -a Gimp desktop='^8' state=floating follow=on
bspc rule -a Chromium desktop='^2'
bspc rule -a mplayer2 state=floating
bspc rule -a Kupfer.py focus=on
bspc rule -a Screenkey manage=off
bspc rule -a Zathura state=tiled
bspc rule -a Passy state=tiled

bspc rule -a scpad sticky=on state=floating rectangle=1896x400+10+50

$HOME/.bin/parse_keybinds.sh
betterlockscreen -u $HOME/Pictures/wallpapers/ --fx dim --dim 50

eval $(ssh-agent)
SSH_ASKPASS=/usr/lib/ssh/x11-ssh-askpass ssh-add ~/.ssh/id_ed25519 < /dev/null

Sometimes, if I reload it a couple times it fixes itself, but this time it refuses to do so, no matter how many times I relaod it.

BSPWM version: bspwm 0.9.11-2
Kernel version: 6.17.1-arch1-1

Let me know if you would like more info and I'll provide it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions