How I can create a shortcut to maximize/minimize windows in Lubuntu?

Solution 1:

Here are some keybindings I use for window control on Lubuntu/LXDE. The first binding is what you're searching for but I thought you might find the other ones useful as well:

<!-- Keybindings for window tiling -->

    <keybind key="C-W-Up">        # FullScreen
      <action name="Maximize"/>
    </keybind>
    <keybind key="C-W-Down">        # MiddleScreen
      <action name="UnmaximizeFull"/>
      <action name="MoveResizeTo"><x>center</x><y>center</y><width>50%</width><height>50%</height></action>
    </keybind>

    <keybind key="C-W-Left">        # HalfLeftScreen
      <action name="UnmaximizeFull"/>
      <action name="MoveResizeTo"><x>0</x><y>0</y><height>100%</height><width>50%</width></action>
    </keybind>
    <keybind key="C-W-Right">        # HalfRightScreen
      <action name="UnmaximizeFull"/>
      <action name="MoveResizeTo"><x>-0</x><y>0</y><height>100%</height><width>50%</width></action>
    </keybind>

    <keybind key="C-W-1">        # UpperQuarterLeft
      <action name="UnmaximizeFull"/>
      <action name="MoveResizeTo"><x>0</x><y>0</y><height>50%</height><width>50%</width></action>
    </keybind>

    <keybind key="C-W-2">        # LowerQuarterLeft
      <action name="UnmaximizeFull"/>
      <action name="MoveResizeTo"><x>0</x><y>-0</y><height>50%</height><width>50%</width></action>
    </keybind>

    <keybind key="C-W-3">        # LowerQuarterRight
      <action name="UnmaximizeFull"/>
      <action name="MoveResizeTo"><x>-0</x><y>-0</y><height>50%</height><width>50%</width></action>
    </keybind>

    <keybind key="C-W-4">        # UpperQuarterRight
      <action name="UnmaximizeFull"/>
      <action name="MoveResizeTo"><x>-0</x><y>0</y><height>50%</height><width>50%</width></action>
    </keybind>

You might have to tweak the percentages based on whether you use a panel or not.

C-W-Up means CTRL + SUPER +

Solution 2:

For completeness of this thread, I'm going to collate some information from elsewhere.

To edit the config file:

gedit ~/.config/openbox/lubuntu-rc.xml

To apply the changes:

openbox --reconfigure

And personally, I want windows key (or super key) + up to toggle maximization and W+down to minimize (or iconify), so I personally change

<keybind key="W-Up">         # HalfUpperScreen
  <action name="UnmaximizeFull"/>
  <action name="MoveResizeTo"><x>0</x><y>0</y><width>100%</width><height>50%</height></action>
</keybind>
<keybind key="W-Down">       # HalfLowerScreen
  <action name="UnmaximizeFull"/>
  <action name="MoveResizeTo"><x>0</x><y>-0</y><width>100%</width><height>50%</height></action>
</keybind>

to

<keybind key="W-Up">        # Maximize
  <action name="ToggleMaximize"/>
</keybind>
<keybind key="W-Down">      # Minimize
  <action name="Iconify"/>
</keybind>

Solution 3:

To open all applications maximized (not full screen as with F11), place the following code between <applications> and </applications> in lubuntu-rc.xml:

<application type="normal">
  <maximized>true</maximized>
</application>

This code is already present, but is commented out along with a lot of other useful options, in the applications section of lubuntu-rc.xml.