[xmonad] [PATCHv2] * Allow to specify the initial gaps' states in X.L.Gaps (was: Re: [PATCH] * Export X.L.Gaps Gaps constructor)

Paul Fertser fercerpav at gmail.com
Fri Feb 22 09:52:39 CET 2013


On Thu, Feb 21, 2013 at 03:09:46PM -0500, wagnerdm at seas.upenn.edu wrote:
>> On Thu, Feb 21, 2013 at 01:54:28PM -0500, wagnerdm at seas.upenn.edu wrote:
>>> Hm. From a short look at the module, it seems the Gaps constructor is
>>> not exported because there are some invariants maintained by the
>>> auxiliary functions that act on GapSpecs and [Direction2D]s.
>> Do I undertand it right that you mean exporting Gaps constructor would
>> allow users to specify some direction more than once or to add some
>> direction for which a gap is not defined and that it should be
>> prevented compile-time? Would creating another function (gaps' ?) that
>> would accept a list of triples (with the third boolean element to
>> specify an initial state) solve the problem?
> Yep, that's pretty much what I meant. A smart constructor like the one  
> you suggested should deal with the problem just fine.

Sorry but I do not know much about type constructors and data
constructors and I do not see how to apply that (partial) knowledge
here (without adding unnecessary complexity, iow everything I can
imagine is more complicated than the attached patch, which does
not add or modify any constructors, not even in the "smart
constructors idiom" sense).

Thank you for the review!
Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
mailto:fercerpav at gmail.com
-------------- next part --------------
1 patch for repository http://code.haskell.org/XMonadContrib:

Fri Feb 22 11:22:32 MSK 2013  Paul Fertser <fercerpav at gmail.com>
  * Allow to specify the initial gaps' states in X.L.Gaps

New patches:

[Allow to specify the initial gaps' states in X.L.Gaps
Paul Fertser <fercerpav at gmail.com>**20130222072232
 Ignore-this: 31596d918d0050e36ce3f64f56205a64
] {
hunk ./XMonad/Layout/Gaps.hs 32
                                -- * Usage
                                -- $usage
                           Direction2D(..), Gaps,
-                          GapSpec, gaps, GapMessage(..)
+                          GapSpec, gaps, gaps', GapMessage(..)
                           ) where
hunk ./XMonad/Layout/Gaps.hs 143
      -> ModifiedLayout Gaps l a
 gaps g = ModifiedLayout (Gaps g (map fst g))
+-- | Add togglable manual gaps to a layout, explicitly specifying the initial states.
+gaps' :: [((Direction2D,Int),Bool)] -- ^ The gaps to allow and their initial states.
+      -> l a                        -- ^ The layout to modify.
+      -> ModifiedLayout Gaps l a
+gaps' g = ModifiedLayout (Gaps (map fst g) [d | ((d,_),v) <- g, v])


[Allow to limit maximum row count in X.Prompt completion window
Paul Fertser <fercerpav at gmail.com>**20130221122050
 Ignore-this: 923656f02996f2de2b1336275392c5f9
 On a keyboard-less device (such as a smartphone), where one has to use
 an on-screen keyboard, the maximum completion window height must be
 limited to avoid overlapping the keyboard.
[Note in U.NameActions that xmonad core can list default keys now
Adam Vogt <vogt.adam at gmail.com>**20130217233026
 Ignore-this: 937bff636fa88171932d5192fe8e290b
[Export U.NamedActions.addDescrKeys per evaryont's request.
Adam Vogt <vogt.adam at gmail.com>**20130217232619
 Ignore-this: a694a0a3ece70b52fba6e8f688d86344
[Add EWMH DEMANDS_ATTENTION support to UrgencyHook.
Maarten de Vries <maarten at de-vri.es>**20130212181229
 Ignore-this: 5a4b314d137676758fad9ec8f85ce422
 Add support for the _NET_WM_STATE_DEMANDS_ATTENTION atom
 by treating it the same way as the WM_HINTS urgency flag.
[Unconditionally set _NET_WORKAREA in ManageDocks
Adam Vogt <vogt.adam at gmail.com>**20130117180851
 Ignore-this: 9f57e53fba9573d8a92cf153beb7fe7a
[spawn command when no completion is available (if alwaysHighlight is True); changes commandToComplete in Prompt/Shell to complete the whole word instead of using getLastWord
c.lopez at kmels.net**20130209190456
 Ignore-this: ca7d354bb301b555b64d5e76e31d10e8
matthewhague at zoho.com**20120703222726
 Ignore-this: 4af8162ee8b16a60e8fd62fbc915d3c0
 Changes the WorkspaceCompare module's comparison by index to put workspaces without an index last (rather than first).
[SpawnOn modification for issue 523
Adam Vogt <vogt.adam at gmail.com>**20130114014642
 Ignore-this: 703f7dc0f800366b752f0ec1cecb52e5
 This moves the function to help clean up the `Spawner' to the ManageHook
 rather than in functions like spawnOn. Probably it makes no difference, the
 reason is because there's one manageSpawn function but many different so this
 way there are less functions to write.
[Update L.TrackFloating.useTransient example code
Adam Vogt <vogt.adam at gmail.com>**20130112041239
 Ignore-this: e4e31cf1db742778c1d59d52fdbeed7a
 Suggest useTransient goes to the right of trackFloating which is the
 configuration actually tested.
[Adapt ideas of issue 306 patch to a new modifier in L.TrackFloating
Adam Vogt <vogt.adam at gmail.com>**20130112035701
 Ignore-this: d54d27b71b97144ef0660f910fd464aa
[Make X.A.CycleWS not rely on hidden WS order
Dmitri Iouchtchenko <johnnyspoon at gmail.com>**20130109023328
 Ignore-this: 8717a154b33253c5df4e9a0ada4c2c3e
[Add X.H.WorkspaceHistory
Dmitri Iouchtchenko <johnnyspoon at gmail.com>**20130109023307
 Ignore-this: c9e7ce33a944facc27481dde52c7cc80
[Allow removing arbitrary workspaces
Dmitri Iouchtchenko <johnnyspoon at gmail.com>**20121231214343
 Ignore-this: 6fce4bd3d0c5337e5122158583138e74
[Remove first-hidden restriction from X.A.DynamicWorkspaces.removeWorkspace'
Dmitri Iouchtchenko <johnnyspoon at gmail.com>**20121231214148
 Ignore-this: 55fb0859e9a5f476a834ecbdb774aac8
[Add authorspellings file for `darcs show authors'.
Adam Vogt <vogt.adam at gmail.com>**20130101040031
 Ignore-this: c3198072ebc6a71d635bec4d8e2c78fd
 This authorspellings file includes a couple people who've contributed to xmonad
 (not XMonadContrib). When people have multiple addresses, the most recent one
 has been picked.
[TAG 0.11
Adam Vogt <vogt.adam at gmail.com>**20130101014231
 Ignore-this: 57cf32412fd1ce912811cb7fafe930f5
Patch bundle hash:

More information about the xmonad mailing list