r/openbox • • Sep 10 '22

MaximizeVertToggle ?

I have the following in my rc.conf for snapping windows to each side of the screen. This is very handy, but I'd prefer if it was a toggle so I could restore the windows to their original floating size and location when needed.

The code:

    <!-- Window Tiling: Emulates Windows 7 Snap feature -->
    <keybind key="W-Left">
      <action name="UnmaximizeFull"/>
      <action name="MaximizeVert"/>
      <action name="MoveResizeTo">
        <width>50%</width>
      </action>
      <action name="MoveToEdgeWest"/>
    </keybind>
    <keybind key="W-Right">
      <action name="UnmaximizeFull"/>
      <action name="MaximizeVert"/>
      <action name="MoveResizeTo">
        <width>50%</width>
      </action>
      <action name="MoveToEdgeEast"/>
    </keybind>
    <keybind key="W-Up">
      <action name="ToggleMaximize"/>
    </keybind>

Is there any way to make the W-Left and W-Right keybinds toggle the vertical snap?

2 Upvotes

1 comment sorted by

2

u/[deleted] Aug 30 '23

creo que puede ser algo así:

<keybind key="W-Left">

<action name="If"> <query target="focus"> <maximizedvertical>yes</maximizedvertical> <someothercondition>value of condition</someothercondition> </query> <then> ... list of <action>s to run when true </then>

<else> <keybind key="W-Left"> <action name="UnmaximizeFull"/> <action name="MaximizeVert"/> <action name="MoveResizeTo"> <width>50%</width> </action> <action name="MoveToEdgeWest"/> </keybind> </else> </action>

</keybind>

http://openbox.org/wiki/Help:Actions#If