title: xdotool not working inside a shell script
body: <p>I am trying to make the wallpaper changing process easier in AwesomeWM with a script which reads a path to an image and replaces the existing wallpaper with the path I gave; and then restart the WM.</p>
  
  <p>My code looks like:</p>
  
  <pre><code>#!/bin/bash
  
  if [[ $1 != "" ]] &amp;&amp; [ -f $1 ]; then
          cp $1 /usr/local/share/awesome/themes/modded/background.png
          xdotool key super+ctrl+r
  else
          echo 'Invalid file!'
  fi
  </code></pre>
  
  <p>Unfortunately, xdotool won't work and I don't know why, because if I issue it from a terminal (outside of a script), it will restart my window manager perfectly (super+ctrl+r restarts AwesomeWM).</p>
  
  <p>I know it would be better to use <code>awesome.restart</code> function from rc.lua, but I don't know how to implement or include this code inside my shell script.</p>