You are not logged in.

#1 2017-07-17 16:30:22

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Manual tiling with Openbox

Set up Openbox tiling behaviour with keybinds

Without some heavy scripting it isn't possible to have automatic grid tiling in Openbox, but it is possible to use the included Openbox keybind actions to place and move windows around the screen.

Demo on youtube

Some of this came from the #! forum: Window positioning with NUM Keypad in bunsenlabs (Openbox)
And this is also a useful reference: Urukrama: Manual Tiling in Openbox

These keybinds assume the keyboard has a numpad, and a single monitor is being used. Having a keyboard with a numpad makes things more intuitive, but I dare say you can set up alternatives if you don't have a numpad.

<!-- Openbox window management and tiling behaviour
                                by damo, August 2017
    
     Copy and paste these keybinds into '~/.config/openbox/rc.xml'

     Ensure that any existing clashes in the rc.xml are removed first
-->

    <!-- "Tiling" keybinds -->
    <!-- Grow to edge -->
    <keybind key="C-Right">
      <action name="GrowToEdgeEast"/>
    </keybind>
    <keybind key="C-Left">
      <action name="GrowToEdgeWest"/>
    </keybind>
    <keybind key="C-Down">
      <action name="GrowToEdgeSouth"/>
    </keybind>
    <keybind key="C-Up">
      <action name="GrowToEdgeNorth"/>
    </keybind>
    <keybind key="C-KP_5">
      <action name="GrowToFill"/>
    </keybind>
    
    <!-- Move and resize -->
    <keybind key="W-KP_4">        <!-- MoveResizeTo Left half of screen -->
      <action name="UnmaximizeFull"/>
      <action name="MaximizeVert"/>
      <action name="Raise"/>
      <action name="MoveResizeTo">
        <width>50%</width>
        <x>0</x>
        <y>0</y>
      </action>
    </keybind>
    <keybind key="W-KP_6">        <!--MoveResizeTo Right half of screen -->
      <action name="UnmaximizeFull"/>
      <action name="MaximizeVert"/>
      <action name="Raise"/>
      <action name="MoveResizeTo">
        <width>50%</width>
        <x>50%</x>
        <y>0</y>
      </action>
    </keybind>
    <keybind key="W-KP_8">        <!--MoveResizeTo Top half of screen -->
      <action name="UnmaximizeFull"/>
      <action name="Raise"/>
      <action name="MoveResizeTo">
        <x>0</x>
        <y>0</y>
        <width>100%</width>
        <height>50%</height>
      </action>
    </keybind>
    <keybind key="W-KP_2">        <!--MoveResizeTo Bottom half of screen -->
      <action name="UnmaximizeFull"/>
      <action name="Raise"/>
      <action name="MoveResizeTo">
        <x>0</x>
        <y>50%</y>
        <width>100%</width>
        <height>50%</height>
      </action>
    </keybind>
    <keybind key="W-KP_7">        <!--MoveResizeTo Top left quarter -->
      <action name="UnmaximizeFull"/>
      <action name="Raise"/>
      <action name="MoveResizeTo">
        <x>0</x>
        <y>0</y>
        <width>50%</width>
        <height>50%</height>
      </action>
    </keybind>
    <keybind key="W-KP_9">        <!--MoveResizeTo Top right quarter -->
      <action name="UnmaximizeFull"/>
      <action name="Raise"/>
      <action name="MoveResizeTo">
        <x>50%</x>
        <y>0</y>
        <width>50%</width>
        <height>50%</height>
      </action>
    </keybind>
    <keybind key="W-KP_1">        <!--MoveResizeTo Bottom left quarter -->
      <action name="UnmaximizeFull"/>
      <action name="Raise"/>
      <action name="MoveResizeTo">
        <x>0</x>
        <y>50%</y>
        <width>50%</width>
        <height>50%</height>
      </action>
    </keybind>
    <keybind key="W-KP_3">        <!--MoveResizeTo Bottom right quarter -->
      <action name="UnmaximizeFull"/>
      <action name="Raise"/>
      <action name="MoveResizeTo">
        <x>50%</x>
        <y>50%</y>
        <width>50%</width>
        <height>50%</height>
      </action>
    </keybind>
        
    <!-- Move windows -->
    <keybind key="W-KP_5">        <!-- Center window (size will change) -->
      <action name="UnmaximizeFull"/>
      <action name="Raise"/>
      <action name="MoveResizeTo">
        <x>center</x>
        <y>center</y>
        <width>50%</width>
        <height>75%</height>
      </action>
    </keybind>
    
    <keybind key="W-A-Right">         <!-- Move to Right edge -->
      <action name="MoveToEdge">
        <direction>east</direction>
      </action>
    </keybind>
    <keybind key="W-A-Left">          <!-- Move to Left edge -->
      <action name="MoveToEdge">
        <direction>west</direction>
      </action>
    </keybind>
    <keybind key="W-A-Up">            <!-- Move to Top edge -->
      <action name="MoveToEdge">
        <direction>north</direction>
      </action>
    </keybind>
    <keybind key="W-A-Down">          <!-- Move to Bottom edge -->
      <action name="MoveToEdge">
        <direction>south</direction>
      </action>
    </keybind>
    
    <!-- Move to corner -->
    <keybind key="W-A-KP_9">    <!-- put the window in the top right corner -->
      <action name="Raise"/>
      <action name="MoveResizeTo"> 
        <x>-0</x>
        <y>0</y>
      </action>
    </keybind>
    <keybind key="W-A-KP_3">    <!-- put the window in the bottom right corner -->
      <action name="Raise"/>
      <action name="MoveResizeTo"> 
        <x>-0</x>
        <y>-0</y>
      </action>
    </keybind>
    <keybind key="W-A-KP_1">    <!-- put the window in the bottom left corner -->
      <action name="Raise"/>
      <action name="MoveResizeTo"> 
        <x>0</x>
        <y>-0</y>
      </action>
    </keybind>
    <keybind key="W-A-KP_7">    <!-- put the window in the top left corner -->
      <action name="Raise"/>
      <action name="MoveResizeTo"> 
        <x>0</x>
        <y>0</y>
      </action>
    </keybind>
