mirror of
https://github.com/arcan1s/dotfiles.git
synced 2025-07-18 16:19:57 +00:00
updated zshrc
This commit is contained in:
54
zshrc
54
zshrc
@ -297,35 +297,51 @@ pack () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# function to contorl xrandr
|
# functions to contorl xrandr
|
||||||
# EXAMPLE: projctl 1024x768
|
# EXAMPLE: projctl 1024x768
|
||||||
projctl() {
|
projctl() {
|
||||||
if [ $1 ]; then
|
MONITORS="$(xrandr | grep connected | cut -d ' ' -f 1 | tr '\n' ' ')"
|
||||||
if [ $1 = "-h" ]; then
|
echo "Available monitors are: ${MONITORS}"
|
||||||
echo "Usage: projctl [ off/resolution ]"
|
FIRSTMON="LVDS1"
|
||||||
return
|
SECONDMON="VGA1"
|
||||||
fi
|
RESOLUTION="1366x768"
|
||||||
|
until [ -z $1 ]; do
|
||||||
if [ $1 = "off" ]; then
|
case "$1" in
|
||||||
echo "Disable VGA1"
|
"-h" | "--help" ) echo "Usage: projctl [ off/resol ] [ -o MON | --output MON ]" && exit 0 ;;
|
||||||
xrandr --output VGA1 --off --output LVDS1 --mode 1366x768
|
"-o" | "--output" ) [ -z "$2" ] || SECONDMON="$2" && shift ;;
|
||||||
|
* ) RESOLUTION="$1" ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
if [[ "${RESOLUTION}" == "off" ]]; then
|
||||||
|
echo "Disable ${SECONDMON}"
|
||||||
|
xrandr --output ${FIRSTMON} --mode ${RESOLUTION} --output ${SECONDMON} --off
|
||||||
else
|
else
|
||||||
echo "Using resolution: $1"
|
echo "Using resolution: ${RESOLUTION}"
|
||||||
xrandr --output VGA1 --mode $1 --output LVDS1 --mode $1
|
xrandr --output ${FIRSTMON} --mode ${RESOLUTION} --output ${SECONDMON} --mode ${RESOLUTION}
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Using default resolution"
|
|
||||||
xrandr --output VGA1 --mode 1366x768 --output LVDS1 --mode 1366x768
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
twinmon() {
|
twinmon() {
|
||||||
|
MONITORS="$(xrandr | grep connected | cut -d ' ' -f 1 | tr '\n' ' ')"
|
||||||
|
echo "Available monitors are: ${MONITORS}"
|
||||||
FIRSTMON="LVDS1"
|
FIRSTMON="LVDS1"
|
||||||
SECONDMON="VGA1"
|
SECONDMON="VGA1"
|
||||||
if [[ $1 == "off" ]]; then
|
MODE="on"
|
||||||
xrandr --output $FIRSTMON --auto --primary --output $SECONDMON --off
|
until [ -z $1 ]; do
|
||||||
|
case "$1" in
|
||||||
|
"-h" | "--help" ) echo "Usage: twinmon [ off ] [ -o MON | --output MON ]" && exit 0 ;;
|
||||||
|
"-o" | "--output" ) [ -z "$2" ] || SECONDMON="$2" && shift ;;
|
||||||
|
"off" ) MODE="off" ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
if [[ "${MODE}" == "off" ]]; then
|
||||||
|
echo "Disable ${SECONDMON}"
|
||||||
|
xrandr --output ${FIRSTMON} --auto --primary --output ${SECONDMON} --off
|
||||||
else
|
else
|
||||||
xrandr --output $FIRSTMON --auto --primary --output $SECONDMON --auto --left-of $FIRSTMON
|
echo "Enable ${SECONDMON}"
|
||||||
|
xrandr --output ${FIRSTMON} --auto --primary --output ${SECONDMON} --auto --left-of ${FIRSTMON}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user