Auto detect laptop resolution for screen layouts

New laptop is slightly taller than my last so updates the screenlayout
scripts to detect the resolution automatically
Jonathan Hodgson 3 years ago
parent 5b7b051404
commit d79535b009
  1. 3
      bin/.bin/screenlayouts/docked-laptop-left.sh
  2. 3
      bin/.bin/screenlayouts/docked.sh
  3. 4
      bin/.bin/screenlayouts/laptop-only.sh

@ -1,12 +1,13 @@
#!/bin/sh
laptopScreen="eDP-1"
laptopResolution="$(xrandr | grep -A 1 "$laptopScreen" | sed -n 2p | awk '{print $1}')"
externalScreen="$(xrandr | grep -Eo '^.* connected' | grep -v "$laptopScreen" |
cut -d ' ' -f 1)"
externalResolution="$(xrandr | grep -A 1 "$externalScreen" | sed -n 2p | awk '{print $1}')"
pkill compton
xrandr --output "$laptopScreen" --primary --mode 1920x1080 --pos 0x0 --rotate normal --output "$externalScreen" --mode "$externalResolution" --pos 1920x0 --rotate normal
xrandr --output "$laptopScreen" --primary --mode "$laptopResolution" --pos 0x0 --rotate normal --output "$externalScreen" --mode "$externalResolution" --pos "${laptopResolution%x*}x0" --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

@ -1,10 +1,11 @@
#!/bin/sh
laptopScreen="eDP-1"
laptopResolution="$(xrandr | grep -A 1 "$laptopScreen" | sed -n 2p | awk '{print $1}')"
externalScreen="$(xrandr | grep -Eo '^.* connected' | grep -v "$laptopScreen" |
cut -d ' ' -f 1)"
externalResolution="$(xrandr | grep -A 1 "$externalScreen" | sed -n 2p | awk '{print $1}')"
pkill compton
xrandr --output "$laptopScreen" --primary --mode 1920x1080 --pos "${externalResolution%x*}x0" --rotate normal --output "$externalScreen" --mode "$externalResolution" --pos 0x0 --rotate normal
xrandr --output "$laptopScreen" --primary --mode "$laptopResolution" --pos "${externalResolution%x*}x0" --rotate normal --output "$externalScreen" --mode "$externalResolution" --pos 0x0 --rotate normal
/usr/bin/compton --config "$HOME/.config/picom/picom.conf" & disown

@ -1,5 +1,7 @@
#!/bin/sh
pkill compton
laptopScreen="eDP-1"
laptopResolution="$(xrandr | grep -A 1 "$laptopScreen" | sed -n 2p | awk '{print $1}')"
xrandr | sed '/^ /d' | grep -Ev '(:|eDP-1)' | awk -v ORS=" " '{print "--output " $1 " --off"}' |
xargs xrandr --output eDP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal
xargs xrandr --output "$laptopScreen" --primary --mode "$laptopResolution" --pos 0x0 --rotate normal
/usr/bin/compton --config "$HOME/.config/picom/picom.conf" & disown

Loading…
Cancel
Save