Breaking up srandrd.conf making it easier to define new computers

This commit is contained in:
David Thurstenson 2019-05-15 23:41:37 -05:00
parent 400bed77d7
commit 42fd94e173
3 changed files with 29 additions and 48 deletions

View File

@ -10,53 +10,8 @@ maptouchscreen() {
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\+")
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="DP1"
hdmi="HDMI2"
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
;;
"thurstyserv")
mainoutput=""
case "$SRANDRD_ACTION" in
"$mainoutput connected")
xrandr --output $mainoutput --auto
;;
esac
esac
# shellcheck source=/dev/null
source ~/.config/srandrd.d/"$(hostname)".conf

View File

@ -0,0 +1,18 @@
#!/bin/bash
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

View File

@ -0,0 +1,8 @@
#!/bin/bash
mainoutput=""
case "$SRANDRD_ACTION" in
"$mainoutput connected")
xrandr --output $mainoutput --auto
;;
esac