diff options
author | Karel Kočí <cynerd@email.cz> | 2021-09-20 13:22:40 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2021-09-20 13:35:00 +0200 |
commit | b122ba5087d466c7b2fb41b71f8dee708bec67ec (patch) | |
tree | 9b65a59eb9a01ebdd7ba52abe0ad27c809f93883 /local/bin | |
parent | a1ddc8f09f822c991ec93a05bd738f9be2319dfc (diff) | |
download | myconfigs-b122ba5087d466c7b2fb41b71f8dee708bec67ec.tar.gz myconfigs-b122ba5087d466c7b2fb41b71f8dee708bec67ec.tar.bz2 myconfigs-b122ba5087d466c7b2fb41b71f8dee708bec67ec.zip |
Stop using mxrandr and use autorandr
Diffstat (limited to 'local/bin')
-rwxr-xr-x | local/bin/mxrandr | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/local/bin/mxrandr b/local/bin/mxrandr deleted file mode 100755 index 81ae511..0000000 --- a/local/bin/mxrandr +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/bash - -# get info from xrandr -connectedOutputs=$(xrandr | grep " connected" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/") -activeOutput=$(xrandr | grep -E " connected (primary )?[1-9]+" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/") -disconnectedOutputs=$(xrandr | grep -E " disconnected (primary )?[1-9]+" | awk '{print $1}') - -cmd="xrandr " -cmd_def=$cmd - -INTERNAL=eDP-1 -HDMI=HDMI-1 -VGA=VGA-1 - -for device in "$disconnectedOutputs"; do - if [ -n "$defice" ]; then - if [[ "$activeOutput" == *"$device"* ]]; then - cmd=$cmd" --output $device --off" - fi - fi -done - -function only_internal { - cmd=$cmd" --output $INTERNAL --auto --primary" - cmd=$cmd" --output $HDMI --off" - cmd=$cmd" --output $VGA --off" -} - -function internal_vga { - cmd=$cmd" --output $INTERNAL --auto --primary" - cmd=$cmd" --output $HDMI --off" - cmd=$cmd" --output $VGA --auto --right-of $INTERNAL" -} - -function internal_hdmi { - cmd=$cmd" --output $INTERNAL --auto --right-of $HDMI" - cmd=$cmd" --output $HDMI --auto --primary" - cmd=$cmd" --output $VGA --off" -} - -function internal_hdmi_vga { - cmd=$cmd" --output $INTERNAL --auto --right-of $HDMI" - cmd=$cmd" --output $HDMI --auto --primary" - cmd=$cmd" --output $VGA --auto --left-of $HDMI" -} - -function cmd_exec { - if [ "$cmd" != "$cmd_def" ]; then - echo $cmd - `$cmd` - fi -} - - -if [ $# -le 1 ]; then - if [[ "$connectedOutputs" == *"$HDMI"* ]]; then - if [[ "$connectedOutputs" == *"$VGA"* ]]; then - internal_hdmi_vga - else - internal_hdmi - fi - else - if [[ "$connectedOutputs" == *"$VGA"* ]]; then - internal_vga - else - only_internal - fi - fi - cmd_exec - exit -fi - -if [ "$2" != "mode" ]; then - if [[ "$connectedOutputs" != *"$2"* ]]; then - echo No $2 display known - exit - fi -fi - -case "$1" in - toggle) - case "$2" in - $INTERNAL) - if [[ "$activeOutput" == *"$INTERNAL"* ]]; then - cmd=$cmd" --output $INTERNAL --off" - else - if [[ "$activeOutput" == *"$HDMI"* ]]; then - cmd=$cmd" --output $INTERNAL --auto --right-of $HDMI" - else - cmd=$cmd" --output $INTERNAL --auto --primary" - fi - fi - ;; - $HDMI) - if [[ "$activeOutput" == *"$HDMI"* ]]; then - cmd=$cmd" --output $HDMI --off" - else - if [[ "$activeOutput" == *"$VGA"* ]]; then - cmd=$cmd" --output $HDMI --auto --primary" - else - cmd=$cmd" --output $HDMI --auto --right-of $INTERNAL" - fi - fi - ;; - $VGA) - if [[ "$activeOutput" == *"$VGA"* ]]; then - cmd=$cmd" --output $VGA --off" - else - if [[ "$activeOutput" == *"$HDMI"* ]]; then - cmd=$cmd" --output $VGA --auto --left-of $HDMI" - else - cmd=$cmd" --output $VGA --auto --right-of $INTERNAL" - fi - fi - ;; - esac - ;; -esac -cmd_exec |