darcs patch: add LayoutChoice module.

Hi all,
This function actually could go into xmonad proper, but I'd
rather not write that patch until there's a consensus that
it's a good idea. This is just a layout that allows you to
select between several layouts. Naturally, it's designed to
be the "only" layout, so that it handles all layout switching.
Besides the ordinary forward and backward rotation of layouts,
it allows you to jump directly to named layouts. More features
could be added. An obvious one would be to dynamically add and
remove layouts from particular workspaces (e.g. I may never
want my iceweasel workspace to be anything but full and
tabbed).
If this is moved into mainline xmonad, it would mean that we
could eliminate the ugly (Layout Window, [Layout Window])
in favor of a simple (Layout Window).
Incidentally, what drove me to write this was not a cleanup
(which would be a good reason), but wanting to have layout
modifiers apply to all layouts with a single state shared.
My workspaceDir state was getting messed up every time I
changed layouts (which is pretty often now that I use VNC with
different size screens).
Anyhow, thoughts or recommendations are welcome.
David
Thu Sep 6 11:49:55 EDT 2007 David Roundy

David Roundy
Anyhow, thoughts or recommendations are welcome.
That's a functionality I missed since I switched to xmonad, so thanks a lot. But I cannot apply the patch. Darcs tells me: ,---- | root@baldur /u/p/d/d/x/XMonadContrib# darcs apply /home/heimdall/add-layout… | …choice-module_.dpatch | darcs failed: Patch bundle failed hash! | This probably means that the patch has been corrupted by a mailer. | The most likely culprit is CRLF newlines. `---- But my emacs says the file has unix-eols. What's the culprit? Bye, Tassilo -- Coroners refer to dead people as "ABC's". Already Been Chucked.

On Thu, Sep 06, 2007 at 06:50:52PM +0200, Tassilo Horn wrote:
David Roundy
writes: Hi David,
Hi!
Anyhow, thoughts or recommendations are welcome.
That's a functionality I missed since I switched to xmonad, so thanks a lot. But I cannot apply the patch. Darcs tells me:
I presume the jumping straight to full-screen is what you've missed?
,---- | root@baldur /u/p/d/d/x/XMonadContrib# darcs apply /home/heimdall/add-layout… | …choice-module_.dpatch | darcs failed: Patch bundle failed hash! | This probably means that the patch has been corrupted by a mailer. | The most likely culprit is CRLF newlines. `----
But my emacs says the file has unix-eols. What's the culprit?
How did you save the patch from your email? Most likely that's when it got corrupted. -- David Roundy Department of Physics Oregon State University

David Roundy
That's a functionality I missed since I switched to xmonad, so thanks a lot. But I cannot apply the patch. Darcs tells me:
I presume the jumping straight to full-screen is what you've missed?
Yes, and since I use 5 layouts which are all usefull in some scenarios it's not always possible to guess in what layout I am. Tiled, mirror tiled, full and two-pane look similar for one window, and tiled and two-pane look similar for two windows. So you have to learn the sequence of layouts in defaultLayouts and count from the first distinguishable layout when switching.
,---- | root@baldur /u/p/d/d/x/XMonadContrib# darcs apply /home/heimdall/add-layout… | …choice-module_.dpatch | darcs failed: Patch bundle failed hash! | This probably means that the patch has been corrupted by a mailer. | The most likely culprit is CRLF newlines. `----
But my emacs says the file has unix-eols. What's the culprit?
How did you save the patch from your email?
`o' (`gnus-mime-save-part') on the attachment.
Most likely that's when it got corrupted.
Hm, that's the normal way I do it. I tested it with another patch and it worked. Bye, Tassilo -- Chuck Norris can taste lies.

