pup_event check if screen size is change

New to Puppy and have questions? Start here

Moderator: Forum moderators

Post Reply
User avatar
AntonioPt
Posts: 219
Joined: Wed Aug 11, 2021 7:41 pm
Has thanked: 99 times
Been thanked: 37 times

pup_event check if screen size is change

Post 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

Why astronauts use Linux
Because you can't open windows in space

Post Reply

Return to “Beginners Help”