From 331838de061de41f64cd19e9a5eb1e0551b20b24 Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Thu, 14 Sep 2023 09:57:52 +0200 Subject: [PATCH] feat(xrandr): Update display organiser script Move to a generic script and load configurations per detected IDs --- .bin/display | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/.bin/display b/.bin/display index c7e3a7c..9545c68 100755 --- a/.bin/display +++ b/.bin/display @@ -1,36 +1,22 @@ #!/bin/sh export DISPLAY=:0 -export XAUTHORITY=/home/tanguy/.Xauthority +export XAUTHORITY=~/.Xauthority -/home/tanguy/.screenlayout/base.sh -# TODO : Configure each dock configuration with MAC addresses +DOCK_ID=$(lsusb -d 0x17ef:0x30a9 -v | grep -i iserial | awk '{print $3}') > /dev/null 2>&1 -if [[ "$(ip a | grep 'e0:4f:43:59:98:f4' | wc -l)" == 1 ]]; then - /home/tanguy/.screenlayout/tegl-e0-4f.sh - - i3-msg "workspace 1, move workspace to output DVI-I-1-1"; - i3-msg "workspace 2, move workspace to output DCI-I-2-2"; - i3-msg "workspace 3, move workspace to output eDP-1" - i3-msg "workspace 4, move workspace to output eDP-1" +if [ -z "$DOCK_ID" ]; then + /bin/sh -c ~/.screenlayout/base.sh > /dev/null 2>&1 + /bin/sh -c ~/.bin/workspacelayout/base.sh > /dev/null 2>&1 + exit 0; fi -if [[ "$(ip a | grep 'f4:a8:0d:41:e1:aa' | wc -l)" == 1 ]]; then - /home/tanguy/.screenlayout/tegl-e1-aa.sh +FILE=~/.screenlayout/$DOCK_ID.sh +if test -f $FILE; then + ~/.screenlayout/$DOCK_ID.sh > /dev/null 2>&1 + ~/.bin/workspacelayout/$DOCK_ID.sh > /dev/null 2>&1 - i3-msg "workspace 1, move workspace to output DP-2-2"; - i3-msg "workspace 2, move workspace to output DP-2-3"; - i3-msg "workspace 3, move workspace to output eDP-1" - i3-msg "workspace 4, move workspace to output eDP-1" + echo "Layout applied" fi -if [[ "$(ip a | grep '00:50:b6:f7:e5:d3' | wc -l)" == 1 ]]; then - /home/tanguy/.screenlayout/tegl-e5-d3.sh - - i3-msg "workspace 1, move workspace to output DVI-I-2-2"; - i3-msg "workspace 2, move workspace to output DVI-I-1-1"; - i3-msg "workspace 3, move workspace to output eDP-1" - i3-msg "workspace 4, move workspace to output eDP-1" -fi - -/home/tanguy/.config/polybar/launch.sh > /dev/null 2>&1 +#/home/tanguy/.config/polybar/launch.sh > /dev/null 2>&1