Bug 3356 - Intelligent maximization
Status: ASSIGNED
Alias: None
Product: Openbox
Classification: Unclassified
Component: general
Version: unspecified
Hardware: PC Linux
: P3 enhancement
Assignee: Dana Jansens
QA Contact:
URL:
: 3750
Depends on:
Blocks:
 
Reported: 2007-09-17 06:13 EDT by Jehan
Modified: 2015-03-09 15:17:52 EDT
3 users (show)

See Also:


Attachments
Created a "GrowToFill" action (3.83 KB, patch)
2010-07-31 13:19 EDT, Lucas
Patch reformated according the unified diff format (5.41 KB, patch)
2010-07-31 13:42 EDT, Lucas

Description Jehan 2007-09-17 06:13:41 EDT
I just thought of a nice feature, during a discussion about Gimp's interface. There could be an "intelligent" maximization which would take all available place without masking other windows. So the current window receiving such event will try to take all the place it can as long as nothing else is hidden.

Some option which would be nice also is that you can flag a window if this one can be hidden, so that the intelligent maximization won't take it into account.
Comment 1 Dana Jansens 2007-09-22 12:08:39 EDT
This is more or less the purpose of the "grow to edge" actions.  Tagging windows like this is getting really complicated, I think.  Maybe a "grow to edge in all directions" action would be alright, that doesn't grow a side past an edge if another side was able to grow. i.e. it won't jump past over window until all 4 edges are able to do so (excluding monitor edges maybe)
Comment 2 Fernando 2008-04-10 00:13:39 EDT
(In reply to comment #0)
This is possible right now with this:
 <keybind key="A-m">
    <!--  <action name="ToggleMaximizeFull"/> -->
    <action name="GrowToEdgeNorth"/>
    <action name="GrowToEdgeSouth"/>
    <action name="GrowToEdgeWest"/>
    <action name="GrowToEdgeEast"/>
 </keybind>
Now, what really be nice to get is the possibility of 
not FullMaximize a window, but instead to only Maximize
it, i.e., not to remove the bottom and side decorations, 
maybe as an option to FullMaximize, or based on the "keepBorder"
directive.
Best regards,
Fernando
Comment 3 Lucas 2010-01-16 14:07:44 EST
It will be nice if we can restore "inteligent maximized" windows to his previous size... in this aspect, his behaviour is more like the maximize instead of the grow to edges.

Other suggestion: windows that want this behavior on his maximization can be 'tagged' by some kind of rule in rc.xml. Aditionally, there can be an global option that disable this behaviour or that set this behaviour as default for maximization on all the system...

Another aspect to think is wether to consider the space used by other applications windows while computing the available space... On Gimp, that has many windows, we probably want that the opened picture use all space not occupied by gimp windows. On single windowed applications, we need to consider all opened applications while maximizing, not only the application windows.
Comment 4 Lucas 2010-07-31 12:32:01 EDT
*** Bug 3750 has been marked as a duplicate of this bug. ***
Comment 5 Lucas 2010-07-31 13:19:54 EDT
Created attachment 2379 [details]
Created a "GrowToFill" action

Proposed a "GrowToFill" action that try to fit the current window to the maximum available area in all directions.
Comment 6 Mikachu 2010-07-31 13:33:42 EDT
Please use unified diff format (diff -pu) for patch attachments.
Comment 7 Lucas 2010-07-31 13:42:18 EDT
Created attachment 2380 [details]
Patch reformated according the unified diff format

Proposed a "GrotToFill" action.
Comment 8 Lucas 2010-10-24 23:32:29 EDT
Anyone tried the patch?

(In reply to comment #7)
> Created an attachment (id=2380) [details]
> Patch reformated according the unified diff format
> 
> Proposed a "GrowToFill" action.
Comment 9 Lucas 2010-12-18 17:54:24 EST
(In reply to comment #8)
> Anyone tried the patch?
> 
> (In reply to comment #7)
> > Created an attachment (id=2380) [details] [details]
> > Patch reformated according the unified diff format
> > 
> > Proposed a "GrowToFill" action.

Here is a sample video with the proposed "GrowToFill" action:
http://www.youtube.com/watch?v=Xmg8IVyu-0g

The name GrowToFill is only a suggestion... I cannot find a better name...

Here is my openbox GIT repo with the "GrowToFill" patch:
https://github.com/deters/openbox.git

And this is the modifications done in the patch:
https://github.com/deters/openbox/commit/8c5daf876a7a74783be5479ab1b1ab99d833b545

Instructions to test this patch on Ubuntu:

1) Compiling and installing:
sudo apt-get install build-essential automake autoconf git gettext autopoint
sudo apt-get build-dep openbox
git clone https://github.com/deters/openbox.git
cd openbox
autopoint
./configure
make
sudo make install

2) Configure a keybind on the file "~/.config/openbox/rc.xml":
    <keybind key="W-Return">
      <action name="GrowToFill"/>
    </keybind>

3) run openbox
openbox --replace

Thanks all
Comment 10 Dana Jansens 2013-09-01 16:33:22 EDT
Is there anything different about this action's behaviour than just doing the following?

 <action name="GrowToEdgeNorth"/>
 <action name="GrowToEdgeSouth"/>
 <action name="GrowToEdgeWest"/>
 <action name="GrowToEdgeEast"/>

I'm not seeing the difference right now..
Comment 11 Dana Jansens 2013-09-01 16:35:05 EDT
(In reply to comment #10)
> Is there anything different about this action's behaviour than just doing
> the following?
> 
>  <action name="GrowToEdgeNorth"/>
>  <action name="GrowToEdgeSouth"/>
>  <action name="GrowToEdgeWest"/>
>  <action name="GrowToEdgeEast"/>
> 
> I'm not seeing the difference right now..

Oh I see, this new action prevents shrinking. We could just add an option for that.
Comment 12 Dana Jansens 2013-09-01 16:45:08 EDT
(In reply to comment #11)
> (In reply to comment #10)
> > Is there anything different about this action's behaviour than just doing
> > the following?
> > 
> >  <action name="GrowToEdgeNorth"/>
> >  <action name="GrowToEdgeSouth"/>
> >  <action name="GrowToEdgeWest"/>
> >  <action name="GrowToEdgeEast"/>
> > 
> > I'm not seeing the difference right now..
> 
> Oh I see, this new action prevents shrinking. We could just add an option
> for that.

Oh, also, by doing an atomic action, the window can grow more than it would otherwise.

If you have a terminal window with 50px characters, positioned at 40y, and you grow North, it won't move. Then grow South, it could leave up to 50px below it. If these were combined it could move up to the top and grow and extra character down.
Comment 13 Dana Jansens 2013-09-01 16:53:18 EDT
I merged the github branch in #9 to my work branch, with a few nit fixes, and reduced code duplication by reusing client_find_resize_directional() in the patch in https://github.com/danakj/openbox/commit/6cae774d48f337b256850571b1cf8446f915d5e0

I don't think this fixes this bug, as you can't "unmaximize", for that we'd need to track state across actions - and probably more likely extend all the maximize code in client.c which would be more tricky.
Comment 14 Lucas 2013-09-01 16:58:43 EDT
(In reply to comment #11)
> (In reply to comment #10)
> > Is there anything different about this action's behaviour than just doing
> > the following?
> > 
> >  <action name="GrowToEdgeNorth"/>
> >  <action name="GrowToEdgeSouth"/>
> >  <action name="GrowToEdgeWest"/>
> >  <action name="GrowToEdgeEast"/>
> > 
> > I'm not seeing the difference right now..
> 
> Oh I see, this new action prevents shrinking. We could just add an option
> for that.

Hi,

The main advantage of this action: it will stop growing to an edge if that edge is
already "touching" other window edge, but will grow on other edges... 

As an example, if your window is touching another window at north, but have space to grow in the other directions, then it will grow only on those directions it has space to grow...
Comment 15 Dana Jansens 2013-09-01 17:00:53 EDT
(In reply to comment #14)
> (In reply to comment #11)
> > (In reply to comment #10)
> > > Is there anything different about this action's behaviour than just doing
> > > the following?
> > > 
> > >  <action name="GrowToEdgeNorth"/>
> > >  <action name="GrowToEdgeSouth"/>
> > >  <action name="GrowToEdgeWest"/>
> > >  <action name="GrowToEdgeEast"/>
> > > 
> > > I'm not seeing the difference right now..
> > 
> > Oh I see, this new action prevents shrinking. We could just add an option
> > for that.
> 
> Hi,
> 
> The main advantage of this action: it will stop growing to an edge if that
> edge is
> already "touching" other window edge, but will grow on other edges... 
> 
> As an example, if your window is touching another window at north, but have
> space to grow in the other directions, then it will grow only on those
> directions it has space to grow...

Oh I see. Looks like I broke that in my followup CL then. Thanks!
Comment 16 Lucas 2013-09-01 17:10:55 EDT
(In reply to comment #15)
> (In reply to comment #14)
> > (In reply to comment #11)
> > > (In reply to comment #10)
> > > > Is there anything different about this action's behaviour than just doing
> > > > the following?
> > > > 
> > > >  <action name="GrowToEdgeNorth"/>
> > > >  <action name="GrowToEdgeSouth"/>
> > > >  <action name="GrowToEdgeWest"/>
> > > >  <action name="GrowToEdgeEast"/>
> > > > 
> > > > I'm not seeing the difference right now..
> > > 
> > > Oh I see, this new action prevents shrinking. We could just add an option
> > > for that.
> > 
> > Hi,
> > 
> > The main advantage of this action: it will stop growing to an edge if that
> > edge is
> > already "touching" other window edge, but will grow on other edges... 
> > 
> > As an example, if your window is touching another window at north, but have
> > space to grow in the other directions, then it will grow only on those
> > directions it has space to grow...
> 
> Oh I see. Looks like I broke that in my followup CL then. Thanks!

My trick to achieve "not growing when touching other window" was decrease 1 pixel the position of the edge relative to some direction before calling client_find_edge_directional... so I will always find the already "touched" edge and will not grow in that direction.
Comment 17 Dana Jansens 2013-09-01 17:12:08 EDT
(In reply to comment #16)
> My trick to achieve "not growing when touching other window" was decrease 1
> pixel the position of the edge relative to some direction before calling
> client_find_edge_directional... so I will always find the already "touched"
> edge and will not grow in that direction.

Yup! Makes sense. I'm extending the client_find_resize_directional() method to support this use case :)
Comment 18 Dana Jansens 2013-09-01 17:24:40 EDT
Updated https://github.com/danakj/openbox/commit/ef0b3b0193ebaa40daf5f6ede442c3f71eea763f to not break the behaviour from the original CL.
Comment 19 Dana Jansens 2013-09-01 17:26:04 EDT
I thought about allowing the action to grow further, if all edges are already blocked. I'm not sure if that's good or not, but it would more closely match the behaviour of the other grow actions. So I think I'll implement that for now. We could always make it an option too.
Comment 20 Dana Jansens 2013-09-01 17:38:31 EDT
Added the new behaviour in https://github.com/danakj/openbox/commit/e1973cfbaa35e990b4eebaa591e182e79bf6374d
Comment 21 Lucas 2013-09-01 17:43:47 EDT
(In reply to comment #20)
> Added the new behaviour in
> https://github.com/danakj/openbox/commit/
> e1973cfbaa35e990b4eebaa591e182e79bf6374d

Thanks Dana! Right now I'm facing problems to compile latest openbox releases, something wrong with my autotools or so... as soon as I can I will try the new action. Thanks again! :)
Comment 22 Dana Jansens 2013-09-01 17:50:20 EDT
Ok thanks. When you figure it out, if there's anything you need to change in Openbox to make it work please file a bug.

I've using the latest ubuntu without any funny hacks and compiling okay, FWIW. If the problem is due to librsvg, you can use --disable-librsvg. Some users (slackware) have reported this. But I have no idea what I should be doing to make it compile correctly there with librsvg yet.
Comment 23 Lucas 2013-09-01 19:17:05 EDT
Thanks (In reply to comment #22)
> Ok thanks. When you figure it out, if there's anything you need to change in
> Openbox to make it work please file a bug.
> 
> I've using the latest ubuntu without any funny hacks and compiling okay,
> FWIW. If the problem is due to librsvg, you can use --disable-librsvg. Some
> users (slackware) have reported this. But I have no idea what I should be
> doing to make it compile correctly there with librsvg yet.

Got it working here just by reading readme.git... 

Done some tests here... it's working ok, except the new "keep growing" behaviour... just do not make sense to me the need to keep growing when all empty space are ocuppied... can this behaviour be optional?
Comment 24 Dana Jansens 2013-09-01 19:18:53 EDT
(In reply to comment #23)
> Thanks (In reply to comment #22)
> > Ok thanks. When you figure it out, if there's anything you need to change in
> > Openbox to make it work please file a bug.
> > 
> > I've using the latest ubuntu without any funny hacks and compiling okay,
> > FWIW. If the problem is due to librsvg, you can use --disable-librsvg. Some
> > users (slackware) have reported this. But I have no idea what I should be
> > doing to make it compile correctly there with librsvg yet.
> 
> Got it working here just by reading readme.git... 
> 
> Done some tests here... it's working ok, except the new "keep growing"
> behaviour... just do not make sense to me the need to keep growing when all
> empty space are ocuppied... can this behaviour be optional?

Sure, want to add a "once" tag to the action, which defaults false, and send me a pull request on github?

Just occured to me, we need to add this thing to rc.xsd also.
Comment 25 Lucas 2013-09-01 19:23:38 EDT
(In reply to comment #23)
> Thanks (In reply to comment #22)
> > Ok thanks. When you figure it out, if there's anything you need to change in
> > Openbox to make it work please file a bug.
> > 
> > I've using the latest ubuntu without any funny hacks and compiling okay,
> > FWIW. If the problem is due to librsvg, you can use --disable-librsvg. Some
> > users (slackware) have reported this. But I have no idea what I should be
> > doing to make it compile correctly there with librsvg yet.
> 
> Got it working here just by reading readme.git... 
> 
> Done some tests here... it's working ok, except the new "keep growing"
> behaviour... just do not make sense to me the need to keep growing when all
> empty space are ocuppied... can this behaviour be optional?

(In reply to comment #24)
> (In reply to comment #23)
> > Thanks (In reply to comment #22)
> > > Ok thanks. When you figure it out, if there's anything you need to change in
> > > Openbox to make it work please file a bug.
> > > 
> > > I've using the latest ubuntu without any funny hacks and compiling okay,
> > > FWIW. If the problem is due to librsvg, you can use --disable-librsvg. Some
> > > users (slackware) have reported this. But I have no idea what I should be
> > > doing to make it compile correctly there with librsvg yet.
> > 
> > Got it working here just by reading readme.git... 
> > 
> > Done some tests here... it's working ok, except the new "keep growing"
> > behaviour... just do not make sense to me the need to keep growing when all
> > empty space are ocuppied... can this behaviour be optional?
> 
> Sure, want to add a "once" tag to the action, which defaults false, and send
> me a pull request on github?
> 
> Just occured to me, we need to add this thing to rc.xsd also.


Thinking more, if the GrowToEdge* actions had this option to stop growing then facing some edge, the GrowToFill would almost be unnecessary...
Comment 26 Lucas 2013-09-01 19:24:27 EDT
(In reply to comment #25)
> (In reply to comment #23)
> > Thanks (In reply to comment #22)
> > > Ok thanks. When you figure it out, if there's anything you need to change in
> > > Openbox to make it work please file a bug.
> > > 
> > > I've using the latest ubuntu without any funny hacks and compiling okay,
> > > FWIW. If the problem is due to librsvg, you can use --disable-librsvg. Some
> > > users (slackware) have reported this. But I have no idea what I should be
> > > doing to make it compile correctly there with librsvg yet.
> > 
> > Got it working here just by reading readme.git... 
> > 
> > Done some tests here... it's working ok, except the new "keep growing"
> > behaviour... just do not make sense to me the need to keep growing when all
> > empty space are ocuppied... can this behaviour be optional?
> 
> (In reply to comment #24)
> > (In reply to comment #23)
> > > Thanks (In reply to comment #22)
> > > > Ok thanks. When you figure it out, if there's anything you need to change in
> > > > Openbox to make it work please file a bug.
> > > > 
> > > > I've using the latest ubuntu without any funny hacks and compiling okay,
> > > > FWIW. If the problem is due to librsvg, you can use --disable-librsvg. Some
> > > > users (slackware) have reported this. But I have no idea what I should be
> > > > doing to make it compile correctly there with librsvg yet.
> > > 
> > > Got it working here just by reading readme.git... 
> > > 
> > > Done some tests here... it's working ok, except the new "keep growing"
> > > behaviour... just do not make sense to me the need to keep growing when all
> > > empty space are ocuppied... can this behaviour be optional?
> > 
> > Sure, want to add a "once" tag to the action, which defaults false, and send
> > me a pull request on github?
> > 
> > Just occured to me, we need to add this thing to rc.xsd also.
> 
> 
> Thinking more, if the GrowToEdge* actions had this option to stop growing
> then facing some edge, the GrowToFill would almost be unnecessary...

Correcting:

Thinking more, if the GrowToEdge* actions had this option to stop growing WHEN facing some edge, the GrowToFill would be unnecessary...
Comment 27 Lucas 2013-09-01 19:29:26 EDT
(In reply to comment #24)
> (In reply to comment #23)
> > Thanks (In reply to comment #22)
> > > Ok thanks. When you figure it out, if there's anything you need to change in
> > > Openbox to make it work please file a bug.
> > > 
> > > I've using the latest ubuntu without any funny hacks and compiling okay,
> > > FWIW. If the problem is due to librsvg, you can use --disable-librsvg. Some
> > > users (slackware) have reported this. But I have no idea what I should be
> > > doing to make it compile correctly there with librsvg yet.
> > 
> > Got it working here just by reading readme.git... 
> > 
> > Done some tests here... it's working ok, except the new "keep growing"
> > behaviour... just do not make sense to me the need to keep growing when all
> > empty space are ocuppied... can this behaviour be optional?
> 
> Sure, want to add a "once" tag to the action, which defaults false, and send
> me a pull request on github?
> 
> Just occured to me, we need to add this thing to rc.xsd also.

Will try to do it... I'm not what you can call a "great developer"... :)
Comment 28 Dana Jansens 2013-09-01 19:51:57 EDT
> > Thinking more, if the GrowToEdge* actions had this option to stop growing
> > then facing some edge, the GrowToFill would almost be unnecessary...
> 
> Correcting:
> 
> Thinking more, if the GrowToEdge* actions had this option to stop growing
> WHEN facing some edge, the GrowToFill would be unnecessary...

SO, that's what I was thinking too, but then I realized it's very useful to grow (at least opposite) edges together as an atomic action. One reason is terminal windows will grow to fill the space more accurately. And the other is you can choose to grow all edges again if all edges were previously blocked. So I think this has a usefulness separate from individual actions.
Comment 29 Dana Jansens 2013-09-01 19:54:26 EDT
(In reply to comment #27)
> > Sure, want to add a "once" tag to the action, which defaults false, and send
> > me a pull request on github?
> > 
> > Just occured to me, we need to add this thing to rc.xsd also.
> 
> Will try to do it... I'm not what you can call a "great developer"... :)

Cool! You can use another action with a bool parameter to see example code for reading a bool, such as https://github.com/danakj/openbox/blob/master/openbox/actions/cyclewindows.c#L85
Comment 30 Lucas 2013-09-01 20:12:03 EDT
(In reply to comment #29)
> (In reply to comment #27)
> > > Sure, want to add a "once" tag to the action, which defaults false, and send
> > > me a pull request on github?
> > > 
> > > Just occured to me, we need to add this thing to rc.xsd also.
> > 
> > Will try to do it... I'm not what you can call a "great developer"... :)
> 
> Cool! You can use another action with a bool parameter to see example code
> for reading a bool, such as
> https://github.com/danakj/openbox/blob/master/openbox/actions/cyclewindows.
> c#L85

Thanks... I was already doing the wrong way...
Comment 31 Jehan 2013-09-01 21:25:54 EDT
Nice to see activity there! I have not been using Openbox lately (shame on me!) but I miss it. I think I will reinstall it and try this all soon. :-) Sorry for the off-topic.
Comment 32 Lucas 2013-09-01 22:02:05 EDT
(In reply to comment #24)
> (In reply to comment #23)
> > Thanks (In reply to comment #22)
> > > Ok thanks. When you figure it out, if there's anything you need to change in
> > > Openbox to make it work please file a bug.
> > > 
> > > I've using the latest ubuntu without any funny hacks and compiling okay,
> > > FWIW. If the problem is due to librsvg, you can use --disable-librsvg. Some
> > > users (slackware) have reported this. But I have no idea what I should be
> > > doing to make it compile correctly there with librsvg yet.
> > 
> > Got it working here just by reading readme.git... 
> > 
> > Done some tests here... it's working ok, except the new "keep growing"
> > behaviour... just do not make sense to me the need to keep growing when all
> > empty space are ocuppied... can this behaviour be optional?
> 
> Sure, want to add a "once" tag to the action, which defaults false, and send
> me a pull request on github?
> 
> Just occured to me, we need to add this thing to rc.xsd also.

After hours changing options in the wrong place, finally is done... 
Made the pull request: https://github.com/danakj/openbox/pull/7

Please feel free to fix any mistake I could possible done.

I have done some tests and I think it is working ok for both GrowToEdges and GrowToFill actions...
Comment 33 Lucas 2013-09-02 00:41:37 EDT
(In reply to comment #28)
> > > Thinking more, if the GrowToEdge* actions had this option to stop growing
> > > then facing some edge, the GrowToFill would almost be unnecessary...
> > 
> > Correcting:
> > 
> > Thinking more, if the GrowToEdge* actions had this option to stop growing
> > WHEN facing some edge, the GrowToFill would be unnecessary...
> 
> SO, that's what I was thinking too, but then I realized it's very useful to
> grow (at least opposite) edges together as an atomic action. One reason is
> terminal windows will grow to fill the space more accurately. And the other
> is you can choose to grow all edges again if all edges were previously
> blocked. So I think this has a usefulness separate from individual actions.

The atomic behaviour solves the terminal problem, but cause other worst: window overlaping. Supposing you have two small windows: one at top left of the display, and one at bottom right. If his positions dont allow them to see each other edges, they can will grow how much they want in any direction, overlaping the other window...

If we do non-atomic Growing, we get back with problems growing terminal windows... 

The solution would be to replace GrowTo by MoveTo when growing to up or to left... this solves the terminal problem, solves the window overlaping, but has a problem: if the window is already touching the right or bottom edge of the display, then the GrowTo actions will actually shrink the window... so, we need also a new option to block shrink when doing GrowTo...
Comment 34 Lucas 2013-09-03 10:35:42 EDT
(In reply to comment #33)
> (In reply to comment #28)
> > > > Thinking more, if the GrowToEdge* actions had this option to stop growing
> > > > then facing some edge, the GrowToFill would almost be unnecessary...
> > > 
> > > Correcting:
> > > 
> > > Thinking more, if the GrowToEdge* actions had this option to stop growing
> > > WHEN facing some edge, the GrowToFill would be unnecessary...
> > 
> > SO, that's what I was thinking too, but then I realized it's very useful to
> > grow (at least opposite) edges together as an atomic action. One reason is
> > terminal windows will grow to fill the space more accurately. And the other
> > is you can choose to grow all edges again if all edges were previously
> > blocked. So I think this has a usefulness separate from individual actions.
> 
> The atomic behaviour solves the terminal problem, but cause other worst:
> window overlaping. Supposing you have two small windows: one at top left of
> the display, and one at bottom right. If his positions dont allow them to
> see each other edges, they can will grow how much they want in any
> direction, overlaping the other window...
> 
> If we do non-atomic Growing, we get back with problems growing terminal
> windows... 
> 
> The solution would be to replace GrowTo by MoveTo when growing to up or to
> left... this solves the terminal problem, solves the window overlaping, but
> has a problem: if the window is already touching the right or bottom edge of
> the display, then the GrowTo actions will actually shrink the window... so,
> we need also a new option to block shrink when doing GrowTo...

<!--
     This is an use-case to do "non-atomic" GrowToFill, by
     only using MoveToEdge* and GrowToEdge* actions.

     I'm proposing two new actions: "confined" (now called "once") 
     and "strict" (proposed bellow).

     The option "confined" would not allow MoveTo* and GrowTo*
     actions to jump past their current block points.

     The new "strict" action would force GrowTo* actions 
     to behaviour strict to what their name means: grow.
     So, this option would prevent GrowTo from shrinking.
     This name could be valid to other actions who have
     special behaviours.

-->
<keybind key="W-space">

  <action name="MoveToEdge">
     <direction>north</direction>
     <confined>yes</confined> <!-- prevents bypassing edges -->
  </action>

  <action name="GrowToEdge">
     <direction>south</direction>
     <confined>yes</confined> <!-- prevents bypassing edges -->
     <strict>yes</strict>     <!-- prevents shrinking -->
  </action>

  <action name="MoveToEdge">
     <direction>west</direction>
     <confined>yes</confined> <!-- prevents bypassing edges -->
  </action>

  <action name="GrowToEdge">
     <direction>east</direction>
     <confined>yes</confined> <!-- prevents bypassing edges -->
     <strict>yes</strict> <!-- prevents shrinking -->
  </action>

</keybind>
Comment 35 Lucas 2013-09-03 10:37:35 EDT
(In reply to comment #34)
> (In reply to comment #33)
> > (In reply to comment #28)
> > > > > Thinking more, if the GrowToEdge* actions had this option to stop growing
> > > > > then facing some edge, the GrowToFill would almost be unnecessary...
> > > > 
> > > > Correcting:
> > > > 
> > > > Thinking more, if the GrowToEdge* actions had this option to stop growing
> > > > WHEN facing some edge, the GrowToFill would be unnecessary...
> > > 
> > > SO, that's what I was thinking too, but then I realized it's very useful to
> > > grow (at least opposite) edges together as an atomic action. One reason is
> > > terminal windows will grow to fill the space more accurately. And the other
> > > is you can choose to grow all edges again if all edges were previously
> > > blocked. So I think this has a usefulness separate from individual actions.
> > 
> > The atomic behaviour solves the terminal problem, but cause other worst:
> > window overlaping. Supposing you have two small windows: one at top left of
> > the display, and one at bottom right. If his positions dont allow them to
> > see each other edges, they can will grow how much they want in any
> > direction, overlaping the other window...
> > 
> > If we do non-atomic Growing, we get back with problems growing terminal
> > windows... 
> > 
> > The solution would be to replace GrowTo by MoveTo when growing to up or to
> > left... this solves the terminal problem, solves the window overlaping, but
> > has a problem: if the window is already touching the right or bottom edge of
> > the display, then the GrowTo actions will actually shrink the window... so,
> > we need also a new option to block shrink when doing GrowTo...
> 
> <!--
>      This is an use-case to do "non-atomic" GrowToFill, by
>      only using MoveToEdge* and GrowToEdge* actions.
> 
>      I'm proposing two new actions: "confined" (now called "once") 
>      and "strict" (proposed bellow).
> 
>      The option "confined" would not allow MoveTo* and GrowTo*
>      actions to jump past their current block points.
> 
>      The new "strict" action would force GrowTo* actions 
>      to behaviour strict to what their name means: grow.
>      So, this option would prevent GrowTo from shrinking.
>      This name could be valid to other actions who have
>      special behaviours.
> 
> -->
> <keybind key="W-space">
> 
>   <action name="MoveToEdge">
>      <direction>north</direction>
>      <confined>yes</confined> <!-- prevents bypassing edges -->
>   </action>
> 
>   <action name="GrowToEdge">
>      <direction>south</direction>
>      <confined>yes</confined> <!-- prevents bypassing edges -->
>      <strict>yes</strict>     <!-- prevents shrinking -->
>   </action>
> 
>   <action name="MoveToEdge">
>      <direction>west</direction>
>      <confined>yes</confined> <!-- prevents bypassing edges -->
>   </action>
> 
>   <action name="GrowToEdge">
>      <direction>east</direction>
>      <confined>yes</confined> <!-- prevents bypassing edges -->
>      <strict>yes</strict> <!-- prevents shrinking -->
>   </action>
> 
> </keybind>

in "two new actions", please read "two new options".
Comment 36 Lucas 2013-09-03 23:06:02 EDT
(In reply to comment #35)
> (In reply to comment #34)
> > (In reply to comment #33)
> > > (In reply to comment #28)
> > > > > > Thinking more, if the GrowToEdge* actions had this option to stop growing
> > > > > > then facing some edge, the GrowToFill would almost be unnecessary...
> > > > > 
> > > > > Correcting:
> > > > > 
> > > > > Thinking more, if the GrowToEdge* actions had this option to stop growing
> > > > > WHEN facing some edge, the GrowToFill would be unnecessary...
> > > > 
> > > > SO, that's what I was thinking too, but then I realized it's very useful to
> > > > grow (at least opposite) edges together as an atomic action. One reason is
> > > > terminal windows will grow to fill the space more accurately. And the other
> > > > is you can choose to grow all edges again if all edges were previously
> > > > blocked. So I think this has a usefulness separate from individual actions.
> > > 
> > > The atomic behaviour solves the terminal problem, but cause other worst:
> > > window overlaping. Supposing you have two small windows: one at top left of
> > > the display, and one at bottom right. If his positions dont allow them to
> > > see each other edges, they can will grow how much they want in any
> > > direction, overlaping the other window...
> > > 
> > > If we do non-atomic Growing, we get back with problems growing terminal
> > > windows... 
> > > 
> > > The solution would be to replace GrowTo by MoveTo when growing to up or to
> > > left... this solves the terminal problem, solves the window overlaping, but
> > > has a problem: if the window is already touching the right or bottom edge of
> > > the display, then the GrowTo actions will actually shrink the window... so,
> > > we need also a new option to block shrink when doing GrowTo...
> > 
> > <!--
> >      This is an use-case to do "non-atomic" GrowToFill, by
> >      only using MoveToEdge* and GrowToEdge* actions.
> > 
> >      I'm proposing two new actions: "confined" (now called "once") 
> >      and "strict" (proposed bellow).
> > 
> >      The option "confined" would not allow MoveTo* and GrowTo*
> >      actions to jump past their current block points.
> > 
> >      The new "strict" action would force GrowTo* actions 
> >      to behaviour strict to what their name means: grow.
> >      So, this option would prevent GrowTo from shrinking.
> >      This name could be valid to other actions who have
> >      special behaviours.
> > 
> > -->
> > <keybind key="W-space">
> > 
> >   <action name="MoveToEdge">
> >      <direction>north</direction>
> >      <confined>yes</confined> <!-- prevents bypassing edges -->
> >   </action>
> > 
> >   <action name="GrowToEdge">
> >      <direction>south</direction>
> >      <confined>yes</confined> <!-- prevents bypassing edges -->
> >      <strict>yes</strict>     <!-- prevents shrinking -->
> >   </action>
> > 
> >   <action name="MoveToEdge">
> >      <direction>west</direction>
> >      <confined>yes</confined> <!-- prevents bypassing edges -->
> >   </action>
> > 
> >   <action name="GrowToEdge">
> >      <direction>east</direction>
> >      <confined>yes</confined> <!-- prevents bypassing edges -->
> >      <strict>yes</strict> <!-- prevents shrinking -->
> >   </action>
> > 
> > </keybind>
> 
> in "two new actions", please read "two new options".

(In reply to comment #34)
> (In reply to comment #33)
> > (In reply to comment #28)
> > > > > Thinking more, if the GrowToEdge* actions had this option to stop growing
> > > > > then facing some edge, the GrowToFill would almost be unnecessary...
> > > > 
> > > > Correcting:
> > > > 
> > > > Thinking more, if the GrowToEdge* actions had this option to stop growing
> > > > WHEN facing some edge, the GrowToFill would be unnecessary...
> > > 
> > > SO, that's what I was thinking too, but then I realized it's very useful to
> > > grow (at least opposite) edges together as an atomic action. One reason is
> > > terminal windows will grow to fill the space more accurately. And the other
> > > is you can choose to grow all edges again if all edges were previously
> > > blocked. So I think this has a usefulness separate from individual actions.
> > 
> > The atomic behaviour solves the terminal problem, but cause other worst:
> > window overlaping. Supposing you have two small windows: one at top left of
> > the display, and one at bottom right. If his positions dont allow them to
> > see each other edges, they can will grow how much they want in any
> > direction, overlaping the other window...
> > 
> > If we do non-atomic Growing, we get back with problems growing terminal
> > windows... 
> > 
> > The solution would be to replace GrowTo by MoveTo when growing to up or to
> > left... this solves the terminal problem, solves the window overlaping, but
> > has a problem: if the window is already touching the right or bottom edge of
> > the display, then the GrowTo actions will actually shrink the window... so,
> > we need also a new option to block shrink when doing GrowTo...
> 
> <!--
>      This is an use-case to do "non-atomic" GrowToFill, by
>      only using MoveToEdge* and GrowToEdge* actions.
> 
>      I'm proposing two new actions: "confined" (now called "once") 
>      and "strict" (proposed bellow).
> 
>      The option "confined" would not allow MoveTo* and GrowTo*
>      actions to jump past their current block points.
> 
>      The new "strict" action would force GrowTo* actions 
>      to behaviour strict to what their name means: grow.
>      So, this option would prevent GrowTo from shrinking.
>      This name could be valid to other actions who have
>      special behaviours.
> 
> -->
> <keybind key="W-space">
> 
>   <action name="MoveToEdge">
>      <direction>north</direction>
>      <confined>yes</confined> <!-- prevents bypassing edges -->
>   </action>
> 
>   <action name="GrowToEdge">
>      <direction>south</direction>
>      <confined>yes</confined> <!-- prevents bypassing edges -->
>      <strict>yes</strict>     <!-- prevents shrinking -->
>   </action>
> 
>   <action name="MoveToEdge">
>      <direction>west</direction>
>      <confined>yes</confined> <!-- prevents bypassing edges -->
>   </action>
> 
>   <action name="GrowToEdge">
>      <direction>east</direction>
>      <confined>yes</confined> <!-- prevents bypassing edges -->
>      <strict>yes</strict> <!-- prevents shrinking -->
>   </action>
> 
> </keybind>

Hi Dana,

I tried to create a pull request in github but some obscure reason prevents github from completing it.

Here the modifications:
https://github.com/deters/openbox-1/compare/danakj:work...growtofill_option

I'm proposing this 2 new actions on GrowTo* actions:

1) "once": will restrict growing-up to the nearest blocking edges.

2) "strict": forces GrowTo* actions to do strictly what they name says it does: grow. So, this option will prevent GrowTo from shrinking. 

The name "strict" is just a suggestion, I tryed to think in a generic name who could be applied to any other methods who have "controversal" behaviours.

I think we need to add the "once" option on MoveToEdge action too, but this would require changing "client.c" again... What do you think?

Thanks.
Comment 37 Lucas 2013-09-03 23:06:54 EDT
by "two new actions", read "two new options"
Comment 38 Lucas 2013-09-04 01:11:30 EDT
Hi, Dana.

Just finished implementing the "once" option to work on MoveToEdge too:
https://github.com/deters/openbox-1/compare/danakj:work...growtofill_option

This 2 new options together allows the GrowTo* and MoveToEdge* actions to be used in more complex actions, like implementing customized GrowToFill... as a sample, follow my current configuration to do this:

<keybind key="W-s">

  <action name="MoveToEdge">  
     <direction>north</direction>
     <once>yes</once>         <!-- prevents bypassing edges -->
  </action>

  <action name="GrowToEdge">
     <direction>south</direction>
     <once>yes</once>         <!-- prevents bypassing edges -->
     <strict>yes</strict>     <!-- prevents shrinking -->
  </action>

  <action name="MoveToEdge">
     <direction>west</direction>
     <once>yes</once>         <!-- prevents bypassing edges -->
  </action>

  <action name="GrowToEdge">
     <direction>east</direction>
     <once>yes</once>         <!-- prevents bypassing edges -->
     <strict>yes</strict>     <!-- prevents shrinking -->
  </action>

</keybind>
Comment 39 Dana Jansens 2015-03-09 15:17:52 EDT
Commit pushed to master at https://github.com/danakj/openbox

https://github.com/danakj/openbox/commit/f757e7449f2184c088751c7c8d451b0db9b70981
Created a 'GrowToFill' action. (Bug 3356)