5

I'm trying to make it so I can do a screen shot with with the PrintScrn button in Awesome WM. I found an ImageMagick script with keybinding in the Wiki, but I'm not able to make it work. The script works if I call it in the command line. What I can't wrap my mind around is what exactly the keybinding is supposed to be doing with the script. Pulled from the Wiki:

Script:

 #!/bin/bash
 timestamp="$(date +%Y%m%d%H%M%S)"
 targetbase="$HOME/capscr"
 mkdir -p $targetbase
 [ -d $targetbase ] || exit 1
 import -window root $targetbase/$timestamp.png

Keybinding:

 -- bind PrintScrn to capture a screen
  awful.key(
     {},
     "Print",
     function()
         awful.util.spawn("capscr",false)
    end
  )

I assume the "capscr" in the Lua code is calling the script? (The script is saved by the same name in my /home folder; specifically ~/.bin like it says in the Wiki). If not, do I need to do something else to the script and/or Lua code and/or ??? to make the two see each other? I've also tried putting the path of the script in the code to see if that worked, and nothing.

3

First of all you need make it executable. Then move it to /bin directory (you need root-rights):

$chmod +x capscr
$sudo mv ./capsrc /bin

I also recomend to you to edit capscr file, for example mine:

#!/bin/bash
timestamp="$(date +%d.%m.%Y"_shot_"%H:%M:%S)"
targetbase="$HOME/Pictures/screenshots"
mkdir -p $targetbase
[ -d $targetbase ] || exit 1
import -window root -quality 98 $targetbase/$timestamp.png

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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