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