Tinycore is here 12/1/2008! Welcome visitors.
RandR RandR (resize and rotate) is a communications protocol written as an extension to the X11[34] protocol. XRandR provides the ability to resize, rotate and reflect the root window of a screen. RandR is responsible for setting the screen refresh rate.[35] It allows for the control of multiple monitors.[36]
The way monitor layouts work for most people with mainstream operating systems or desktop environments (like GNOME) is this: you connect an external monitor for the first time, your desktop expands to this monitor, then you can change its position or turn it off in the settings, and then this setup is remembered so that you don’t need to do it again the next time you connect it. People with non-mainstream X11 window managers (like xmonad, i3, awesomewm, fluxbox) can get a similar experience: arandr being the “settings UI” and autorandr handling the initial expansion, saving and restoring.
#!/usr/bin/env bash# Wrapper around xrandr which allows shell globs in --output and automatically# disables all other outputs.## see https://work.lisk.in/2020/10/11/xrandr-ux.htmlset -eu -o pipefailexport LC_ALL=Cunset xrandr_queryfunction o { printf -->&2 "%s:%s\\n" "${0##*/}" "$(printf " %q" "$@")"; "$@"; }function get-xrandr-query { [[ "${xrandr_query-}" ]] && return xrandr_query=$(xrandr --query)}function get-xrandr-outputs { <<<"$xrandr_query" grep -P -o '^([\w-]+)(?= (dis)?connected)' | LC_ALL=C sort}function get-xrandr-connected-outputs { <<<"$xrandr_query" grep -P -o '^([\w-]+)(?= connected)' | LC_ALL=C sort}function get-xrandr-outputs-except { get-xrandr-outputs | grep -F -v -x -f <(printf "%s\n" "$@")}function get-xrandr-custom-monitors { xrandr --listmonitors | grep -P -o '^\s*\d+:\s+\K[^+]\S+' | sed -e 's/^[+*]*//'}function find-one { local pat="${1:?}" n="" tmp="" local -a matches=() if [[ $pat == *#* ]]; then n=${pat#*#} pat=${pat%#*} fi while read -r tmp; do # shellcheck disable=SC2053 if [[ $tmp == $pat ]]; then matches+=("$tmp") fi done if [[ $n ]]; then (( n < ${#matches[@]} )) && printf "%s\n" "${matches[$n]}" else (( ${#matches[@]} == 1 )) && printf "%s\n" "${matches[0]}" fi}function find-xrandr-output { get-xrandr-outputs | find-one "$1"; }function find-xrandr-connected-output { get-xrandr-connected-outputs | find-one "$1"; }function xrandr-auto-off { local -a outputs=() local output local -a args=() local arg while (( $# )); do arg="$1"; shift args+=("$arg") [[ $arg == --output ]] && outputs+=("$1") done if ! (( ${outputs[@]+${#outputs[@]}} )); then printf -->&2 "Aborting, would disable all outputs.\n" exit 1 fi for output in $(get-xrandr-outputs-except ${outputs[@]+"${outputs[@]}"}); do args+=(--output "$output" --off) done for monitor in $(get-xrandr-custom-monitors); do o xrandr --delmonitor "$monitor" done o xrandr "${args[@]}"}function xrandr-auto-find { local -a args=() local arg while (( $# )); do arg="$1"; shift args+=("$arg") if [[ $arg == --@(output|left-of|right-of|above|below|same-as) ]] && (( $# )); then arg="$1"; shift arg=$(find-xrandr-connected-output "$arg") args+=("$arg") fi done o xrandr-auto-off "${args[@]}"}get-xrandr-query# skip main if sourcedreturn 0 2>/dev/null || :if (( ! $# )); then echo "Usage: xrandr-smart --output …" exit 1fixrandr-auto-find "$@"