[openbox] Mousebind In Client Context

Mikael Magnusson mikachu at gmail.com
Sun Aug 7 08:26:18 EDT 2011


On 7 August 2011 12:51, Paul <openboxml023478 at rainslide.net> wrote:
> I have this, which closes whichever window the cursor is over:
>
> <mouse>
>    <context name="Frame">
>      <mousebind button="Button8" action="Click">
>          <action name="Close"/>
>      </mousebind>
>    </context>
> </mouse>
>
> I'd like that when the cursor is in the Client context of an Opera window,
> and I press Button8, instead of closing Opera, it closes the tab, ie. issues
> a ctrl-w key press. I can issue the ctrl-w with xdotool in an
> <action>...<command>, but what I don't know is how to define that within an
> Opera Client context only. I'm thinking something like this:
>
> <mouse>
>    <context name="Client">
>        <application class="Opera" name="opera" type="normal">
>            <mousebind button="Button8" action="Click">
>                <action name="Execute">
>                    <command>xdotool key ctrl+w</command>
>                </action>
>            </mousebind>
>        </application>
>    </context>
> </mouse>
>
> When I put the <application> block into my Client context section, Openbox
> doesn't give an error when I reconfigure it, but neither does it make a
> difference.

Yeah, it's strange but making up syntax doesn't work. ;) What you can
actually do is
<action name="If">
  <title>Opera *</title>
  <then>
     <action name="Execute">...</action>
  </then>
  <else>
     <action name="Close"/>
  </else>
</action>

Also note that if you bind the frame context for a button, the client
context for that button will not be reached, but the only difference
is the client context will pass the click through, which i don't think
makes sense to do in this case anyway, so put the above in the frame
context.

-- 
Mikael Magnusson


More information about the openbox mailing list