43 lines
888 B
Bash
Executable File
43 lines
888 B
Bash
Executable File
#!/usr/bin/bash
|
|
|
|
readarray -t monitors < <(xrandr --listmonitors | tail +2 | awk '{print $2}')
|
|
|
|
declare -a args=()
|
|
for monitor in "${monitors[@]}"; do
|
|
if [[ "$monitor" =~ default~[0-9]* ]]; then
|
|
args+=(--delmonitor "${monitor}")
|
|
fi
|
|
done
|
|
|
|
idx=1
|
|
for i in "${@}"; do
|
|
prefix=default
|
|
if [[ "$idx" -gt 1 ]]; then
|
|
prefix=none
|
|
fi
|
|
args+=(--setmonitor default~"$idx" "$i" "$prefix")
|
|
idx=$(("$idx"+1))
|
|
done
|
|
|
|
|
|
|
|
#n_monitors=${1:-3}
|
|
#if [ $n_monitors -ge 1 ]; then
|
|
# args+=(--setmonitor default~1 2560/508x1440/317+0+0 default)
|
|
#fi
|
|
#
|
|
#if [ $n_monitors -ge 2 ]; then
|
|
# args+=(--setmonitor default~2 1920/508x1200/317+1920+0 none)
|
|
#fi
|
|
#
|
|
#if [ $n_monitors -ge 3 ]; then
|
|
# args+=(--setmonitor default~3 1920/508x1200/317+3840+0 none)
|
|
#fi
|
|
|
|
|
|
if [[ "${#args[@]}" -gt 0 ]]; then
|
|
echo xrandr "${args[@]}"
|
|
xrandr "${args[@]}"
|
|
fi
|
|
xrandr --listmonitors
|