Two patches for xmonad-contrib: new layout modifier and new "conditional" layout

Hello XMonad world. There are two patches for xmonad-contrib. InRegion is a layout modifier. It runs underlying layout in restricted rectangle region. You specify that region with X,Y coordinates of top-left corner, and width, height of rectangle. All numbers are specified as parts of whole region (e.g., screen dimensions). So, "inRegion 0 0 1 1 someLayout" will just run someLayout as is. "inRegion 0.15 0 0.7 1 Full" will give you 15% margins at left and at right. IfMax layout is a "conditional layout". It runs one layout, if there are as maximum N windows, and otherwise it runs another layout. Example:
ifMax 2 Full (Tall ...) In this example, if there are 1 or 2 windows, Full layout will be used; otherwise, Tall layout will be used.
With best regards, Ilya Portnov.

Hi Ilya,
I have some concerns/suggestions for these modules. First about InRegion:
1. XMonad.Layout.Gaps does the same thing (except with pixels and not
fractions of the screen dimensions), so I think if we call InRegion
GapsRelative that'll emphasize the connection.
2. LayoutBuilder's (layoutAll (relBox a b c d)) is supposed to do the
same thing as (inRegion a b c d).
In IfMax there are some things that should be re-written, unless I'm
missing something. For example, you write:
+ let l1' = fromMaybe l1 ml1'
+ return (wrs, Just $ IfMax n l1' l2)
Why not:
+ return (wrs, fmap (\l1' -> IfMax
n l1' l2) ml1' )
You run the underlying layout with workspace name "", when you could
propagate it.
There are some unnecessary constraints on the LayoutClass instance. It
should be fine to just have `(LayoutClass l1 a, LayoutClass l2 a) =>'
right?
Did you test with decorated layouts? For example, (ifMax 2 Full
simpleTabbed) is ok except that when you click on tabs the focus
doesn't change. I imagine one workaround would be to instead:
addTabs shrinkText def (ifMax 2 Full Simplest)
But maybe both options can be made to work. Or at least the variation
that does work should be described somewhere (if it's not already).
Regards,
Adam
On Sun, Dec 1, 2013 at 11:59 AM, Ilya Portnov
Hello XMonad world.
There are two patches for xmonad-contrib.
InRegion is a layout modifier. It runs underlying layout in restricted rectangle region. You specify that region with X,Y coordinates of top-left corner, and width, height of rectangle. All numbers are specified as parts of whole region (e.g., screen dimensions). So, "inRegion 0 0 1 1 someLayout" will just run someLayout as is. "inRegion 0.15 0 0.7 1 Full" will give you 15% margins at left and at right.
IfMax layout is a "conditional layout". It runs one layout, if there are as maximum N windows, and otherwise it runs another layout. Example:
ifMax 2 Full (Tall ...) In this example, if there are 1 or 2 windows, Full layout will be used; otherwise, Tall layout will be used.
With best regards, Ilya Portnov.
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad

Hello,
I've pushed the ifMax patch. I left out the InRegion because it is
redundant. Please correct me if that's wrong.
--
Adam
On Sun, Dec 1, 2013 at 3:56 PM, adam vogt
Hi Ilya,
I have some concerns/suggestions for these modules. First about InRegion:
1. XMonad.Layout.Gaps does the same thing (except with pixels and not fractions of the screen dimensions), so I think if we call InRegion GapsRelative that'll emphasize the connection.
2. LayoutBuilder's (layoutAll (relBox a b c d)) is supposed to do the same thing as (inRegion a b c d).
In IfMax there are some things that should be re-written, unless I'm missing something. For example, you write:
+ let l1' = fromMaybe l1 ml1' + return (wrs, Just $ IfMax n l1' l2)
Why not:
+ return (wrs, fmap (\l1' -> IfMax n l1' l2) ml1' )
You run the underlying layout with workspace name "", when you could propagate it.
There are some unnecessary constraints on the LayoutClass instance. It should be fine to just have `(LayoutClass l1 a, LayoutClass l2 a) =>' right?
Did you test with decorated layouts? For example, (ifMax 2 Full simpleTabbed) is ok except that when you click on tabs the focus doesn't change. I imagine one workaround would be to instead:
addTabs shrinkText def (ifMax 2 Full Simplest)
But maybe both options can be made to work. Or at least the variation that does work should be described somewhere (if it's not already).
Regards, Adam
On Sun, Dec 1, 2013 at 11:59 AM, Ilya Portnov
wrote: Hello XMonad world.
There are two patches for xmonad-contrib.
InRegion is a layout modifier. It runs underlying layout in restricted rectangle region. You specify that region with X,Y coordinates of top-left corner, and width, height of rectangle. All numbers are specified as parts of whole region (e.g., screen dimensions). So, "inRegion 0 0 1 1 someLayout" will just run someLayout as is. "inRegion 0.15 0 0.7 1 Full" will give you 15% margins at left and at right.
IfMax layout is a "conditional layout". It runs one layout, if there are as maximum N windows, and otherwise it runs another layout. Example:
ifMax 2 Full (Tall ...) In this example, if there are 1 or 2 windows, Full layout will be used; otherwise, Tall layout will be used.
With best regards, Ilya Portnov.
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
participants (2)
-
adam vogt
-
Ilya Portnov