dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit f7c64614d0f2720e6f0a3210d0c0575472d69f46
parent f14306209fe314230be709cf01033fcc21b73f7c
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Fri, 25 Sep 2020 14:32:06 +0200

displayselect, mon: add native mode, fix scaling on external display

Diffstat:
M.local/bin/displayselect | 5+++--
M.local/bin/mon | 38++++++++++++++++++++++++--------------
2 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/.local/bin/displayselect b/.local/bin/displayselect @@ -1,7 +1,8 @@ #!/bin/sh set -e -ext_screens="$(xrandr | awk '{if (match($0, / connected/)) {if (i>0) {print $1}; i++}}')" +ext_screens="$(xrandr -q | + awk '{if (match($0, / connected/)) {if (i>0) {print $1}; i++}}')" if [ -z "$ext_screens" ]; then mon int @@ -11,6 +12,6 @@ else else ext="$(printf '%s' "$ext_screens" | dmenu -i -p "external:")" fi - mode="$(printf 'ext\ndual\nmirror' | dmenu -i -p "$ext mode:")" + mode="$(printf 'ext\next-native\ndual\nmirror' | dmenu -i -p "$ext mode:")" EXT="$ext" mon "$mode" fi diff --git a/.local/bin/mon b/.local/bin/mon @@ -34,35 +34,44 @@ die() { } int() { - xrandr --dpi "$INT_DPI" --fb "$res_int" \ - --output "$INT" --mode "$res_int" --scale 1x1 \ - --output "$EXT" --off + xrandr --dpi "${INT_DPI}" --fb "${res_int}" \ + --output "${INT}" --mode "${res_int}" --scale 1x1 \ + --output "${EXT}" --off } ext() { - xrandr --dpi "$INT_DPI" --fb "$res_int" \ - --output "$INT" --off \ - --output "$EXT" --mode "${res_ext}" \ + xrandr --dpi "${INT_DPI}" --fb "$res_int" \ + --output "${INT}" --off \ + --output "${EXT}" --mode "${res_ext}" \ --scale "${res_factor}x${res_factor}" \ - --panning "$res_int" + --panning "${res_int}" +} + +ext_native() { + xrandr --fb "${res_ext}" \ + --output "${INT}" --off \ + --output "${EXT}" --mode "${res_ext}" \ + --scale 1x1 \ + --panning "${res_ext}" } dual() { - xrandr --dpi "$INT_DPI" \ + xrandr --dpi "${INT_DPI}" \ --fb "$(printf '%d*2\n' "$res_int_x" | bc)x${res_int_y}" \ - --output "$INT" --primary --mode "${res_int}" --scale 1x1 \ - --output "$EXT" --mode "${res_ext}" \ + --output "${INT}" --primary --mode "${res_int}" --scale 1x1 \ + --output "${EXT}" --mode "${res_ext}" \ --pos "${res_int_x}x0" \ --scale "${res_factor}x${res_factor}" \ --panning "${res_int}+${res_int_x}+0" } mirror() { - xrandr --dpi "$INT_DPI" \ + printf + xrandr --dpi "${INT_DPI}" \ --fb "$(printf '%d+%d\n' "$res_int_x" "$res_ext_x" | bc)x${res_int_y}" \ - --output "$INT" --auto --scale 1x1 \ - --output "$EXT" --mode "${res_ext}" \ - --same-as "$INT" --scale "${res_factor}x${res_factor}" + --output "${INT}" --auto --scale 1x1 \ + --output "${EXT}" --mode "${res_ext}" \ + --same-as "${INT}" --scale "${res_factor}x${res_factor}" } find_res @@ -72,6 +81,7 @@ else case "$1" in int) int;; ext) ext;; + ext-native) ext_native;; dual) dual;; mirror) mirror;; *) die "unknown mode $1";;