[VOTE] expand-window Vs maximize-fill-window

View: New views
11 Messages — Rating Filter:   Alert me  

[VOTE] expand-window Vs maximize-fill-window

by Flashrider :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

sawfish has an expand function, which is called maximize-fill-window,
but there's no oposite to that, so I added (locally) contract-window,
which is based on shrink-window-*. Now the Question is, what do you like
better:

a) replace maximize-fill-window by grow-window-* based expand-window
b) add maximize-unfill-window (ugly name I know)

?

local diff attached.

Chris

[mfw_vs_ew.patch]

diff --git a/lisp/sawfish/wm/commands/grow-pack.jl b/lisp/sawfish/wm/commands/grow-pack.jl
index 632bd47..68cc4c3 100644
--- a/lisp/sawfish/wm/commands/grow-pack.jl
+++ b/lisp/sawfish/wm/commands/grow-pack.jl
@@ -33,7 +33,8 @@
     pack-window-left
     pack-window-right
     pack-window-up
-    pack-window-down)
+    pack-window-down
+    expand-window)
 
     (open rep
   sawfish.wm.windows
@@ -139,6 +140,13 @@ With a numeric prefix arg, move upwards by that many pixels instead."
 See `pack-window-up'."
     (pack-window w 'down arg))
 
+  (define (expand-window w #!optional arg)
+    "Expands a window. (grow in all four directions)"
+    (grow-window w 'up arg)
+    (grow-window w 'right arg)
+    (grow-window w 'down arg)
+    (grow-window w 'left arg))
+
   ;; Command defs
 
   ;;###autoload
@@ -150,6 +158,7 @@ See `pack-window-up'."
   (define-command 'pack-window-right pack-window-right #:spec "%W\nP")
   (define-command 'pack-window-up pack-window-up #:spec "%W\nP")
   (define-command 'pack-window-down pack-window-down #:spec "%W\nP")
+  (define-command 'expand-window expand-window #:spec "%W\nP")
 
   ;; Implementation part.
 
diff --git a/lisp/sawfish/wm/commands/shrink-yank.jl b/lisp/sawfish/wm/commands/shrink-yank.jl
index c6db7dd..78ef8f9 100644
--- a/lisp/sawfish/wm/commands/shrink-yank.jl
+++ b/lisp/sawfish/wm/commands/shrink-yank.jl
@@ -30,7 +30,8 @@
             yank-window-left
             yank-window-right
             yank-window-up
-            yank-window-down)
+            yank-window-down
+    contract-window)
 
     (open   rep
             sawfish.wm.commands
@@ -88,6 +89,13 @@ before."
 before."
     (yank-window window 'down))
 
+  (define (contract-window window)
+    "Contracts a window. (shrink in all four directions)"
+    (shrink-window window 'up)
+    (shrink-window window 'right)
+    (shrink-window window 'down)
+    (shrink-window window 'left))
+
   ;;###autoload
   (define-command 'shrink-window-left shrink-window-left #:spec "%W")
   (define-command 'shrink-window-right shrink-window-right #:spec "%W")
@@ -97,6 +105,7 @@ before."
   (define-command 'yank-window-right yank-window-right #:spec "%W")
   (define-command 'yank-window-up yank-window-up #:spec "%W")
   (define-command 'yank-window-down yank-window-down #:spec "%W")
+  (define-command 'contract-window contract-window #:spec "%W")
 
 ;;; Implementation:
 



signature.asc (205 bytes) Download Attachment

Re: [VOTE] expand-window Vs maximize-fill-window

by Janek Kozicki :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Christopher Roy Bratusek said:     (by the date of Fri, 09 Oct 2009 17:44:33 +0200)

> Hi all,
>
> sawfish has an expand function, which is called maximize-fill-window,
> but there's no oposite to that, so I added (locally) contract-window,
> which is based on shrink-window-*. Now the Question is, what do you like
> better:
>
> a) replace maximize-fill-window by grow-window-* based expand-window
> b) add maximize-unfill-window (ugly name I know)

the alphabetic list of bindings makes it easier to find the right
one. That is because this list isn't grouped into any categories.

Therefore I prefer the ugly name maximize-unfill-window or maybe
maximize-contract-window ?

--
Janek Kozicki                                                         |

Re: [VOTE] expand-window Vs maximize-fill-window

by Flashrider :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am Freitag, den 09.10.2009, 19:42 +0200 schrieb Janek Kozicki:

> Christopher Roy Bratusek said:     (by the date of Fri, 09 Oct 2009 17:44:33 +0200)
>
> > Hi all,
> >
> > sawfish has an expand function, which is called maximize-fill-window,
> > but there's no oposite to that, so I added (locally) contract-window,
> > which is based on shrink-window-*. Now the Question is, what do you like
> > better:
> >
> > a) replace maximize-fill-window by grow-window-* based expand-window
> > b) add maximize-unfill-window (ugly name I know)
>
> the alphabetic list of bindings makes it easier to find the right
> one. That is because this list isn't grouped into any categories.
>
> Therefore I prefer the ugly name maximize-unfill-window or maybe
> maximize-contract-window ?
>
Uhmm, well I didn't mean the name, more the implementation, but I guess
I didn't write exactly enough. Forget about a). Should we get
expand-window as non-maximization-based expand and should we only rely
on contract-window or implement a second maximize-unfill-window. And
have a two pairs.

Chris


signature.asc (205 bytes) Download Attachment

Re: [VOTE] expand-window Vs maximize-fill-window

by Timo Korvola-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday 09 October 2009 18:44:33 Christopher Roy Bratusek wrote:
> so I added (locally) contract-window,

Not in the attached patch, which only defines expand-window.

> a) replace maximize-fill-window by grow-window-* based expand-window

I don't use it myself, but the implementation of maximize-fill-window
seems simple and elegant.  Why would it need to be replaced?  Note that
if you call grow-window to all four directions in sequence like in the
posted patch, the result may depend on the order.

> b) add maximize-unfill-window (ugly name I know)

Very ugly for something that makes the window smaller.  contract-window
was a better name.

--
        Timo Korvola <URL:http://www.iki.fi/tkorvola>

Re: [VOTE] expand-window Vs maximize-fill-window

by Flashrider :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am Samstag, den 10.10.2009, 11:56 +0300 schrieb Timo Korvola:

> On Friday 09 October 2009 18:44:33 Christopher Roy Bratusek wrote:
> > so I added (locally) contract-window,
>
> Not in the attached patch, which only defines expand-window.
>
> > a) replace maximize-fill-window by grow-window-* based expand-window
>
> I don't use it myself, but the implementation of maximize-fill-window
> seems simple and elegant.  Why would it need to be replaced?  Note that
> if you call grow-window to all four directions in sequence like in the
> posted patch, the result may depend on the order.
... You're right, I haven't thought about that

> > b) add maximize-unfill-window (ugly name I know)
>
> Very ugly for something that makes the window smaller.  contract-window
> was a better name.
>

Indeed it is, but it doesn't match the naming scheme, so would it be
better to rename maximize-fill-*-window{,-toggle} to
expand-window-*{,-toggle}? I guess that's more abvious and we have a
pair with better matching names.

Chris


signature.asc (205 bytes) Download Attachment

Re: [VOTE] expand-window Vs maximize-fill-window

by Flashrider :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

updated proposed patch attached.

[expand_and_contract.patch]

diff --git a/lisp/sawfish/wm/commands/shrink-yank.jl b/lisp/sawfish/wm/commands/shrink-yank.jl
index c6db7dd..78ef8f9 100644
--- a/lisp/sawfish/wm/commands/shrink-yank.jl
+++ b/lisp/sawfish/wm/commands/shrink-yank.jl
@@ -30,7 +30,8 @@
             yank-window-left
             yank-window-right
             yank-window-up
-            yank-window-down)
+            yank-window-down
+    contract-window)
 
     (open   rep
             sawfish.wm.commands
@@ -88,6 +89,13 @@ before."
 before."
     (yank-window window 'down))
 
+  (define (contract-window window)
+    "Contracts a window. (shrink in all four directions)"
+    (shrink-window window 'up)
+    (shrink-window window 'right)
+    (shrink-window window 'down)
+    (shrink-window window 'left))
+
   ;;###autoload
   (define-command 'shrink-window-left shrink-window-left #:spec "%W")
   (define-command 'shrink-window-right shrink-window-right #:spec "%W")
@@ -97,6 +105,7 @@ before."
   (define-command 'yank-window-right yank-window-right #:spec "%W")
   (define-command 'yank-window-up yank-window-up #:spec "%W")
   (define-command 'yank-window-down yank-window-down #:spec "%W")
+  (define-command 'contract-window contract-window #:spec "%W")
 
 ;;; Implementation:
 
diff --git a/lisp/sawfish/wm/state/maximize.jl b/lisp/sawfish/wm/state/maximize.jl
index 2c89973..c7560e1 100644
--- a/lisp/sawfish/wm/state/maximize.jl
+++ b/lisp/sawfish/wm/state/maximize.jl
@@ -39,12 +39,12 @@
     maximize-window-toggle
     maximize-window-vertically-toggle
     maximize-window-horizontally-toggle
-    maximize-fill-window
-    maximize-fill-window-vertically
-    maximize-fill-window-horizontally
-    maximize-fill-window-toggle
-    maximize-fill-window-vertically-toggle
-    maximize-fill-window-horizontally-toggle
+    expand-window
+    expand-window-vertically
+    expand-window-horizontally
+    expand-window-toggle
+    expand-window-vertically-toggle
+    expand-window-horizontally-toggle
     maximize-window-fullscreen
     maximize-window-fullscreen-toggle
     maximize-window-fullxinerama
@@ -454,40 +454,40 @@ unmaximized."
 
 ;;; fill commands
 
-  (define (maximize-fill-window w #!optional direction)
+  (define (expand-window w #!optional direction)
     "Maximize the window without obscuring any other windows."
     (let ((avoid-by-default t)
   (maximize-always-expands t)
   (dont-avoid-ignored maximize-ignore-when-filling))
       (maximize-window w direction t)))
 
-  (define (maximize-fill-window-vertically w)
+  (define (expand-window-vertically w)
     "Maximize the window vertically without obscuring any other windows."
-    (maximize-fill-window w 'vertical))
+    (expand-window w 'vertical))
 
-  (define (maximize-fill-window-horizontally w)
+  (define (expand-window-horizontally w)
     "Maximize the window horizontally without obscuring any other windows."
-    (maximize-fill-window w 'horizontal))
+    (expand-window w 'horizontal))
 
-  (define (maximize-fill-window-toggle w #!optional direction)
+  (define (expand-window-toggle w #!optional direction)
     "Toggle the state of the window between maximized-filled and unmaximized."
     (if (window-maximized-p w)
  (unmaximize-window w direction)
-      (maximize-fill-window w direction)))
+      (expand-window w direction)))
 
-  (define (maximize-fill-window-vertically-toggle w)
+  (define (expand-window-vertically-toggle w)
     "Toggle the state of the window between vertically maximized-filled and
 unmaximized."
     (if (window-maximized-vertically-p w)
  (unmaximize-window w 'vertical)
-      (maximize-fill-window w 'vertical)))
+      (expand-window w 'vertical)))
 
-  (define (maximize-fill-window-horizontally-toggle w)
+  (define (expand-window-horizontally-toggle w)
     "Toggle the state of the window between horizontally maximized-filled and
 unmaximized."
     (if (window-maximized-horizontally-p w)
  (unmaximize-window w 'horizontal)
-      (maximize-fill-window w 'horizontal)))
+      (expand-window w 'horizontal)))
 
   (define (maximize-unframe w)
     (set-window-type w 'unframed)
@@ -498,18 +498,18 @@ unmaximized."
     (maximize-window w))
 
   ;;###autoload
-  (define-command 'maximize-fill-window
-    maximize-fill-window #:spec "%W")
-  (define-command 'maximize-fill-window-vertically
-    maximize-fill-window-vertically #:spec "%W")
-  (define-command 'maximize-fill-window-horizontally
-    maximize-fill-window-horizontally #:spec "%W")
-  (define-command 'maximize-fill-window-toggle
-    maximize-fill-window-toggle #:spec "%W")
-  (define-command 'maximize-fill-window-horizontally-toggle
-    maximize-fill-window-horizontally-toggle #:spec "%W")
-  (define-command 'maximize-fill-window-vertically-toggle
-    maximize-fill-window-vertically-toggle #:spec "%W")
+  (define-command 'expand-window
+    expand-window #:spec "%W")
+  (define-command 'expand-window-vertically
+    expand-window-vertically #:spec "%W")
+  (define-command 'expand-window-horizontally
+    expand-window-horizontally #:spec "%W")
+  (define-command 'expand-window-toggle
+    expand-window-toggle #:spec "%W")
+  (define-command 'expand-window-horizontally-toggle
+    expand-window-horizontally-toggle #:spec "%W")
+  (define-command 'expand-window-vertically-toggle
+    expand-window-vertically-toggle #:spec "%W")
   (define-command 'maximize-unframe
     maximize-unframe #:spec "%W")
   (define-command 'maximize-reframe
diff --git a/man/sawfish.texi b/man/sawfish.texi
index decbf94..0414ba7 100644
--- a/man/sawfish.texi
+++ b/man/sawfish.texi
@@ -2303,8 +2303,8 @@ maximize without overlap to any other windows, except ``ignored'' ones.
 In addition, they don't shrink the window even if it is already bigger
 than the screen size.
 
-@deffn Function maximize-fill-window window &optional direction
-@deffnx Command maximize-fill-window window
+@deffn Function expand-window window &optional direction
+@deffnx Command expand-window window
 Maximize both dimensions of @var{window} without overlapping other
 windows.
 
@@ -2313,20 +2313,20 @@ If defined, @var{direction} is a symbol, either @code{vertical} or
 direction.
 @end deffn
 
-@deffn Function maximize-fill-window-vertically window
-@deffnx Command maximize-fill-window-vertically window
+@deffn Function expand-window-vertically window
+@deffnx Command expand-window-vertically window
 Maximize the vertical dimension of @var{window} in the screen without
 overlapping other windows.
 @end deffn
 
-@deffn Function maximize-fill-window-horizontally window
-@deffnx Command maximize-fill-window-horizontally window
+@deffn Function expand-window-horizontally window
+@deffnx Command expand-window-horizontally window
 Maximize the horizontal dimension of @var{window} in the screen
 without overlapping other windows.
 @end deffn
 
-@deffn Function maximize-fill-window-toggle window
-@deffnx Command maximize-fill-window-toggle window
+@deffn Function expand-window-toggle window
+@deffnx Command expand-window-toggle window
 Toggle the state of @var{window} between maximized and unmaximized in
 the screen without overlapping other windows.
 
@@ -2335,14 +2335,14 @@ If defined, @var{direction} is a symbol, either @code{vertical} or
 direction.
 @end deffn
 
-@deffn Function maximize-fill-window-vertically-toggle window
-@deffnx Command maximize-fill-window-vertically-toggle window
+@deffn Function expand-window-vertically-toggle window
+@deffnx Command expand-window-vertically-toggle window
 Toggle the state of @var{window} between vertically maximized and
 unmaximized in the screen without overlapping other windows.
 @end deffn
 
-@deffn Function maximize-fill-window-horizontally-toggle window
-@deffnx Command maximize-fill-window-horizontally-toggle window
+@deffn Function expand-window-horizontally-toggle window
+@deffnx Command expand-window-horizontally-toggle window
 Toggle the state of @var{window} between horizontally maximized and
 unmaximized in the screen without overlapping other windows.
 @end deffn



signature.asc (205 bytes) Download Attachment

Re: [VOTE] expand-window Vs maximize-fill-window

by Timo Korvola-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Saturday 10 October 2009 12:02:19 Christopher Roy Bratusek wrote:
> Indeed it is, but it doesn't match the naming scheme,

It does not have to be a perfect match, because the functionality is not
exactly opposite either.

> so would it be better to rename maximize-fill-*-window{,-toggle} to
> expand-window-*{,-toggle}?

No, unless you want to replace maximize by expand everywhere.  Which
might not be such a bad idea, except that because of Windows, maximize
and minimize window have become rather well known terms.

--
        Timo Korvola <URL:http://www.iki.fi/tkorvola>

Re: [VOTE] expand-window Vs maximize-fill-window

by Flashrider :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am Sonntag, den 11.10.2009, 12:07 +0300 schrieb Timo Korvola:

> On Saturday 10 October 2009 12:02:19 Christopher Roy Bratusek wrote:
> > Indeed it is, but it doesn't match the naming scheme,
>
> It does not have to be a perfect match, because the functionality is not
> exactly opposite either.
>
> > so would it be better to rename maximize-fill-*-window{,-toggle} to
> > expand-window-*{,-toggle}?
>
> No, unless you want to replace maximize by expand everywhere.  Which
> might not be such a bad idea, except that because of Windows, maximize
> and minimize window have become rather well known terms.
>
Well, expand and maximize are not the same, maximize increases the
windows size to screen-width . screen-height (- x . y of dock windows &
co), expand increases the size of the window until it hits other
windows, therefore replacing maximize with expand everywhere is wrong in
my eyes, but: maximize-fill-window suggests it would be a maximisation
action, but in truth it "just" expands the window.

Chris


signature.asc (205 bytes) Download Attachment

Re: [VOTE] expand-window Vs maximize-fill-window

by Timo Korvola-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sunday 11 October 2009 12:11:10 Christopher Roy Bratusek wrote:
> Well, expand and maximize are not the same,

As you can tell from the implementation, they are very similar.  
Maximize just avoids dock windows whereas expand avoids all windows.

> maximize-fill-window suggests it would be a maximisation action,

And it is, because it sets the maximisation flag.  But grow also does
that optionally, so not all maximisation actions are named "maximize".  
Perhaps expand-window is a decent enough name.  OTOH, wouldn't changing
the name break people's key bindings?

--
        Timo Korvola <URL:http://www.iki.fi/tkorvola>

Re: [VOTE] expand-window Vs maximize-fill-window

by Flashrider :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am Sonntag, den 11.10.2009, 17:52 +0300 schrieb Timo Korvola:

> On Sunday 11 October 2009 12:11:10 Christopher Roy Bratusek wrote:
> > Well, expand and maximize are not the same,
>
> As you can tell from the implementation, they are very similar.  
> Maximize just avoids dock windows whereas expand avoids all windows.
>
> > maximize-fill-window suggests it would be a maximisation action,
>
> And it is, because it sets the maximisation flag.  But grow also does
> that optionally, so not all maximisation actions are named "maximize".  
> Perhaps expand-window is a decent enough name.  OTOH, wouldn't changing
> the name break people's key bindings?
>
Well expand-window/maximize-fill-window should not set the maximize-flag
as it's not necessarily maximized, just expanded, by default maximized
windows are not movable, that is not desired for expanded windows, so it
should never set that flag.

We can provide meta-commands like

(define (maximize-fill-window <args>)
  (expand-window <args>)
  (display-message-with-timeout "<deprecation warning>" 10))

until the release of 1.6.0 and drop them afterwards, also Notes in
README.IMPORTANT and NEWS would be added.

Chris


signature.asc (205 bytes) Download Attachment

Re: [VOTE] expand-window Vs maximize-fill-window

by Timo Korvola-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sunday 11 October 2009 23:32:08 Christopher Roy Bratusek wrote:
> Well expand-window/maximize-fill-window should not set the
> maximize-flag

Doing so makes it easy to revert to the previous size and position.  
Personally I don't use maximize-fill-window but have set grow-is-
maximize for that reason.

> by default maximized windows are not movable

That would be annoying, so I have also unset move-lock-when-maximized.

--
        Timo Korvola <URL:http://www.iki.fi/tkorvola>