diff --git a/skel/disp b/skel/disp index b39bf1e..d01d0b6 100644 --- a/skel/disp +++ b/skel/disp @@ -26,6 +26,17 @@ _allon() { exit } +_cloneprimary() { + if [ -z "$PRIMARYRESOLUTION" ]; then + echo "Could not detect resolution" + exit + fi + _list_connected | while read display; do + _xrandr --output $display --mode "$PRIMARYRESOLUTION" + done + exit +} + _display_main() { [[ -f "$CONFIG" ]] || { echo "ERROR: You do not have configuration yet" @@ -145,23 +156,22 @@ _arandr_empty() { _help() { echo 'DISPtool - Running without arguments shows display configuration choices + Running without arguments shows display configuration choices + help Get this help message + setup Setup display names + all Try to turn all displays on + primary Clone primary display resolution to all other displays + Display configurations: - help Get this help message - setup Setup display names - all Try to turn all displays on + 0 Run "arandr" to setup manually + 1 Main display only + 2 Presentation: Main and external screen clones + 3 Workstation: Run your workstation mode, setup in the configuration file - Display configurations: + Second argument to any previous sets the gamma correction value + Configuration file: '$CONFIG' - 0 Run "arandr" to setup manually - 1 Main display only - 2 Presentation: Main and external screen clones - 3 Workstation: Run your workstation mode, setup in the configuration file - - Second argument to any previous sets the gamma correction value - Configuration file: '$CONFIG' - - Display settings saved with arandr are displayed last + Display settings saved with arandr are displayed last ' _list_arandr exit @@ -178,6 +188,8 @@ _help() { g=1 [[ -z "$2" ]] || g=$2 i=$1 +PRIMARYRESOLUTION=$( xrandr | grep -w primary | grep -o '[0-9]\+x[0-9]\++[0-9]\++[0-9]\+' | grep -o '[0-9]\+x[0-9]\+' ) + if [ -z "$1" ]; then echo "Currently connected displays:" xrandr | grep --color=always -e ".* connected" -e '.*\*' | awk '{ print $1,$2,$3} ' @@ -189,6 +201,7 @@ if [ -z "$1" ]; then 2 Presentation: Main and all external screen clones (1024x768) 3 Workstation: Your personal configration ('$WORKSTATIONLEFT + $WORKSTATIONRIGHT', panel on '$PANEL') a All displays on + p All displays on, with the resolution of primary display ('$PRIMARYRESOLUTION') s Create and edit configuration '$CONFIGURED' Settings by arandr:' @@ -199,6 +212,7 @@ fi case $i in "a"*) _allon; ;; + "p"*) _cloneprimary; ;; "s"*) _setup; ;; 0) ( arandr & ); ;; 1) _display_main; ;;