Created
April 13, 2024 07:28
-
-
Save sainak/a18a4a4aefef41b882af15689c844411 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Util to set up displays using displayplacer: https://github.com/jakehilborn/displayplacer | |
# to get the display id run `displayplacer list | grep -A2 Serial` | |
DISPLAY_1=s4251086178 | |
DISPLAY_2=s261348 | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: $0 <1|2|3>" | |
exit 1 | |
fi | |
if ! [[ "$1" =~ ^[1-3]$ ]]; then | |
echo "Argument must be an integer value from 1 to 3" | |
exit 1 | |
fi | |
case "$1" in | |
1) | |
printf '%s\n' \ | |
' Setting up displays:'\ | |
' screen 1: 1710x1112 60Hz'\ | |
''\ | |
' +---------------+'\ | |
' | |'\ | |
' | 1 |'\ | |
' | (1710x1112) |'\ | |
' | |'\ | |
' +---------------+' | |
displayplacer \ | |
"id:$DISPLAY_1 res:1710x1112 hz:60 color_depth:8 enabled:true scaling:on origin:(0,0) degree:0" | |
;; | |
2) | |
printf '%s\n' \ | |
' Setting up displays:'\ | |
' screen 1: 1470x956 60Hz'\ | |
' screen 2: 3008x1692 60Hz'\ | |
''\ | |
' +-------------------------+'\ | |
' | |'\ | |
' | |'\ | |
' | |'\ | |
' +------------+ 2 |'\ | |
' | | (3008x1692) |'\ | |
' | 1 | |'\ | |
' | (1470x956) | |'\ | |
' +------------+-------------------------+' | |
displayplacer \ | |
"id:$DISPLAY_2 res:3008x1692 hz:60 color_depth:8 enabled:true scaling:on origin:(0,0) degree:0" \ | |
"id:$DISPLAY_1 res:1470x956 hz:60 color_depth:8 enabled:true scaling:on origin:(-1470,736) degree:0" | |
;; | |
3) | |
printf '%s\n' \ | |
' Setting up displays:'\ | |
' screen 1: 1710x1112 60Hz'\ | |
' screen 2: 3008x1692 60Hz'\ | |
''\ | |
' +-------------------------+'\ | |
' | |'\ | |
' | |'\ | |
' | |'\ | |
' | 2 |'\ | |
' | (3008x1692) |'\ | |
' | |'\ | |
' | |'\ | |
' +--+-----------+----------+'\ | |
' | | '\ | |
' | 1 | '\ | |
' |(1710x1112)| '\ | |
' +-----------+ ' | |
displayplacer \ | |
"id:$DISPLAY_2 res:3008x1692 hz:60 color_depth:8 enabled:true scaling:on origin:(0,0) degree:0" \ | |
"id:$DISPLAY_1 res:1710x1112 hz:60 color_depth:8 enabled:true scaling:on origin:(295,1692) degree:0" | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment