-
Notifications
You must be signed in to change notification settings - Fork 12
/
screenshot.lua
41 lines (35 loc) · 1.22 KB
/
screenshot.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
local awful = require("awful")
local naughty = require("naughty")
timers = { 5,10 }
screenshot = os.getenv("HOME") .. "/Pictures/scrot/$(date +%F_%T).png"
function scrot_full()
scrot("scrot " .. screenshot .. " -e 'xclip -selection c -t image/png < $f', scrot_callback", scrot_callback, "Take a screenshot of entire screen")
end
function scrot_selection()
scrot("sleep 0.5 && scrot -s " .. screenshot .. " -e 'xclip -selection c -t image/png < $f'", scrot_callback, "Take a screenshot of selection")
end
function scrot_window()
scrot("scrot -u " .. screenshot .. " -e 'xclip -selection c -t image/png < $f'", scrot_callback, "Take a screenshot of focused window")
end
function scrot_delay()
items={}
for key, value in ipairs(timers) do
items[#items+1]={tostring(value) , "scrot -d ".. value.." " .. screenshot .. " -e 'xclip -selection c -t image/png < $f'","Take a screenshot of delay" }
end
awful.menu.new(
{
items = items
}
):show({keygrabber= true})
scrot_callback()
end
function scrot(cmd , callback, args)
awful.util.spawn_with_shell(cmd)
callback(args)
end
function scrot_callback(text)
naughty.notify({
text = text,
timeout = 0.5
})
end