Window moving with two monitors

This moves the window to the same position on another monitor:

   <!-- Move to monitor -->
    <keybind key="C-W-Right">           <!-- move the window to the second monitor -->
      <action name="Raise"/>
      <action name="MoveResizeTo">
        <monitor>2</monitor>
      </action>
    </keybind>
    <keybind key="C-W-Left">            <!-- move the window to the first monitor -->
      <action name="Raise"/>
      <action name="MoveResizeTo">
        <monitor>1</monitor>
      </action>
    </keybind>

Then you can use one of the other actions to place it.

I've noticed that terminator doesn't expand to cover the space, if a tint2 isn't on the the monitor it is moving to.

Last edited by damo (2017-08-03 04:45:07)


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#2 2017-07-17 16:31:01

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Manual tiling with Openbox

Display the keybinds

Because I keep forgetting the keybinds, I use a script to display them in a yad dialog pop-up!

Copy this to "~/.config/openbox/tiling-kbinds.txt":

TILING KEYBINDS
---------------

C-Right       GrowToEdgeEast
C-Left        GrowToEdgeWest
C-Down        GrowToEdgeSouth
C-Up          GrowToEdgeNorth
C-KP_5        GrowToFill

W-KP_4        Tile to left half
W-KP_6        Tile to right half
W-KP_8        Tile to top half
W-KP_2        Tile to bottom half
W-KP_7        Tile to top left quarter
W-KP_9        Tile to top right quarter
W-KP_1        Tile to bottom left quarter
W-KP_3        Tile to bottom right quarter
W-KP_5        Place in centre

W-A-Right     MoveToEdge right
W-A-Left      MoveToEdge left
W-A-Up        MoveToEdge top
W-A-Down      MoveToEdge bottom

W-A-KP_9      Move to top right
W-A-KP_7      Move to top left
W-A-KP_3      Move to bottom right
W-A-KP_1      Move to bottom left

Run it with "~/bin/tiling-kbinds.sh" (I use "C-Menu" as a keybind):

#!/bin/bash
##
## tiling-kbinds.sh  by damo, August 2017
##

KBINDS="$HOME/.config/openbox/tiling-kbinds.txt"

ERROR_MSG1="$KBINDS does not exist"
ERROR_MSG2="This script requires 'yad' to be installed"

[[ -f $KBINDS ]] 2>/dev/null || { notify-send "$ERROR_MSG1" >&2;exit 1;}

if type yad &>/dev/null;then
    yad --text-info --filename="$KBINDS" --width=380 --height=500 --undecorated \
    --no-buttons --margins=20 --borders=0
else
    notify-send "$ERROR_MSG2" >&2
    exit 1
fi

My window management keybinds, which include desktop and monitor switching, togglers etc, from my rc.xml:
windows-keybinds.xml

Last edited by damo (2017-08-03 04:46:44)


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#3 2017-07-17 18:31:13

Naik
Member
From: the edge of insanity
Registered: 2015-10-03
Posts: 315

Re: Manual tiling with Openbox

Hey damo!

Did I ever tell you that I`m not only totally overwhelmed by the the digital art you produce, but also love the way you know when there is a HowTo to write or some Hintos to drop?
No? So, feel hearty embraced by now!
I just fired up my browser to find out how i can get "a bit of tiling" into the config of mr.nileypops NEJU-iso and there you are providing the handles i already got used to using #!CB

naik --thanks


"Kaum macht [Mensch]* es richtig, funktioniert es sofort!"
BL-Kitchen on GitHub

Offline

#4 2017-07-17 19:10:50

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Manual tiling with Openbox

^ smile  angel   kiss

EDIT: added Post #2

Last edited by damo (2017-07-17 23:10:59)


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#5 2017-07-19 01:43:18

ututo
Member
Registered: 2015-09-29
Posts: 296

Re: Manual tiling with Openbox

Thanks @damo for sharing! I will have to use these configs until I can implement something like this   big_smile


BunsenLabs on deviantArt
Don't touch my git!

Offline

#6 2017-08-03 04:49:58

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Manual tiling with Openbox

Major update to the HowTo - see posts #1 and #2 smile


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

Board footer

Powered by FluxBB