Moving client from the keyboard
From awesome
The following allows to move a floating client or a client in a floating layout:
- of 5px in any direction with modkey and the keypad numbers.
- to the screen's working area border with modkey + ctrl and the keypad numbers.
k_m = { modkey }
k_ms = { modkey , "Shift"}
function floats(c)
local ret = false
local l = awful.layout.get(c.screen)
if awful.layout.getname(l) == 'floating' or awful.client.floating.get(c) then
ret = true
end
return ret
end
and in clientkeys:
-- move floating windows
awful.key(k_m, "KP_End", function(c)
if floats(c) then
local g = c:geometry()
g.x = g.x - 5
g.y = g.y + 5
c:geometry(g)
mouse_warp(c)
end
end),
awful.key(k_m, "KP_Down", function(c)
if floats(c) then
local g = c:geometry()
g.y = g.y + 5
c:geometry(g)
mouse_warp(c)
end
end),
awful.key(k_m, "KP_Next", function(c)
if floats(c) then
local g = c:geometry()
g.x = g.x + 5
g.y = g.y + 5
c:geometry(g)
mouse_warp(c)
end
end),
awful.key(k_m, "KP_Left", function(c)
if floats(c) then
local g = c:geometry()
g.x = g.x - 5
c:geometry(g)
mouse_warp(c)
end
end),
awful.key(k_m, "KP_Right", function(c)
if floats(c) then
local g = c:geometry()
g.x = g.x + 5
c:geometry(g)
mouse_warp(c)
end
end),
awful.key(k_m, "KP_Home", function(c)
if floats(c) then
local g = c:geometry()
g.x = g.x - 5
g.y = g.y - 5
c:geometry(g)
mouse_warp(c)
end
end),
awful.key(k_m, "KP_Up", function(c)
if floats(c) then
local g = c:geometry()
g.y = g.y - 5
c:geometry(g)
mouse_warp(c)
end
end),
awful.key(k_m, "KP_Prior", function(c)
if floats(c) then
local g = c:geometry()
g.x = g.x + 5
g.y = g.y - 5
c:geometry(g)
mouse_warp(c)
end
end),
-- move floating windows to screen edges
awful.key(k_ms, "KP_End", function(c)
if floats(c) then
local g = c:geometry()
local w = screen[c.screen].workarea
g.x = 0 + w.x
g.y = w.height - g.height + w.y
c:geometry(g)
mouse_warp(c)
end
end),
awful.key(k_ms, "KP_Down", function(c)
if floats(c) then
local g = c:geometry()
local w = screen[c.screen].workarea
g.x = (w.width - g.width)/2 + w.x
g.y = w.height - g.height + w.y
c:geometry(g)
mouse_warp(c)
end
end),
awful.key(k_ms, "KP_Next", function(c)
if floats(c) then
local g = c:geometry()
local w = screen[c.screen].workarea
g.x = w.width - g.width + w.x
g.y = w.height - g.height + w.y
c:geometry(g)
mouse_warp(c)
end
end),
awful.key(k_ms, "KP_Left", function(c)
if floats(c) then
local g = c:geometry()
local w = screen[c.screen].workarea
g.x = 0 + w.x
g.y = (w.height - g.height)/2 + w.y
c:geometry(g)
mouse_warp(c)
end
end),
awful.key(k_ms, "KP_Begin", function(c)
if floats(c) then
local g = c:geometry()
local w = screen[c.screen].workarea
g.x = (w.width - g.width)/2 + w.x
g.y = (w.height - g.height)/2 + w.y
c:geometry(g)
mouse_warp(c)
end
end),
awful.key(k_ms, "KP_Right", function(c)
if floats(c) then
local g = c:geometry()
local w = screen[c.screen].workarea
g.x = w.width - g.width + w.x
g.y = (w.height - g.height)/2 + w.y
c:geometry(g)
mouse_warp(c)
end
end),
awful.key(k_ms, "KP_Home", function(c)
if floats(c) then
local g = c:geometry()
local w = screen[c.screen].workarea
g.x = 0 + w.x
g.y = 0 + w.y
c:geometry(g)
mouse_warp(c)
end
end),
awful.key(k_ms, "KP_Up", function(c)
if floats(c) then
local g = c:geometry()
local w = screen[c.screen].workarea
g.x = (w.width - g.width)/2 + w.x
g.y = 0 + w.y
c:geometry(g)
mouse_warp(c)
end
end),
awful.key(k_ms, "KP_Prior", function(c)
if floats(c) then
local g = c:geometry()
local w = screen[c.screen].workarea
g.x = w.width - g.width + w.x
g.y = 0 + w.y
c:geometry(g)
mouse_warp(c)
end
end),