1

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?

John Mercier
  • 1,637
  • 3
  • 20
  • 44

2 Answers2

1

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.

John Mercier
  • 1,637
  • 3
  • 20
  • 44
  • I believe those functions should return the frame they created. If that's true then you should be able to append `:goto_focus()` to that command to switch focus to that split. I'm not sure I understand your sizing issue though. – Etan Reisner Jul 03 '14 at 01:41
  • I updated the answer to show the sizing issue more clearly. I will try the focus function later on today. – John Mercier Jul 03 '14 at 13:07
0

Yes, you can.

You either need to put your binding in the workspace context or from the frame/mplex context you need to look up the managing workspace and then call split on that.

(I'd post code and more concrete terms but I'm not in front of a notion machine at the moment and don't want to confuse things by using the wrong ones.)

Etan Reisner
  • 77,877
  • 8
  • 106
  • 148
  • I think I figured it out. I added my answer but there are a few issues with my solution. Any suggestions would be awesome. – John Mercier Jul 03 '14 at 01:25