archcraft-os / archcraft-openbox

// Configuration : Openbox
GNU General Public License v3.0
101 stars 15 forks source link

[Adjustment] Drag window to move, when window maximized #8

Closed samwhelp closed 8 months ago

samwhelp commented 1 year ago

[Adjustment] Drag window to move, when window maximized

Drag window to move, when window maximized.

According archcraft-openbox / rc.xml

I create a sample for explaining this feature.

archcraft-openbox / adjustment / mousebind

context Titlebar / orginal

  <mouse>
    <context name="Titlebar">

      <mousebind action="Drag" button="A-Left">
        <action name="Move"/>
      </mousebind>

      <mousebind action="Drag" button="Left">
        <action name="if">
          <maximizedvertical>yes</maximizedvertical>
          <then>
            <action name="Unmaximize"/>
            <direction>vertical</direction>
            <action name="MoveResizeTo">
              <x>center</x>
              <y>current</y>
            </action>
            <action name="Move"/>
          </then>
          <else>
            <action name="Move"/>
          </else>
        </action>
      </mousebind>

    </context>
  </mouse>

context Titlebar / adjust

  <mouse>
    <context name="Titlebar">

      <!--
      <mousebind action="Drag" button="A-Left">
        <action name="Move"/>
      </mousebind>
      //-->

      <mousebind action="Drag" button="Left">
        <action name="if">
          <maximized>yes</maximized>
          <then>
            <action name="UnmaximizeFull"/>
            <action name="MoveResizeTo">
              <x>center</x>
              <y>current</y>
            </action>
            <action name="Move"/>
          </then>
          <else>
            <action name="Move"/>
          </else>
        </action>
      </mousebind>

    </context>
  </mouse>

context Frame / orginal

  <mouse>
    <context name="Frame">
      <mousebind action="Drag" button="W-Left">
        <action name="Move"/>
      </mousebind>
    </context>
  </mouse>

context Frame / adjust

  <mouse>
    <context name="Frame">
      <!--
      <mousebind action="Drag" button="W-Left">
        <action name="Move"/>
      </mousebind>
      //-->
      <mousebind action="Drag" button="A-Left">
        <action name="if">
          <maximized>yes</maximized>
          <then>
            <action name="UnmaximizeFull"/>
            <action name="MoveResizeTo">
              <x>center</x>
              <y>current</y>
            </action>
            <action name="Move"/>
          </then>
          <else>
            <action name="Move"/>
          </else>
        </action>
      </mousebind>
    </context>
  </mouse>

Link

adi1090x commented 8 months ago

That's the default behavior already. Just some extra code here for config file.