45 lines
1.1 KiB
Bash
Executable File
45 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
maptouchscreen() {
|
|
# maptouchscreen <name> <output>
|
|
local name="$1" # <name> should be a full name from the output of `xinput list`
|
|
local output="$2" # <output> should be an xrandr output name
|
|
xinput --map-to-output $(xinput list --id-only "$name") "$output"
|
|
}
|
|
|
|
setpasink() {
|
|
# setpasink <name>
|
|
# Find a unique string in the output of `pacmd list short` to use for <name>
|
|
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
|
|
|