Permalink
Browse files

1/3 height added, trying to get current screen - but thats not working

  • Loading branch information...
1 parent 679dd9d commit 27486695672cc8dd87dd348ab99cad13dff30694 @thet committed Feb 24, 2011
Showing with 127 additions and 4 deletions.
  1. +127 −4 grid.lua
View
131 grid.lua
@@ -119,29 +119,152 @@ globalkeys = awful.util.table.join(
return x,y,w,h
end
)
+ end),
+
+-- ############# 1/3 height
+-- ###########
+-- ###
+
+ awful.key({modkey, "Control", "Shift"}, "a",
+ function ()
+ set_grid(
+ function()
+ w = math.floor(sgeo.width/divisor)
+ x = 0
+ y = wiboxh + math.floor(sgeo.height - wiboxh) / 3
+ h = math.floor(sgeo.height - wiboxh) / 3
+ return x,y,w,h
+ end
+ )
+ end),
+ awful.key({modkey, "Control", "Shift"}, "d",
+ function ()
+ set_grid(
+ function()
+ w = math.floor(sgeo.width/divisor)
+ x = sgeo.width - w
+ y = wiboxh + math.floor(sgeo.height - wiboxh) / 3
+ h = math.floor(sgeo.height - wiboxh) / 3
+ return x,y,w,h
+ end
+ )
+ end),
+ awful.key({modkey, "Control", "Shift"}, "s",
+ function ()
+ set_grid(
+ function()
+ w = math.floor(sgeo.width/divisor)
+ x = math.floor((sgeo.width - w) / 2)
+ y = wiboxh + math.floor(sgeo.height - wiboxh) / 3
+ h = math.floor(sgeo.height - wiboxh) / 3
+ return x,y,w,h
+ end
+ )
+ end),
+
+
+ -- upper
+ awful.key({modkey, "Control", "Shift"}, "q",
+ function()
+ set_grid(
+ function()
+ w = math.floor(sgeo.width/divisor)
+ x = 0
+ y = wiboxh
+ h = math.floor(sgeo.height - wiboxh) / 3
+ return x,y,w,h
+ end
+ )
+ end),
+ awful.key({modkey, "Control", "Shift"}, "e",
+ function ()
+ set_grid(
+ function()
+ w = math.floor(sgeo.width/divisor)
+ x = sgeo.width - w
+ y = wiboxh
+ h = math.floor(sgeo.height - wiboxh) / 3
+ return x,y,w,h
+ end
+ )
+ end),
+ awful.key({modkey, "Control", "Shift"}, "w",
+ function ()
+ set_grid(
+ function()
+ w = math.floor(sgeo.width/divisor)
+ x = math.floor((sgeo.width - w) / 2)
+ y = wiboxh
+ h = math.floor(sgeo.height - wiboxh) / 3
+ return x,y,w,h
+ end
+ )
+ end),
+
+
+ -- lower
+ awful.key({modkey, "Control", "Shift"}, "y",
+ function()
+ set_grid(
+ function()
+ w = math.floor(sgeo.width/divisor)
+ x = 0
+ y = math.floor((sgeo.height - wiboxh)*2 / 3 + wiboxh)
+ h = math.floor(sgeo.height - wiboxh) / 3
+ return x,y,w,h
+ end
+ )
+ end),
+ awful.key({modkey, "Control", "Shift"}, "c",
+ function ()
+ set_grid(
+ function()
+ w = math.floor(sgeo.width/divisor)
+ x = sgeo.width - w
+ y = math.floor((sgeo.height - wiboxh)*2 / 3 + wiboxh)
+ h = math.floor(sgeo.height - wiboxh) / 3
+ return x,y,w,h
+ end
+ )
+ end),
+ awful.key({modkey, "Control", "Shift"}, "x",
+ function ()
+ set_grid(
+ function()
+ w = math.floor(sgeo.width/divisor)
+ x = math.floor((sgeo.width - w) / 2)
+ y = math.floor((sgeo.height - wiboxh)*2 / 3 + wiboxh)
+ h = math.floor(sgeo.height - wiboxh) / 3
+ return x,y,w,h
+ end
+ )
end)
+
)
root.keys(globalkeys)
show_geo = true
function set_grid(geofun)
+ curclient = client.focus
+
-- screen
- sgeo = screen[mouse.screen].geometry
+ scr = curclient.screen
+ sgeo = screen[scr].geometry
-- wibox
- wgeo = mywibox[mouse.screen]:geometry()
- wvis = mywibox[mouse.screen].visible
+ wgeo = mywibox[scr]:geometry()
+ wvis = mywibox[scr].visible
wiboxh = wvis and wgeo.height or 0
-- client
- curclient = client.focus
cgeo = curclient:geometry()
divisor = get_divisor(curclient, cgeo.width, sgeo.width)
x,y,w,h = geofun()
awful.client.floating.set(curclient, true)
+ -- awful.client.movetoscreen(curclient, scr)
curclient:geometry({x=x, y=y, width=w, height=h})
curclient:raise()

0 comments on commit 2748669

Please sign in to comment.