From c5b75d4dd45407048fb2249c9b554afd506a225a Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Sun, 25 Apr 2021 09:21:55 +0100 Subject: [PATCH] Bin: Changes screen layout scripts to allow for non-hdmi screens --- bin/.bin/screenlayouts/docked-laptop-left.sh | 11 ++++++++++- bin/.bin/screenlayouts/docked.sh | 9 ++++++++- bin/.bin/screenlayouts/mirrored.sh | 9 ++++++++- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/bin/.bin/screenlayouts/docked-laptop-left.sh b/bin/.bin/screenlayouts/docked-laptop-left.sh index ffdb31bf..d9cf84c2 100755 --- a/bin/.bin/screenlayouts/docked-laptop-left.sh +++ b/bin/.bin/screenlayouts/docked-laptop-left.sh @@ -1,2 +1,11 @@ #!/bin/sh -xrandr --output eDP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output DP-1 --off --output HDMI-1 --off --output DP-2 --off --output HDMI-2 --mode 1920x1080 --pos 1920x0 --rotate normal + +laptopScreen="eDP-1" +externalScreen="$(xrandr | grep -Eo '^.* connected' | grep -v "$laptopScreen" | + cut -d ' ' -f 1)" + +pkill compton +xrandr --output "$laptopScreen" --primary --mode 1920x1080 --pos 0x0 --rotate normal --output "$externalScreen" --mode 1920x1080 --pos 1920x0 --rotate normal +/usr/bin/compton --config "$HOME/.config/picom/picom.conf" & disown + +# xrandr --output "$laptopScreen" --primary --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI-2 --mode 1920x1080 --pos 1920x0 --rotate normal diff --git a/bin/.bin/screenlayouts/docked.sh b/bin/.bin/screenlayouts/docked.sh index 3d841413..5ed076ab 100755 --- a/bin/.bin/screenlayouts/docked.sh +++ b/bin/.bin/screenlayouts/docked.sh @@ -1,2 +1,9 @@ #!/bin/sh -xrandr --output eDP-1 --primary --mode 1920x1080 --pos 1920x0 --rotate normal --output DP-1 --off --output HDMI-1 --off --output DP-2 --off --output HDMI-2 --mode 1920x1080 --pos 0x0 --rotate normal + +laptopScreen="eDP-1" +externalScreen="$(xrandr | grep -Eo '^.* connected' | grep -v "$laptopScreen" | + cut -d ' ' -f 1)" + +pkill compton +xrandr --output "$laptopScreen" --primary --mode 1920x1080 --pos 1920x0 --rotate normal --output "$externalScreen" --mode 1920x1080 --pos 0x0 --rotate normal +/usr/bin/compton --config "$HOME/.config/picom/picom.conf" & disown diff --git a/bin/.bin/screenlayouts/mirrored.sh b/bin/.bin/screenlayouts/mirrored.sh index 86e36b72..b10d52f5 100755 --- a/bin/.bin/screenlayouts/mirrored.sh +++ b/bin/.bin/screenlayouts/mirrored.sh @@ -1,2 +1,9 @@ #!/bin/sh -xrandr --output eDP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output DP-1 --off --output HDMI-1 --off --output DP-2 --off --output HDMI-2 --mode 1920x1080 --pos 0x0 --rotate normal + +laptopScreen="eDP-1" +externalScreen="$(xrandr | grep -Eo '^.* connected' | grep -v "$laptopScreen" | + cut -d ' ' -f 1)" + +pkill compton +xrandr --output "$laptopScreen" --primary --mode 1920x1080 --pos 0x0 --rotate normal --output "$externalScreen" --mode 1920x1080 --pos 0x0 --rotate normal +/usr/bin/compton --config "$HOME/.config/picom/picom.conf" & disown