summaryrefslogtreecommitdiffstats
path: root/public/.local/bin/laptop-xrandr.sh
blob: 833586c79d03c59146960cb19b13377ef4993ae8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash

# See https://wiki.archlinux.org/title/Multihead

# Didn't know how to get the screen name, this works for now
#screen=$(xrandr | grep "primary" | awk '{ print $1 }')
# But now how do I get the rest?  And the correct order?  Maybe it's better just
# to define "hardcoded" functions and just call them.

simple_2_monitor() {
    # enable
    xrandr --output eDP --auto --output HDMI-A-0 --auto --left-of eDP
    # disable
    #xrandr --output eDP --auto --output HDMI-A-0 --off
}

# Thank you: https://www.maketecheasier.com/how-to-setup-dual-monitors-with-xrandr/
# xrandr --auto --output HDMI-A-0 --mode 1920x1080 --right-of eDP

#simple_2_monitor
#xrandr --auto --output HDMI-A-0 --mode 1920x1080 --right-of eDP

only_hdmi_4k() {
    xrandr --output eDP --off --output HDMI-A-0 --mode 3840x2160
}

only_hdmi_2k() {
    xrandr --output eDP --off --output HDMI-A-0 --mode 1920x1080
}

case $1 in
  4k) only_hdmi_4k ;;
  2k) only_hdmi_2k ;;
  reset) xrandr ;;
  *) simple_2_monitor ;;
esac