7

Tried:

awful.util.spawn("scrot -s")
awful.util.spawn("urxvt -e \"scrot -s\"")
os.execute("scrot -s")

and all possible combinations even with sleep.
Also tried daemonize.
Nothing works =( P.S. All commands are in key bindings, if I replace scrot -s with scrot, all works, except selecting area.

smt
  • 93
  • 1
  • 1
  • 6

2 Answers2

8

Since you have arguments in command line awful.util.spawn_with_shell() should be used. This

awful.util.spawn_with_shell("sleep 0.5 && scrot -s")

works fine for me.

3

I have been struggling with this too. spawn_with_shell is not the solution that makes it work for me. The screen flickers when I press the according hotkey, so that's configured correctly and when I press Win+r (run) and type path/to/screenshot.sh, that also works. This is the script following the shebang

scrot -s '%Y-%m-%d_$wx$h_scrot.png' -e 'mv $f /home/sam/Pictures/Screenshots'

This are the things I've tried:

screenshot = "/home/sam/run/screenshot.sh"
awful.spawn.with_shell(screenshot)

What does work is executing the bash scripts with the terminal: These are my variable definitions at the top of the page

screenshot = "/home/sam/run/screenshot.sh"
screenshot_cmd = terminal .. " -e " .. screenshot

And then way more down the file, I have these (both working)

awful.key({ modkey  ,         }, "#107", function () awful.spawn.with_shell(screenshot_cmd) end,
          {description = "take screenshot", group = "launcher"}),
awful.key({ modkey  , "Shift" }, "p", function () awful.spawn(screenshot_cmd) end,
          {description = "take screenshot", group = "launcher"}),

Unfortunately, the latter also opens a terminal window, which is not a desirabe behaviour (But at least, something is working