Page 1 of 1

pup_event check if screen size is change

Posted: Sat Aug 17, 2024 4:21 pm
by AntonioPt

Hello all,
is there any way to tell pup_even when screen size is change ?
so far i manager to achive this :D

Code: Select all

READ_XORG="$(grep -E -i "(Output.*using|Setting.*Mode)" /var/log/Xorg.0.log | tail -1 )"
CURR_SIZE="$(echo ${READ_XORG} | grep -E -o '[0-9]{3,}x[0-9]{3,}')"
echo "CURR_SIZE = ${CURR_SIZE} "
SIZE_FILE="/tmp/size.txt"

if [ ! -f "${SIZE_FILE}" ] ; then
	# first time add current screen
	echo $CURR_SIZE > "${SIZE_FILE}"
else
	# lets check if size is difrent and if so call my  script
	if [ "${CURR_SIZE}" != "$(cat ${SIZE_FILE})" ] ; then
		echo "new Size"
		# lets call my script
		
		# add new screen size in tmp file
		echo "${CURR_SIZE}" > "${SIZE_FILE}"
	fi
fi

thxx