#!/usr/bin/bash # laptop display management # Load config & functions #. ${HOME}/ayo.conf #. ${scripts_dir}/functions.sh intern=eDP-1 extern=DP-1 command=$2 function main() { case $command in "big") echo "Setting display to big mode (1920x1200)" xrandr --output "$intern" --mode 1920x1200 ;; "small") echo "Setting display to small mode (1280x800)" xrandr --output "$intern" --mode 1280x800 ;; "list") echo "Listing all monitors" xrandr --listmonitors ;; "dual") echo "Setting dual display mode" xrandr --output "$extern" --primary --auto --left-of "$intern" --output "$intern" --mode 1680x1050 ;; "solo") echo "Setting single display mode (internal only)" xrandr --output "$extern" --off --output "$intern" --auto ;; *) echo "Setting display to small mode (1680x1050)" xrandr --output "$intern" --output "$intern" --mode 1680x1050 ;; esac return 0 } start_time=$(date +%s%N) main $@ end_time=$(date +%s%N) duration=$((end_time - start_time)) duration_ms=$(echo "scale=3; $duration / 1000000" | bc) duration_s=$(echo "scale=3; $duration_ms / 1000" | bc) echo "Took $duration_s s"