Skip to content

Instantly share code, notes, and snippets.

@zmpeg
Last active December 15, 2015 19:48

Revisions

  1. zmpeg revised this gist Nov 9, 2015. 1 changed file with 9 additions and 2 deletions.
    11 changes: 9 additions & 2 deletions extend.sh
    Original file line number Diff line number Diff line change
    @@ -18,8 +18,15 @@ else
    sleep 1
    xrandr --output HDMI1 --same-as eDP1
    else
    echo "Usage: ./extend.sh [dir]"
    echo "where [dir] is 'left' or 'right' or 'clone'"
    if [[ "$1" == "up" ]]; then
    echo "Extending HDMI1 above eDP1"
    xrandr --output HDMI1 --mode $RES
    sleep 1
    xrandr --output HDMI1 --above eDP1
    else
    echo "Usage: ./extend.sh [dir]"
    echo "where [dir] is 'left' or 'right' or 'clone'"
    fi
    fi
    fi
    fi
  2. Matt revised this gist Apr 5, 2013. 1 changed file with 13 additions and 5 deletions.
    18 changes: 13 additions & 5 deletions extend.sh
    Original file line number Diff line number Diff line change
    @@ -3,15 +3,23 @@
    if [ -z "$1" ]; then
    xrandr --output HDMI1 --mode 0x0
    else
    RES=`xrandr | grep -A1 HDMI1 | tail -n1 | awk '{ print $1 }'`
    echo "Detected HDMI1 with resolution ${RES}"

    if [ "$1" == "right" ] || [ "$1" == "left" ]; then
    RES=`xrandr | grep -A1 HDMI1 | tail -n1 | awk '{ print $1 }'`
    echo "Detected HDMI1 with resolution ${RES}"
    echo "xrandr --output HDMI1 --mode ${RES}"
    echo "Extending HDMI1 to the {$1} of eDP1"
    xrandr --output HDMI1 --mode $RES
    sleep 1
    xrandr --output HDMI1 --$1-of eDP1
    else
    echo "Usage: ./extend.sh [dir]"
    echo "where [dir] is 'left' or 'right'"
    if [[ "$1" == "clone" ]]; then
    echo "Cloning eDP1 onto HDMI1"
    xrandr --output HDMI1 --mode $RES
    sleep 1
    xrandr --output HDMI1 --same-as eDP1
    else
    echo "Usage: ./extend.sh [dir]"
    echo "where [dir] is 'left' or 'right' or 'clone'"
    fi
    fi
    fi
  3. Matt revised this gist Apr 5, 2013. 1 changed file with 13 additions and 8 deletions.
    21 changes: 13 additions & 8 deletions extend.sh
    100644 → 100755
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,17 @@
    #!/bin/sh
    #!/bin/bash

    if [ -z "$1" ]; then
    xrandr --output HDMI1 --mode 0x0
    else
    RES=`xrandr | grep -A1 HDMI1 | tail -n1 | awk '{ print $1 }'`
    echo "Detected HDMI1 with resolution ${RES}"
    echo "xrandr --output HDMI1 --mode ${RES}"
    xrandr --output HDMI1 --mode $RES
    sleep 1
    xrandr --output HDMI1 --right-of eDP1
    fi
    if [ "$1" == "right" ] || [ "$1" == "left" ]; then
    RES=`xrandr | grep -A1 HDMI1 | tail -n1 | awk '{ print $1 }'`
    echo "Detected HDMI1 with resolution ${RES}"
    echo "xrandr --output HDMI1 --mode ${RES}"
    xrandr --output HDMI1 --mode $RES
    sleep 1
    xrandr --output HDMI1 --$1-of eDP1
    else
    echo "Usage: ./extend.sh [dir]"
    echo "where [dir] is 'left' or 'right'"
    fi
    fi
  4. zmpeg created this gist Apr 4, 2013.
    12 changes: 12 additions & 0 deletions extend.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    #!/bin/sh

    if [ -z "$1" ]; then
    xrandr --output HDMI1 --mode 0x0
    else
    RES=`xrandr | grep -A1 HDMI1 | tail -n1 | awk '{ print $1 }'`
    echo "Detected HDMI1 with resolution ${RES}"
    echo "xrandr --output HDMI1 --mode ${RES}"
    xrandr --output HDMI1 --mode $RES
    sleep 1
    xrandr --output HDMI1 --right-of eDP1
    fi