darcs patch: Config.hs, Operations.hs: +unfloat, unfloatFocused fun...

Sat May 2 14:26:31 EDT 2009 gwern0@gmail.com * Config.hs, Operations.hs: +unfloat, unfloatFocused functions 'unfloat' is the obvious inverse of the existing 'float' function, and so makes the API a little more rational. 'unfloatFocused' is easy once you have unfloat, and more importantly, is defined in
20 user configs; so obviously there's a need!

Isn't 'unfloat' the same as 'sink'? unfloatFocused seems useful. Do you have some examples of how people are using it? gwern0:
Sat May 2 14:26:31 EDT 2009 gwern0@gmail.com * Config.hs, Operations.hs: +unfloat, unfloatFocused functions 'unfloat' is the obvious inverse of the existing 'float' function, and so makes the API a little more rational. 'unfloatFocused' is easy once you have unfloat, and more importantly, is defined in
20 user configs; so obviously there's a need!
Content-Description: A darcs patch for your repository!
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
New patches:
[Config.hs, Operations.hs: +unfloat, unfloatFocused functions gwern0@gmail.com**20090502182631 Ignore-this: 782418b6bdeaf3b9890a43b44651dbe5 'unfloat' is the obvious inverse of the existing 'float' function, and so makes the API a little more rational. 'unfloatFocused' is easy once you have unfloat, and more importantly, is defined in
20 user configs; so obviously there's a need! ] { hunk ./XMonad/Config.hs 210 , ((modMask, xK_l ), sendMessage Expand) -- %! Expand the master area
-- floating layer support - - , ((modMask, xK_t ), withFocused $ windows . W.sink) -- %! Push window back into tiling + , ((modMask, xK_t ), unfloatFocused) -- %! Push window back into tiling
-- increase or decrease number of windows in the master area , ((modMask , xK_comma ), sendMessage (IncMasterN 1)) -- %! Increment the number of windows in the master area hunk ./XMonad/Operations.hs 384 withFocused :: (Window -> X ()) -> X () withFocused f = withWindowSet $ \w -> whenJust (W.peek w) f
+-- | 'unfloat' window with focus. +unfloatFocused :: X () +unfloatFocused = withFocused $ unfloat + -- | 'True' if window is under management by us isClient :: Window -> X Bool isClient w = withWindowSet $ return . W.member w hunk ./XMonad/Operations.hs 470 sw <- W.lookupWorkspace sc ws return (W.focusWindow f . W.shiftWin sw w $ ws)
+-- | Inverse of 'float'; push a floating window back into tiling stack. +unfloat :: Window -> X () +unfloat = windows . W.sink + -- --------------------------------------------------------------------- -- Mouse handling
}
Context:
[Avoid deadly cycle in man/xmonad.hs Spencer Janssen
**20090319081918 Ignore-this: adcba110caad465a2cbb4b9dca7cb612 ] [X.Config.hs, ./man/xmonad.hs: update Event Hook doc wirtwolff@gmail.com**20090209183837 Ignore-this: 3792043278932e371e3e2858913a2b17 ] [Use records to document Tall's arguments Spencer Janssen **20090221230628 Ignore-this: 253c09de793715c18a029406795a42fd ] [Fix possible head [] Joachim Breitner **20090106192026 This seems to be a rare case, but I just got hit by it. ] [ManageHook.doShift: use shiftWin instead of shift Spencer Janssen **20090219041458 Ignore-this: 4d7f348d6d394c581ab2809bbc45a2c6 ] [Express shift in terms of shiftWin Spencer Janssen **20090217235343 Ignore-this: 8f213bca20065a39e7c16027f7b398cf ] [Use standard -fforce-recomp instead of undocumented -no-recomp Don Stewart **20090208165518] [Support for custom event hooks Daniel Schoepe **20090203155536 Ignore-this: f22f1a7ae2d958ba1b3625aa923b7efd ] [Make X an instance of Typeable Daniel Schoepe **20090128215406 Ignore-this: bb155e62ea4e451460e3b94508dc49d2 ] [Add uninstallSignalHandlers, use in spawn Spencer Janssen **20090122002643 Ignore-this: d91bde6f965341a2619fe2dde83cc099 ] [Create a new session for forked processes Spencer Janssen **20090122000423 Ignore-this: f5d9cf254a0b07ddbf204457b7783880 ] [TAG 0.8.1 Spencer Janssen **20090118083910] [Close stdin in spawned processes Spencer Janssen **20090117040024 Ignore-this: 2e372ed6215160adae8da1c44cdede3d ] [Document spawnPID Spencer Janssen **20090117035907 Ignore-this: 1641bdcf5055b2ec7b9455265f5b1d52 ] [Asynchronously recompile/restart xmonad on mod-q Spencer Janssen **20090117035300 Ignore-this: 753d8746034f818b81df79003ae5ee0d ] [Add --restart, a command line flag to cause a running xmonad process to restart Spencer Janssen **20090117034959 Ignore-this: 45c8c8aba7cc7391b95c7e3fb01e5bf9 ] [Bump version to 0.8.1 Spencer Janssen **20090116223621 Ignore-this: 2e8e9dc7b6ca725542f4afe04253dc57 ] [Remove doubleFork, handle SIGCHLD Spencer Janssen **20090116204742 Ignore-this: f9b1a65b4f0622922f80ad2ab6c5a52f This is a rather big change. Rather than make spawned processes become children of init, we handle them in xmonad. As a side effect of this change, we never need to use waitForProcess in any contrib module -- in fact, doing so will raise an exception. The main benefit to handling SIGCHLD is that xmonad can now be started with 'exec', and will correctly clean up after inherited child processes. ] [More flexible userCode function Daniel Schoepe **20090110221852] [Call logHook as the very last action in windows Spencer Janssen **20081209233700 Ignore-this: 4396ad891b607780f8e4b3b6bbce87e ] [Main.hs: escape / in Haddocks gwern0@gmail.com**20081207020915 Ignore-this: 2c4525280fbe73c46f3abd8fc13628e9 This lets haddocks for Main.hs, at least, to build with 2.3.0. ] [Accept inferior crossing events. This patch enables fmouse-focus-follows-screen Spencer Janssen **20081205045130 Ignore-this: 3ac329fb92839827aed0a4370784cabd ] [Tile all windows at once Spencer Janssen **20081118074447] [Factor rational rect scaling into a separate function Spencer Janssen **20081118072849] [Change screen focus by clicking on the root window. Spencer Janssen **20081106224031 This is a modification of a patch from Joachim Breitner. ] [Fix #192. Spencer Janssen **20081021220059] [select base < 4 for building on ghc 6.10 Adam Vogt **20081013214509] [add killWindow function Joachim Breitner **20081005001804 This is required to kill anything that is not focused, without having to focus it first. ] [add'l documentation Devin Mullins **20080927234639] [Regression: ungrab buttons on *non* root windows Spencer Janssen **20081007214351] [Partial fix for #40 Spencer Janssen **20081007212053 Improvements: - clicking on the root will change focus to that screen - moving the mouse from a window on a screen to an empty screen changes focus to that screen The only remaining issue is that moving the mouse between two empty screens does not change focus. In order to solve this, we'd have to select motion events on the root window, which is potentially expensive. ] [Track mouse position via events received Spencer Janssen **20081007203953] [Fix haddock Spencer Janssen **20081007094641] [Move screen locating code into pointScreen Spencer Janssen **20081007094207] [Make pointWithin a top-level binding Spencer Janssen **20081007090229] [sp README, CONFIG, STYLE, TODO gwern0@gmail.com**20080913024457] [Use the same X11 dependency as xmonad-contrib Spencer Janssen **20080921061508] [Export focusUp' and focusDown' -- work entirely on stacks Spencer Janssen **20080911214803] [add W.shiftMaster, fix float/tile-reordering bug Devin Mullins **20080911053909] [TAG 0.8 Spencer Janssen **20080905195412] Patch bundle hash: 789863517e7c765f75aa84289b5d3189e65d8731 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEAREKAAYFAkn8kSkACgkQvpDo5Pfl1oIqPQCfTUUzYe2ONWCIATpbOznSJwaG JdAAn0XSZM+AufBLH2TtobeCueD8VN10 =DfAM -----END PGP SIGNATURE-----
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On Sat, May 2, 2009 at 3:11 PM, Don Stewart wrote:
Isn't 'unfloat' the same as 'sink'?
If it is, I don't see how defining unfloat as 'windows . W.sink' would work.
unfloatFocused seems useful. Do you have some examples of how people are using it?
Sure. Using my downloader tool to get the config archive, here are 20 copy-pastes of the unfloat function in people's configs (and presumably there are more in configs not included in the archive): 12.hs: , ((mod4Mask , xK_t ), withFocused $ windows . W.sink) -- %! Push window back into tiling 13.hs: , ((m, xK_z), withFocused $ windows . W.sink) -- unfloat 15.hs: , ("M-r", withFocused $ windows . W.sink) 19.hs: , ("M-t", withFocused $ windows . W.sink) 1.hs: , ((modm, xK_t ), withFocused $ windows . W.sink) 21.hs: , ((modMask, xK_t ), withFocused $ windows . W.sink) 24.hs: , ("M-t", withFocused $ windows . W.sink) 25.hs: , ("M-d", withFocused $ windows . W.sink) 28.hs: , ("M-t" , withFocused $ windows . W.sink) -- put window back on tiling layer 2.hs: , ((modm, xK_t ), withFocused $ windows . W.sink) 34.hs: , ((modMask, xK_t ), withFocused $ windows . W.sink) 38.hs: , ((modMask, xK_v ), withFocused $ windows . W.sink) 3.hs: , ((modMask, xK_s ), withFocused $ windows . W.sink) 40.hs: , ((modMask, xK_t ), withFocused $ windows . W.sink) 42.hs: , ("M-t", withFocused $ windows . W.sink) -- unfloat 44.hs: , ((modMask, xK_t ), withFocused $ windows . W.sink) 45.hs: , ((modMask .|. shiftMask, xK_t ), withFocused $ windows . W.sink) 48.hs: , ((modMask, xK_t ), withFocused $ windows . W.sink) -- %! Push window back into tiling 52.hs: , ((modMask, xK_t ), withFocused $ windows . W.sink) 7.hs: , ((modMask .|. controlMask, xK_d), withFocused $ windows . W.sink) -- push window back into tiling Getting rid of some copy-paste in >20 configs strikes me as worth 6 lines. - -- gwern -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Use GnuPG with Firefox : http://getfiregpg.org (Version: 0.7.5) iEYEAREKAAYFAkn8nVwACgkQvpDo5Pfl1oLddwCfaWtamRt+B2mUgM8y4br978oK jJIAni2D/I/6+BCP68Dshydtpem/sxSy =zXai -----END PGP SIGNATURE-----

Ah, they're not copy-paste though -- they're in the default Config. -- Don gwern0:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
On Sat, May 2, 2009 at 3:11 PM, Don Stewart wrote:
Isn't 'unfloat' the same as 'sink'?
If it is, I don't see how defining unfloat as 'windows . W.sink' would work.
unfloatFocused seems useful. Do you have some examples of how people are using it?
Sure. Using my downloader tool to get the config archive, here are 20 copy-pastes of the unfloat function in people's configs (and presumably there are more in configs not included in the archive):
12.hs: , ((mod4Mask , xK_t ), withFocused $ windows . W.sink) -- %! Push window back into tiling 13.hs: , ((m, xK_z), withFocused $ windows . W.sink) -- unfloat 15.hs: , ("M-r", withFocused $ windows . W.sink) 19.hs: , ("M-t", withFocused $ windows . W.sink) 1.hs: , ((modm, xK_t ), withFocused $ windows . W.sink) 21.hs: , ((modMask, xK_t ), withFocused $ windows . W.sink) 24.hs: , ("M-t", withFocused $ windows . W.sink) 25.hs: , ("M-d", withFocused $ windows . W.sink) 28.hs: , ("M-t" , withFocused $ windows . W.sink) -- put window back on tiling layer 2.hs: , ((modm, xK_t ), withFocused $ windows . W.sink) 34.hs: , ((modMask, xK_t ), withFocused $ windows . W.sink) 38.hs: , ((modMask, xK_v ), withFocused $ windows . W.sink) 3.hs: , ((modMask, xK_s ), withFocused $ windows . W.sink) 40.hs: , ((modMask, xK_t ), withFocused $ windows . W.sink) 42.hs: , ("M-t", withFocused $ windows . W.sink) -- unfloat 44.hs: , ((modMask, xK_t ), withFocused $ windows . W.sink) 45.hs: , ((modMask .|. shiftMask, xK_t ), withFocused $ windows . W.sink) 48.hs: , ((modMask, xK_t ), withFocused $ windows . W.sink) -- %! Push window back into tiling 52.hs: , ((modMask, xK_t ), withFocused $ windows . W.sink) 7.hs: , ((modMask .|. controlMask, xK_d), withFocused $ windows . W.sink) -- push window back into tiling
Getting rid of some copy-paste in >20 configs strikes me as worth 6 lines.
- -- gwern -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Use GnuPG with Firefox : http://getfiregpg.org (Version: 0.7.5)
iEYEAREKAAYFAkn8nVwACgkQvpDo5Pfl1oLddwCfaWtamRt+B2mUgM8y4br978oK jJIAni2D/I/6+BCP68Dshydtpem/sxSy =zXai -----END PGP SIGNATURE-----

Perhaps an alternative would be to make it easier to refer to actions by the keys that call them in the default config, which is sort of awkward currently. The goal would be remapping sort of like in vim. Here's a sketch:
fromDefaultConfig :: (ButtonMask, KeySym) -> (X ()) fromDefaultConfig k = fromMaybe (return ()) $ Map.lookup k $ keys dcl dcl where dcl = defaultConfig { layoutHook = Layout $ layoutHook defaultConfig }
I can't see myself using this, but it could simplify rearranging keys as those configs do. Adam
participants (4)
-
Adam Vogt
-
Don Stewart
-
Gwern Branwen
-
gwern0@gmail.com