Search code examples
linuxluawindow-managers

Splitting workspaces in the notion window manager


I have been using the Notion Window Manager (http://notion.sourceforge.net/) for a few weeks. I was wondering if it is possible to create a keybinding that splits a workspace in the same way that META+S and META+K S splits a frame horizontally and vertically.

So if I had two vertical frames in a workspace like this:

-----
|1|2|
| | |
| | |
| | |
-----

The keybinding to split horizontally should add a new frame that spans the workspace horizontally:

-----
|1|2|
| | |
-----
| 3 |
-----

Currently META+S only splits the selected frame horizontally:

-----
|1|2|
| | |
|-| |
|3| |
-----

Is there any way to accomplish splitting the entire workspace horizontally or vertically in Notion?


Solution

  • The solution I came up with is to add a keybinding to the split_top function in cfg_tiling.lua. To split horizontally I added:

    kpress(META.."Z", "WTiling.split_top(_, 'bottom')")
    

    to the WTiling defbindings function. I also added

    kpress("Z", "Wtiling.split_top(_, 'left')")
    

    to the submap META.."K" bindings.

    The split_top function splits at the root of the split tree. This will create a new frame that splits the entire workspace rather than the current frame.

    One sizing issue that I noticed with this approach is that it will try to split the workspace exactly in half. If there is a horizontal frame splitting a workspace split_top will resize it to the smallest size and add a new frame below it. If there is a vertical frame it will become about 10 pixels wide when the new frame is added. Horizontal size issue. New frames are 0 height:

    Start  ->Mod1+Z ->Mod1+Z
    
    -1--2--  -1--2--  -1--2--
    |  |  |  |  |  |  |  |  |
    |  |  |  |  |  |  |  |  |
    -3-----  -3-----  -3-----
    |     |  -4-----  -4-----
    |     |  |     |  -5-----
    |     |  |     |  |     |
    |     |  |     |  |     |
    -------  -------  -------
    

    Vertical size issue. New frames are 0 width:

    Start      -> Mod1+K Z  -> Mod1+K Z
    -1----2----  -4--1-2----  -5-41-2----
    |    |    |  |   ||    |  |  |||    |
    |    |    |  |   ||    |  |  |||    |
    |    |3---|  |   ||3---|  |  |||3---|
    |    |    |  |   ||    |  |  |||    |
    |    |    |  |   ||    |  |  |||    |
    -----------  -----------  -----------
    

    Another issue is the focus does not change to the newly create frame. Hitting Mod1+Z will create the frame but the user has to Mod1+TAB to the frame to manipulate it.

    This is a start but a comprehensive solution would check for frames that already split the workspace and split them instead and change the focus to the new frame.