#!/bin/bash maptouchscreen() { # maptouchscreen local name="$1" # should be a full name from the output of `xinput list` local output="$2" # should be an xrandr output name xinput --map-to-output $(xinput list --id-only "$name") "$output" } setpasink() { # setpasink # Find a unique string in the output of `pacmd list short` to use for pacmd set-default-sink $(pacmd list short | grep "$1" | grep -o "^\S\+") } case "$(hostname)" in "thurstybook") tsid="ELAN Touchscreen" mainoutput="eDP-1" hdmi="HDMI-1" case "$SRANDRD_ACTION" in "$hdmi connected") xrandr --output $hdmi --auto --right-of $mainoutput maptouchscreen "$tsid" "$mainoutput" setpasink hdmi ;; "$hdmi disconnected") xrandr --output $hdmi --off --output $mainoutput --auto maptouchscreen "$tsid" "$mainoutput" setpasink analog ;; esac ;; "dtarchaio") tsid="Advanced Silicon S.A CoolTouch(TM) System" mainoutput="eDP1" hdmi="HDMI1" xrandr --output $mainoutput --auto --output $hdmi --right-of $mainoutput maptouchscreen "$tsid" "$mainoutput" ;; esac