Skip to content

Two or more monitors setup

gh0stzk edited this page Oct 11, 2023 · 2 revisions

I did not add this part of code to the bspwmrc file but I leave this piece of code so you can add more monitors to your setup.

The code is from adi1090x, he is the author, it is NOT mine.

Open the bspwmrc file located in ~/.config/bspwm/, look for the part where the workspaces are added, from lines 26 to 30 and delete it.

Then copy the following code depending on the number of monitors you have, I will only set it for 2 or 3 monitors.

Two Monitors Setup (Laptop and external monitor, set 4 workspaces on each monitor)

	# change these values according to your system
	# you can use `xrandr -q` to get the names of monitors
	INTERNAL_MONITOR="eDP"
	EXTERNAL_MONITOR="HDMI-A-0"
	if [[ $(xrandr -q | grep "${EXTERNAL_MONITOR} connected") ]]; then
		bspc monitor "$EXTERNAL_MONITOR" -d '' '' '' ''
		bspc monitor "$INTERNAL_MONITOR" -d '' '' '' ''
		bspc wm -O "$EXTERNAL_MONITOR" "$INTERNAL_MONITOR"
	else
		bspc monitor "$INTERNAL_MONITOR" -d '' '' '' '' '' '' '' ''
	fi

Three Monitors Setup (Laptop and two external monitor, 3-2-3 workspaces)

# again, change these values accordingly
	MONITOR_1="eDP"
	MONITOR_2="HDMI-A-0"
	MONITOR_3="HDMI-A-1"
	bspc monitor "$MONITOR_1" -d '' ''
	bspc monitor "$MONITOR_2" -d '' '' ''
	bspc monitor "$MONITOR_3" -d '' '' ''
	bspc wm -O "$MONITOR_2" "$MONITOR_1" "$MONITOR_3"

These are two examples of how to add more than one monitor to bspwm, edit the names of your monitors reboot and test your configuration.

Clone this wiki locally