From 42fd94e173b40ac3f7c9e7d3af2d31a4e5ae937b Mon Sep 17 00:00:00 2001 From: David Thurstenson Date: Wed, 15 May 2019 23:41:37 -0500 Subject: [PATCH] Breaking up srandrd.conf making it easier to define new computers --- .config/srandrd.conf | 51 ++---------------------------- .config/srandrd.d/thurstybook.conf | 18 +++++++++++ .config/srandrd.d/thurstyserv.conf | 8 +++++ 3 files changed, 29 insertions(+), 48 deletions(-) create mode 100644 .config/srandrd.d/thurstybook.conf create mode 100644 .config/srandrd.d/thurstyserv.conf diff --git a/.config/srandrd.conf b/.config/srandrd.conf index 9a781f6..db77878 100755 --- a/.config/srandrd.conf +++ b/.config/srandrd.conf @@ -10,53 +10,8 @@ maptouchscreen() { setpasink() { # setpasink # Find a unique string in the output of `pacmd list short` to use for - 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 diff --git a/.config/srandrd.d/thurstybook.conf b/.config/srandrd.d/thurstybook.conf new file mode 100644 index 0000000..70742b6 --- /dev/null +++ b/.config/srandrd.d/thurstybook.conf @@ -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 diff --git a/.config/srandrd.d/thurstyserv.conf b/.config/srandrd.d/thurstyserv.conf new file mode 100644 index 0000000..4aad0cc --- /dev/null +++ b/.config/srandrd.d/thurstyserv.conf @@ -0,0 +1,8 @@ +#!/bin/bash +mainoutput="" + +case "$SRANDRD_ACTION" in + "$mainoutput connected") + xrandr --output $mainoutput --auto + ;; +esac