diff options
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 |