On Thu, Sep 06, 2007 at 07:51:43PM +0200, Tassilo Horn wrote:
David Roundy
writes: That's a functionality I missed since I switched to xmonad, so thanks a lot. But I cannot apply the patch. Darcs tells me:
I presume the jumping straight to full-screen is what you've missed?
Yes, and since I use 5 layouts which are all usefull in some scenarios it's not always possible to guess in what layout I am. Tiled, mirror tiled, full and two-pane look similar for one window, and tiled and two-pane look similar for two windows. So you have to learn the sequence of layouts in defaultLayouts and count from the first distinguishable layout when switching.
Yeah, it's been a bit of a challenge for me with a similar number of layouts. Just out of curiosity, have you tried a simple combo/tabbed layout for your two-pane? I find it much easier, as you can see what other windows are available: , simpleStacking $ combo (twoPane 0.03 0.5) [(full,1),(tabbed shrinkText defaultTConf,1)]
,---- | root@baldur /u/p/d/d/x/XMonadContrib# darcs apply /home/heimdall/add-layout… | …choice-module_.dpatch | darcs failed: Patch bundle failed hash! | This probably means that the patch has been corrupted by a mailer. | The most likely culprit is CRLF newlines. `----
But my emacs says the file has unix-eols. What's the culprit?
How did you save the patch from your email?
`o' (`gnus-mime-save-part') on the attachment.
Hmmm. That sounds reasonable.
Most likely that's when it got corrupted.
Hm, that's the normal way I do it. I tested it with another patch and it worked.
All I can think is that maybe for some reason gnus corrupts patches only occasionally (e.g. I've run into scenarios in the past where mailers corrupted patches containing a "From" at the beginning of a line). But I've very little idea what could be the problem. Maybe you could send the file you saved to me as an attachment? (Or put it up to be downloaded?) -- David Roundy Department of Physics Oregon State University

David Roundy
Just out of curiosity, have you tried a simple combo/tabbed layout for your two-pane? I find it much easier, as you can see what other windows are available:
, simpleStacking $ combo (twoPane 0.03 0.5) [(full,1),(tabbed shrinkText defaultTConf,1)]
Not yet, but I add it to my to-try-out-list.
How did you save the patch from your email?
`o' (`gnus-mime-save-part') on the attachment.
Hmmm. That sounds reasonable.
Most likely that's when it got corrupted.
Hm, that's the normal way I do it. I tested it with another patch and it worked.
All I can think is that maybe for some reason gnus corrupts patches only occasionally (e.g. I've run into scenarios in the past where mailers corrupted patches containing a "From" at the beginning of a line). But I've very little idea what could be the problem. Maybe you could send the file you saved to me as an attachment? (Or put it up to be downloaded?)
Sure. You can fetch it from http://www.tsdh.de/add-layoutchoice-module_.dpatch Bye, Tassilo

On Thu, Sep 06, 2007 at 09:24:02PM +0200, Tassilo Horn wrote:
David Roundy
writes: How did you save the patch from your email?
`o' (`gnus-mime-save-part') on the attachment.
Hmmm. That sounds reasonable.
Most likely that's when it got corrupted.
Hm, that's the normal way I do it. I tested it with another patch and it worked.
All I can think is that maybe for some reason gnus corrupts patches only occasionally (e.g. I've run into scenarios in the past where mailers corrupted patches containing a "From" at the beginning of a line). But I've very little idea what could be the problem. Maybe you could send the file you saved to me as an attachment? (Or put it up to be downloaded?)
Sure. You can fetch it from
It looks like you're using gmane, and gmane is for some reason munging the
email addresses, or at least that's my best guess. I have no idea why it
would do this (or why it wouldn't always do so). (I am *so* glad I added
that hash to the patch bundles... it's hard to imagine how I lived without
it.)
David (see portion of diff below)
--- add-layoutchoice-module_.dpatch 2007-09-06 12:22:58.000000000 -0700
+++ add-layoutchoice-module_.dpatch.good 2007-09-06 10:53:53.000000000 -0700
@@ -2,7 +2,7 @@
New patches:
[add LayoutChoice module.
-David Roundy
{ addfile ./LayoutChoice.hs @@ -13,7 +13,7 @@ +-- Copyright : (c) David Roundy +-- License : BSD-style (see xmonad/LICENSE) +-- -+-- Maintainer : email-Jbz+COfnBihBDgjK7y7TUQ@public.gmane.org ++-- Maintainer : email@address.com +-- Stability : unstable +-- Portability : unportable +--

David Roundy
It looks like you're using gmane, and gmane is for some reason munging the email addresses, or at least that's my best guess.
Oh, right, I forgot that. Could you send me the patch via mail?
-David Roundy
**20070906154955] +David Roundy **20070906154955] [snip] -+-- Maintainer : email-Jbz+COfnBihBDgjK7y7TUQ@public.gmane.org ++-- Maintainer : email@address.com
Haha, double garbage. ;-) Bye, Tassilo

David Roundy
Just out of curiosity, have you tried a simple combo/tabbed layout for your two-pane? I find it much easier, as you can see what other windows are available:
, simpleStacking $ combo (twoPane 0.03 0.5) [(full,1),(tabbed shrinkText defaultTConf,1)]
Hey, that's really nice. Thanks for the tip! Bye, Tassilo -- 182,000 Americans die from Chuck Norris-related accidents every year.

Hi all, for anyone interested, that's how I use LayoutChoice with a prompt to select a layout algorithm by name. --8<---------------cut here---------------start------------->8--- myNamedLayouts :: [(String, Layout Window)] myNamedLayouts = [ ("tiled", tiled) , ("mirror-tiled", mirror tiled) , ("tabbed", tabbed shrinkText myTConf) , ("two-pane-combo" , simpleStacking $ combo (twoPane delta (1%2)) [(full,1) ,(tabbed shrinkText defaultTConf, 1)]) ] where -- default tiling algorithm partitions the screen into two panes tiled = tall nmaster delta ratio -- The default number of windows in the master pane nmaster = 1 -- Default proportion of screen occupied by master pane ratio = 1%2 -- Percent of screen to increment by when resizing panes delta = 2%100 -- the tabbed configuration to use for the tabbed layout myTConf = defaultTConf { tabSize = 15 , fontName = "-misc-fixed-medium-r-*-*-13-*-*-*-*-*-*-*" } data LayoutPrompt = LayoutPrompt instance XPrompt LayoutPrompt where showXPrompt LayoutPrompt = "Layout: " layoutPrompt :: XPConfig -> X () layoutPrompt c = mkXPrompt LayoutPrompt c (mkComplFunFromList (map fst myNamedLayouts)) (sendMessage . JumpToLayout) defaultLayouts :: [Layout Window] defaultLayouts = [ layoutChoice myNamedLayouts ] --8<---------------cut here---------------end--------------->8--- I don't bind any keys to cycle to the layouts anymore, but only the prompt. --8<---------------cut here---------------start------------->8--- keys = M.fromList $ -- launching and killing programs [ ... ... , ((modMask, xK_space ), layoutPrompt myXPConfig) ... ] --8<---------------cut here---------------end--------------->8--- Bye, Tassilo

On Thursday 06 September 2007 10:57:41 David Roundy wrote:
Hi all,
This function actually could go into xmonad proper, but I'd rather not write that patch until there's a consensus that it's a good idea. This is just a layout that allows you to select between several layouts. Naturally, it's designed to be the "only" layout, so that it handles all layout switching.
Besides the ordinary forward and backward rotation of layouts, it allows you to jump directly to named layouts. More features could be added. An obvious one would be to dynamically add and remove layouts from particular workspaces (e.g. I may never want my iceweasel workspace to be anything but full and tabbed).
If this is moved into mainline xmonad, it would mean that we could eliminate the ugly (Layout Window, [Layout Window]) in favor of a simple (Layout Window).
Incidentally, what drove me to write this was not a cleanup (which would be a good reason), but wanting to have layout modifiers apply to all layouts with a single state shared. My workspaceDir state was getting messed up every time I changed layouts (which is pretty often now that I use VNC with different size screens).
Anyhow, thoughts or recommendations are welcome.
David
Thu Sep 6 11:49:55 EDT 2007 David Roundy
* add LayoutChoice module.
Applied, thanks. I'd like to move this into mainline xmonad at the same time we fix layout serialization and move layouts from XState to StackSet. Cheers, Spencer Janssen

On Fri, Sep 14, 2007 at 12:31:56PM -0500, Spencer Janssen wrote:
On Thursday 06 September 2007 10:57:41 David Roundy wrote:
Thu Sep 6 11:49:55 EDT 2007 David Roundy
* add LayoutChoice module. Applied, thanks.
I'd like to move this into mainline xmonad at the same time we fix layout serialization and move layouts from XState to StackSet.
Sounds like a good plan to me. -- David Roundy Department of Physics Oregon State University
participants (3)
-
David Roundy
-
Spencer Janssen
-
Tassilo Horn