mirror of
https://github.com/starr-dusT/dotfiles.git
synced 2025-02-19 19:27:31 -08:00
28 lines
810 B
Plaintext
28 lines
810 B
Plaintext
![]() |
#!/bin/sh
|
||
|
|
||
|
# Get current IP address
|
||
|
addr=$(ip -4 addr show $1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
|
||
|
# The the relevant number (X) 192.168.X.YYY
|
||
|
num=($(echo "$addr" | tr '.' '\n'))
|
||
|
# Based on number set xrandr
|
||
|
case ${num[2]} in
|
||
|
2)
|
||
|
# Primary monitor on left
|
||
|
xrandr --output DP-4 --primary \
|
||
|
--mode 2560x1440 --rate 144 \
|
||
|
--pos 0x0 --rotate normal \
|
||
|
--output HDMI-0 \
|
||
|
--mode 2560x1440 --rate 144 \
|
||
|
--pos 2560x0 --rotate normal
|
||
|
;;
|
||
|
1)
|
||
|
# Primary monitor on right
|
||
|
xrandr --output HDMI-0 \
|
||
|
--mode 2560x1440 --rate 144 \
|
||
|
--pos 0x0 --rotate normal \
|
||
|
--output DP-4 --primary \
|
||
|
--mode 2560x1440 --rate 144 \
|
||
|
--pos 2560x0 --rotate normal
|
||
|
;;
|
||
|
esac
|