I use 1024x768 and find that it's not enough for some programs
(notably some audio applications). I have therefore implemented an
automatic scrolling mechanism for clients that are bigger than screen
resolution. It looks somewhat like this (ymmv depending on your
awesome version):

function scrollclient()
  local c = client.focus
  if not c then return end

  local ss = screen[c.screen].geometry
  local ws = screen[c.screen].workarea
  local cc = c:geometry()
  local mc = mouse.coords()
  local step = 0

  -- left edge
  if mc.x < config.scroll_offset and cc.x < 0 then
    step = math.min(config.step, -cc.x)
    awful.client.moveresize(step,0,0,0,c)
  end

  -- right edge
  if mc.x > ws.width - config.scroll_offset and cc.x + cc.width >
ws.width + 1 then
    step = math.min(config.step, cc.x + cc.width-ws.width)
    awful.client.moveresize(-step,0,0,0,c)
  end

  -- top edge
  if mc.y < config.scroll_offset and cc.y < ss.height - ws.height then
    step = math.min(config.step, ss.height - ws.height - cc.y - 1) --
FIXME: -1 is for the frame to hide under panels BROKEN
    awful.client.moveresize(0,step,0,0,c)
  end

  -- bottom edge
  if mc.y > ws.height - config.scroll_offset and cc.y + cc.height >
ss.height then
    step = math.min(config.step, cc.y + cc.height - ss.height)
    awful.client.moveresize(0,-step,0,0,c)
  end
end


client.add_signal("focus", function (c)
  -- see if the client needs scrolling
  local ws = screen[c.screen].workarea
  local geom = c:geometry()
  if (geom.width > ws.width or geom.height > ws.height)
    and not (awful.client.dockable.get(c) or c.fullscreen) then
      scrolltimer = timer({ timeout = 0.01 })
      scrolltimer:add_signal("timeout", scrollclient)
      scrolltimer:start()
  end
end)

koniu

-- 
To unsubscribe, send mail to [email protected].

Reply via email to