You are not logged in.
Sup!
I want to know if it's possible to execute a command or a script when my screen resolution change....
any ideas...
Last edited by vigohe (2010-05-03 08:08:57)
Offline
It should be possible but I can't think of an elegant way atm. You could periodically check if a certain string is still
1440x900 59.9*+ 59.9*
, if not then ...
Happy parsing.
Offline
k! that string it is from ???????? xrandr?
Offline
Yeah, it's the output of 'xrandr'.
Offline
I did something else
I use inotifywait from inotify-tools to watch the Xorg log if something modifies the log.
#!/bin/sh
path="/var/log/Xorg.0.log"
OldRes=$( xrandr | grep '*' | awk '{print $1}' )
while [ 1 ]
do
EVENT=$(inotifywait -e modify $path)
NewRes=$(cat $path | tail -n 1 | grep -i "Allocate new frame buffer" | awk '{printf $7}')
if [ -n "$NewRes" -a "$NewRes"="$OldRes" ] ; then
echo "The Screen Resolution has changed " "$NewRes"
OldRes=$NewRes
fi
done
So now I can resize some stuff when I change the resolution xd ....
someone knows another way?
Last edited by vigohe (2010-05-03 08:07:40)
Offline