On 22/03/2010, Tuomo Valkonen <[email protected]> wrote:
> On 2010-03-19 14:33 +0200, M. Rawash wrote:
>> hi, is there a simple way to disable 'mousefocus' on certain clients
>> (a on-screen keyboard, for example)?
>
> There's the 'passive' winprop. There should be examples in the
> list archives, maybe even something in the scripts repository.
>
> --
> Tuomo
>

thanks, i thought there must be a more obvious way, but this is what i did:

defwinprop{
  class = "Something",
  float = true,
  userpos = true,
  switchto = false,
  no_focus = true,
}

nmfcwins = {}

function no_mfocus(cwin,t)
  local winprop = ioncore.getwinprop(cwin)
  if winprop and winprop.no_focus then
    nmfcwins[cwin:xid()] = cwin:xid()
    ioncore.set{mousefocus="disabled"}
  end
end

function ret_mfocus(cxid)
  if nmfcwins[cxid]==cxid then
    nmfcwins[cxid]=nil
    if table.maxn(nmfcwins)==0 then
      ioncore.set{mousefocus="sloppy"}
    end
  end
end

ioncore.get_hook('clientwin_mapped_hook'):add(no_mfocus)
ioncore.get_hook('clientwin_unmapped_hook'):add(ret_mfocus)

this is only good for a few cases (i.e. a on-screen keyboard, that's
activated from the systray), but it does the job for me; i'll
investigate the passive property further, i noticed it before, but
wasn't sure how to use it in this case.

regards,
M Rawash

Reply via email to