Skip to content

Instantly share code, notes, and snippets.

@jjrh
Created May 22, 2025 15:48
Show Gist options
  • Save jjrh/e42bc2c07b6f1e80e2d7fa9aee6fa140 to your computer and use it in GitHub Desktop.
Save jjrh/e42bc2c07b6f1e80e2d7fa9aee6fa140 to your computer and use it in GitHub Desktop.
little script for toggling PIP on a dell monitor using ddcutil
#!/bin/bash
TARGET_DIS=1
VCP=E9
ON_VALUE=0x21
OFF_VALUE=0x00
# possible options:
# Feature: E9 (Manufacturer specific feature)
# Values: 00 01 02 21 22 24 (interpretation unavailable)
#
# 0x00 is off
# 0x01 toggles makes big small...
# 0x02 switches position?
# 0x21 is SMALL
# 0x22 is LARGE
# 0x24 half and half
while [ "$1" != "" ]; do
case $1 in
on|On|ON|1|off|Off|OFF|0)
D_VAL="${1^^}"
case $D_VAL in
ON|1)
SET_ON=1
;;
OFF|0)
SET_ON=0
;;
esac
;;
--dis=*)
TARGET_DIS=$(echo "$1" | sed 's/--dis=//g')
case $TARGET_DIS in
1)
PLACE_HOLDER=0
;;
2)
PLACE_HOLDER=0
;;
*)
echo "DISPLAY must be 1 or 2"
exit 1
esac
;;
*)
printf "unknown argument! '%s'\n" $1
printf " use --help / -h for usage examples\n"
exit 1
;;
esac
shift
done
if [ -z $SET_ON ]; then
echo "NEED ON or OFF arg!"
exit 1
fi
if [ $SET_ON == 1 ]; then
ddcutil --display=$TARGET_DIS setvcp $VCP $ON_VALUE
exit 1
fi
if [ $SET_ON == 0 ]; then
ddcutil --display=$TARGET_DIS setvcp $VCP $OFF_VALUE
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment