0

Basically, I want to have a printscreen key so I added into my rc.lua

awful.key({}, "Print", function() awful.util.spawn("flameshot screen -p /my/path/__date__time__.png") end)

to do the key binding.

How do I have date/time as variable in this command, so that the screenshot is savec under /my/path/2021-11-04_12-12 for example?

sayanel
  • 301
  • 2
  • 12
  • 1
    Flameshot dev here. I didn't create an answer here as the question is more for AwesomeWM than Flameshot. But you don't even need to do this to get the date in the file name. Just set the pattern in your config, either through the `flameshot config` and in the GUI window the "Filename Editor", or you can add `filenamePattern=%F_%H-%M` in the `[General]` section of your config file (`~/.config/flameshot/flameshot.ini`) – Mehrad Mahmoudian Jun 21 '22 at 12:14

1 Answers1

2

If os.date() is present than...

awful.key({}, "Print", function() awful.util.spawn("flameshot screen -p /my/path/" .. os.date('%Y-%m-%d_%H-%M.png')) end)

The os.date() function is able to return a formated time string.
See also: https://www.lua.org/manual/5.4/manual.html#6.9

koyaanisqatsi
  • 2,585
  • 2
  • 8
  • 15