title: wmctrl not working in crontab
body: <p>I'm using Linux (Ubuntu). I use <code>wmctrl</code> to make the <code>firefox</code> window always on top. And it worked FINE when I run the shell on a <strong>terminal</strong>.</p>
  
  <p>Here is my shell code (say that it was <code>/usr/app/keepfront.sh</code>):</p>
  
  <pre><code>#!/bin/bash
  WINTITLE="Mozilla Firefox" # Main Firefox window has this in titlebar
  PROGNAME="firefox mywebsite --sync" #run the firefox program
  
  #Use wmctrl to list all windows, count how many contain WINTITLE
  WINCOUNT=wmctrl -l | grep -c "$WINTITLE"
  
  if [ $WINCOUNT != 0 ]
  then
      wmctrl -a "$WINTITLE" # If it exists, bring window to front
  else
      $PROGNAME &amp; # Otherwise, just launch ff
  fi
  exit 0
  </code></pre>
  
  <p>I would like to use crontab to run the shell every 1 minute. Crontab DID run the shell (I wrote some echos), but <strong>nothing happened</strong>.</p>
  
  <p>Here is my crontab code:</p>
  
  <pre><code>*/1 * * * *   /usr/app/keepfront.sh
  </code></pre>
  
  <p>Anyone know WHY? How to solve this?</p>