Add display config for work laptop at home

This commit is contained in:
dabruh 2024-04-19 08:35:27 +02:00
parent 4973b9f4d2
commit 1237dff14a
1 changed files with 13 additions and 0 deletions

View File

@ -309,6 +309,7 @@ main() {
for monitor in "${monitors[@]}"; do for monitor in "${monitors[@]}"; do
IFS=',' read -r -a monitor_array <<<"$monitor" IFS=',' read -r -a monitor_array <<<"$monitor"
if monitors_exist "${monitor_array[@]}" >/dev/null; then if monitors_exist "${monitor_array[@]}" >/dev/null; then
# Add logic to disable disconnected monitors
echo "Applying work profile for ${monitor_array[*]}" echo "Applying work profile for ${monitor_array[*]}"
xrandr \ xrandr \
--output "${monitor_array[0]}" --mode 1920x1200 --rotate normal --pos 1200x1474 --primary \ --output "${monitor_array[0]}" --mode 1920x1200 --rotate normal --pos 1200x1474 --primary \
@ -321,11 +322,23 @@ main() {
elif usb_devices_exist all exact "Lenovo ThinkPad USB-C Dock Audio" >/dev/null 2>&1; then elif usb_devices_exist all exact "Lenovo ThinkPad USB-C Dock Audio" >/dev/null 2>&1; then
monitor_array=(eDP-1 DP-1-0.3 DP-1-0.1) monitor_array=(eDP-1 DP-1-0.3 DP-1-0.1)
if monitors_exist "${monitor_array[@]}" >/dev/null; then if monitors_exist "${monitor_array[@]}" >/dev/null; then
# Add logic to disable disconnected monitors
echo "Applying home profile for ${monitor_array[*]}" echo "Applying home profile for ${monitor_array[*]}"
xrandr \ xrandr \
--output "${monitor_array[0]}" --mode 2560x1440 --rotate normal --pos 0x480 --primary \ --output "${monitor_array[0]}" --mode 2560x1440 --rotate normal --pos 0x480 --primary \
--output "${monitor_array[1]}" --mode 3440x1440 --rotate normal --pos 2560x480 \ --output "${monitor_array[1]}" --mode 3440x1440 --rotate normal --pos 2560x480 \
--output "${monitor_array[2]}" --mode 1920x1200 --rotate right --pos 6000x0 --output "${monitor_array[2]}" --mode 1920x1200 --rotate right --pos 6000x0
profile_found=true
fi
monitor_array=(DP-3-3 eDP-1 DP-3-1)
if monitors_exist "${monitor_array[@]}" >/dev/null; then
# Add logic to disable disconnected monitors
xrandr \
--output "${monitor_array[0]}" --mode 3440x1440 --pos 0x480 --rotate normal \
--output "${monitor_array[1]}" --mode 1920x1200 --pos 3440x720 --rotate normal --primary \
--output "${monitor_array[2]}" --mode 1920x1200 --pos 5360x0 --rotate right
profile_found=true
fi fi
fi fi