Skip to content

Instantly share code, notes, and snippets.

@blueyed
Created March 27, 2014 11:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blueyed/9805873 to your computer and use it in GitHub Desktop.
Save blueyed/9805873 to your computer and use it in GitHub Desktop.
--- Put a client relatively on the screen's workarea (sets floating state).
-- @param c A client.
-- @param x X position multipler (0.5 for center).
-- @param y Y position multiplier (0.5 for center).
-- @param width Width multiplier.
-- @param width Height multiplier.
local put_client = function(c, x, y, width, height)
local wa = capi.screen[c.screen].workarea
local geo = {
x = wa.x + (wa.width * x),
y = wa.y + (wa.height * y),
width = wa.width * width,
height = wa.height * height,
}
-- Float before raising
-- c.maximized_vertical = false
-- c.maximized_horizontal = false
c.maximized = false
c:geometry(geo)
awful.client.floating.set(c, true)
-- c:raise()
end
clientkeys = awful.util.table.join(
-- workarea corners.
awful.key({ modkey, "Control" }, "Page_Up", function (c) put_client(c, 0.5, 0.0, 0.5, 0.5) end),
awful.key({ modkey, "Control" }, "Page_Down", function (c) put_client(c, 0.5, 0.5, 0.5, 0.5) end),
awful.key({ modkey, "Control" }, "Home", function (c) put_client(c, 0.0, 0.0, 0.5, 0.5) end),
awful.key({ modkey, "Control" }, "End", function (c) put_client(c, 0.0, 0.5, 0.5, 0.5) end),
-- left / right.
awful.key({ modkey, "Control" }, "Left", function (c) put_client(c, 0.0, 0.0, 0.5, 1) end),
awful.key({ modkey, "Control" }, "Right", function (c) put_client(c, 0.5, 0.0, 0.5, 1) end),
-- top / bottom.
awful.key({ modkey, "Control" }, "Up", function (c) put_client(c, 0.0, 0.0, 1.0, 0.5) end),
awful.key({ modkey, "Control" }, "Down", function (c) put_client(c, 0.0, 0.5, 1.0, 0.5) end),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment