multidisplay hack for #OpenBSD, #NetBSD xenodm/xdm.```sh#!/bin/ksh # Define variables at the top for easy accessreadonly MULTIDISPLAY_DIRECTION="--right-of" # find list of connected monitors to spanmo
from izder456@ieji.de to (none) on 25 Nov 17:30
https://ieji.de/users/izder456/statuses/115613408254659699

multidisplay hack for #OpenBSD, #NetBSD xenodm/xdm.
```sh
#!/bin/ksh

# Define variables at the top for easy access
readonly MULTIDISPLAY_DIRECTION="--right-of"

# find list of connected monitors to span
monitors=$(xrandr --query | awk '/[^s]connected/{print $1}')

# the first monitor found will be the primary
primary=$(echo "$monitors" | head -n 1)

# initialize the xrandr command
xrandr_cmd="xrandr --output $primary --auto --primary"

# loop through the displays, assigning them --auto and MULTIDISPLAY_DIRECTION with randr
previous=$primary
for monitor in $monitors
do
if [ "$monitor" != "$primary" ]; then
xrandr_cmd+=" --output $monitor --auto $MULTIDISPLAY_DIRECTION $previous"
previous=$monitor
fi
done

# Execute the composed xrandr command
eval "$xrandr_cmd"
```

could drop in to your `Xsetup_0` file. written in ksh, should work in OpenBSD's ksh and NetBSD's ksh.

Screenshot of code generated from the codeblock in the post.

#(none) #netbsd #openbsd

threaded - newest