mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-24 18:58:33 +02:00
bindings: add the ability to do a screenshot
This commit is contained in:
parent
4baa928dbc
commit
381812d843
2 changed files with 22 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
*~
|
*~
|
||||||
/wallpapers
|
/wallpapers
|
||||||
|
/screenshots
|
||||||
|
|
|
@ -36,6 +36,17 @@ local function client_info()
|
||||||
timeout = 0, margin = 10, screen = c.screen }
|
timeout = 0, margin = 10, screen = c.screen }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function screenshot(client)
|
||||||
|
if not client then
|
||||||
|
client = "root"
|
||||||
|
else
|
||||||
|
client = client.window
|
||||||
|
end
|
||||||
|
local path = awful.util.getdir("config") .. "/screenshots/" ..
|
||||||
|
"screenshot-" .. os.date("%Y-%m-%d--%H:%M:%S") .. ".png"
|
||||||
|
awful.util.spawn("import -window " .. client .. " " .. path, false)
|
||||||
|
end
|
||||||
|
|
||||||
config.keys.global = awful.util.table.join(
|
config.keys.global = awful.util.table.join(
|
||||||
keydoc.group("Focus"),
|
keydoc.group("Focus"),
|
||||||
awful.key({ modkey, }, "j",
|
awful.key({ modkey, }, "j",
|
||||||
|
@ -86,11 +97,15 @@ config.keys.global = awful.util.table.join(
|
||||||
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
|
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
|
||||||
"Swap with previous window"),
|
"Swap with previous window"),
|
||||||
|
|
||||||
-- Spawn a terminal
|
|
||||||
keydoc.group("Misc"),
|
keydoc.group("Misc"),
|
||||||
|
|
||||||
|
-- Spawn a terminal
|
||||||
awful.key({ modkey, }, "Return", function () awful.util.spawn(config.terminal) end,
|
awful.key({ modkey, }, "Return", function () awful.util.spawn(config.terminal) end,
|
||||||
"Spawn a terminal"),
|
"Spawn a terminal"),
|
||||||
|
|
||||||
|
-- Screenshot
|
||||||
|
awful.key({}, "Print", screenshot, "Screenshot"),
|
||||||
|
|
||||||
-- Restart awesome
|
-- Restart awesome
|
||||||
awful.key({ modkey, "Control" }, "r", awesome.restart, "Restart awesome"),
|
awful.key({ modkey, "Control" }, "r", awesome.restart, "Restart awesome"),
|
||||||
|
|
||||||
|
@ -124,7 +139,11 @@ config.keys.client = awful.util.table.join(
|
||||||
c.maximized_horizontal = not c.maximized_horizontal
|
c.maximized_horizontal = not c.maximized_horizontal
|
||||||
c.maximized_vertical = not c.maximized_vertical
|
c.maximized_vertical = not c.maximized_vertical
|
||||||
end,
|
end,
|
||||||
"Maximize")
|
"Maximize"),
|
||||||
|
|
||||||
|
|
||||||
|
-- Screenshot
|
||||||
|
awful.key({ modkey }, "Print", screenshot, "Screenshot")
|
||||||
)
|
)
|
||||||
|
|
||||||
config.mouse.client = awful.util.table.join(
|
config.mouse.client = awful.util.table.join(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue