Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a small shell script that plays a little jingle and displays a notification whenever I get a new email.

The problem is that this shell script can get invoked anytime - including when I'm watching a DVD / video in fullscreen mode with the sound turned up quite a bit - which is quite annoying.

I'd like to enhance this script with the ability to detect whether an application is in fullscreen mode. I know this must be somehow possible because notifications don't display under those circumstances.

What command can I use?

share|improve this question
    
check this link is that helpful ubuntuforums.org/showthread.php?t=1697522 –  myusuf3 Mar 13 '11 at 8:16
add comment

1 Answer 1

up vote 3 down vote accepted

Kind of extreme overkill as a shell script, but it should do the trick:

#!/bin/bash
WINDOW=$(echo $(xwininfo -id $(xdotool getactivewindow) -stats | \
                egrep '(Width|Height):' | \
                awk '{print $NF}') | \
         sed -e 's/ /x/')
SCREEN=$(xdpyinfo | grep -m1 dimensions | awk '{print $2}')
if [ "$WINDOW" = "$SCREEN" ]; then
    exit 0
else
    exit 1
fi

Then you can check it:

if is-full-screen ; then echo yup, full screen ; fi

As pointed out below, you'll need to install xdotool first:

sudo apt-get install xdotool
share|improve this answer
    
Wow... +1 for such an in-depth script. One thing to note: xdotool is a separate package that isn't installed by default. –  Nathan Osman Mar 15 '11 at 3:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.