Last active
September 18, 2021 02:11
-
-
Save gertoe/c499f3471de404cc78c17cbf9f2b0ffd to your computer and use it in GitHub Desktop.
helper scripts for switching monitor configuration on the fly
This file contains hidden or 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
| #!/bin/sh | |
| if [[ $INTEL_DRV == true ]]; | |
| then | |
| # intel driver --> not necessary (fhd-mode already included) | |
| LVDS="eDP1" | |
| #SWYM | |
| exit 1; | |
| else | |
| # modesetting driver | |
| LVDS="eDP-1" | |
| xrandr --newmode "1920x1080" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync; | |
| xrandr --addmode $LVDS 1920x1080; | |
| echo "1920x1080@60 => $LVDS" | |
| exit 0; | |
| fi |
This file contains hidden or 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
| #!/bin/sh | |
| if [[ $INTEL_DRV == true ]]; | |
| then | |
| # intel driver | |
| LVDS="eDP1" | |
| VGA="DP2-3" | |
| HDMI="DP2-1" | |
| else | |
| # Modesetting Driver | |
| LVDS="eDP-1" | |
| VGA="DP-2-3" | |
| HDMI="DP-2-1" | |
| fi | |
| if ([[ -n $(xrandr --query | awk '/^'$VGA' connected*/') ]] \ | |
| && [[ -n $(xrandr --query | awk '/^'$HDMI' connected*/') ]]); | |
| then | |
| # change tlp mote if not done yet | |
| sudo tlp start; | |
| # init displays | |
| xrandr --output $LVDS --auto; | |
| xrandr --output $HDMI --auto; | |
| xrandr --output $VGA --auto; | |
| # set correct layout | |
| xrandr \ | |
| --output $LVDS --mode 2880x1620 --pos 1920x1620 --rotate normal --scale 1x1 --primary \ | |
| --output $VGA --mode 1280x1024 --rate 76 --pos 0x84 --rotate normal --scale 1.5x1.5 \ | |
| --output $HDMI --mode 1920x1080 --pos 1920x0 --rotate normal --scale 1.5x1.5; | |
| i3-msg restart; | |
| feh --bg-center /home/gertoe/Bilder/RWTH_Sign.jpg; | |
| killall conky; sudo -u gertoe conky; | |
| else | |
| exit 1; | |
| fi |
This file contains hidden or 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
| #!/bin/sh | |
| if [[ $INTEL_DRV == true ]]; | |
| then | |
| # Intel Driver | |
| LVDS="eDP1" | |
| VGA="DP2-3" | |
| HDMI="DP2-1" | |
| else | |
| # Modesetting Driver | |
| LVDS="eDP-1" | |
| VGA="VGA-1" | |
| HDMI="HDMI-1" | |
| fi | |
| if ([[ -z $(xrandr --query | awk '/^'$VGA' connected*/') ]] \ | |
| && [[ -n $(xrandr --query | awk '/^'$HDMI' connected*/') ]]); | |
| then | |
| xrandr --output $LVDS --auto --primary --output $HDMI --auto --left-of $LVDS; | |
| xset -dpms; | |
| i3-msg restart; | |
| feh --bg-center /home/gertoe/Bilder/RWTH_Sign.jpg; | |
| killall conky; sudo -u gertoe conky; | |
| else | |
| exit 1; | |
| fi |
This file contains hidden or 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
| #!/bin/sh | |
| if [[ $INTEL_DRV == true ]]; | |
| then | |
| # Intel Driver | |
| LVDS="eDP1" | |
| VGA="DP2-3" | |
| HDMI="DP2-1" | |
| else | |
| # Modesetting Driver | |
| LVDS="eDP-1" | |
| VGA="VGA-1" | |
| HDMI="HDMI-1" | |
| fi | |
| if ([[ -n $(xrandr --query | awk '/^'$VGA' connected*/') ]] \ | |
| && [[ -z $(xrandr --query | awk '/^'$HDMI' connected*/') ]]); | |
| then | |
| xrandr --output $LVDS --auto --primary --output $VGA --auto --left-of $LVDS ; | |
| xset -dpms; | |
| i3-msg restart; | |
| feh --bg-center /home/gertoe/Bilder/RWTH_Sign.jpg; | |
| killall conky; sudo -u gertoe conky; | |
| else | |
| exit 1; | |
| fi |
This file contains hidden or 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
| #!/bin/sh | |
| if [[ $INTEL_DRV == true ]]; | |
| then | |
| # intel driver | |
| LVDS="eDP1" | |
| VGA="DP2-3" | |
| HDMI="DP2-1" | |
| else | |
| # Modesetting Driver | |
| LVDS="eDP-1" | |
| VGA="DP-2-3" | |
| HDMI="DP-2-1" | |
| fi | |
| if ([[ -z $(xrandr --query | awk '/^'$VGA' connected*/') ]] \ | |
| && [[ -n $(xrandr --query | awk '/^'$HDMI' connected*/') ]]); | |
| then | |
| CRES=`xrandr --query | awk '/^ *[0-9]*x[0-9]*/{ print $1 }' | sort -n | uniq -d | tail -1`; | |
| xrandr --output $LVDS --mode $CRES --primary --output $HDMI --mode $CRES --same-as $LVDS; | |
| xset -dpms; | |
| i3-msg restart; | |
| feh --bg-center /home/gertoe/Bilder/RWTH_Sign.jpg; | |
| killall conky; sudo -u gertoe conky; | |
| else | |
| exit 1; | |
| fi |
This file contains hidden or 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
| #!/bin/sh | |
| if [[ $INTEL_DRV == true ]]; | |
| then | |
| # intel driver | |
| LVDS="eDP1" | |
| VGA="DP2-3" | |
| HDMI="DP2-1" | |
| else | |
| # Modesetting Driver | |
| LVDS="eDP-1" | |
| VGA="DP-2-3" | |
| HDMI="DP-2-1" | |
| fi | |
| if ([[ -n $(xrandr --query | awk '/^'$VGA' connected*/') ]] \ | |
| && [[ -z $(xrandr --query | awk '/^'$HDMI' connected*/') ]]); | |
| then | |
| CRES=`xrandr --query | awk '/^ *[0-9]*x[0-9]*/{ print $1 }' | sort -n | uniq -d | tail -1`; | |
| xrandr --output $LVDS --mode $CRES --primary --output $VGA --mode $CRES --same-as $LVDS; | |
| xset -dpms; | |
| i3-msg restart; | |
| feh --bg-center /home/gertoe/Bilder/RWTH_Sign.jpg; | |
| killall conky; sudo -u gertoe conky; | |
| else | |
| exit 1; | |
| fi |
This file contains hidden or 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
| #!/bin/sh | |
| if [[ $INTEL_DRV == true ]]; | |
| then | |
| # Intel Driver | |
| LVDS="eDP1" | |
| else | |
| # Modesetting Driver | |
| LVDS="eDP-1" | |
| fi | |
| # change tlp mote if not done yet | |
| sudo tlp start; | |
| # enable only internal screen | |
| xrandr --output $LVDS --auto --primary; | |
| # turn off all external motors | |
| for output in `xrandr | cut -d ' ' -f 1 | uniq | sed '/\(^$\|Screen\|eDP*\)/d'`; do | |
| xrandr --output $output --off; | |
| done | |
| xset dpms 600; | |
| i3-msg restart; | |
| feh --bg-center /home/gertoe/Bilder/RWTH_Sign.jpg; | |
| killall conky; sudo -u gertoe conky; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment