55 lines
1.3 KiB
Bash
Executable File
55 lines
1.3 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 "$name" "$output"
|
|
}
|
|
|
|
setpasink() {
|
|
# setpasink <name>
|
|
# Find a unique string in the output of `pacmd list short` to use for <name>
|
|
pacmd set-default-sink $(pactl list sinks 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="USBest Technology SiS HID Touch Controller"
|
|
mainoutput="eDP1"
|
|
hdmi="HDMI1"
|
|
|
|
case "$SRANDRD_ACTION" in
|
|
"$hdmi connected")
|
|
xrandr --output $mainoutput --auto --output $hdmi --right-of $mainoutput
|
|
maptouchscreen "$tsid" "$mainoutput"
|
|
;;
|
|
"$hdmi disconnected")
|
|
xrandr --output $mainoutput --auto
|
|
maptouchscreen "$tsid" "$mainoutput"
|
|
;;
|
|
esac
|
|
;;
|
|
esac
|
|
|