Created
October 18, 2020 12:55
-
-
Save hungtcs/a4ea893c5b3d928f516ffb37ed2f2609 to your computer and use it in GitHub Desktop.
enable or disable build-in display by shell function
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 | |
buildin_display_name=eDP-1-1 | |
displays=($(xrandr | grep " connected " | awk '{ print$1 }')) | |
display_count=${#displays[@]} | |
function enable-buildin-display() { | |
if [ $display_count -gt 1 ]; then | |
echo "disable buildin display: ${buildin_display_name}"; | |
xrandr --output "$buildin_display_name" --auto | |
fi | |
} | |
function disable-buildin-display() { | |
if [ $display_count -gt 1 ]; then | |
echo "disable buildin display: ${buildin_display_name}"; | |
xrandr --output "$buildin_display_name" --off | |
fi | |
} |
Author
hungtcs
commented
Oct 18, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment