mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-09 16:31:53 -07:00
X.U.EZConfig: Simplify removeKeys, removeMouseBindings
We're not parsing anything (as opposed to the respective `P` functions) and so there's no need to create a dummy map with units as values and then take the difference; we can simply remove the relevant keys from the map.
This commit is contained in:
@@ -109,7 +109,7 @@ additionalKeysP conf keyList =
|
|||||||
-- > `removeKeys` [(mod1Mask .|. shiftMask, n) | n <- [xK_1 .. xK_9]]
|
-- > `removeKeys` [(mod1Mask .|. shiftMask, n) | n <- [xK_1 .. xK_9]]
|
||||||
removeKeys :: XConfig a -> [(KeyMask, KeySym)] -> XConfig a
|
removeKeys :: XConfig a -> [(KeyMask, KeySym)] -> XConfig a
|
||||||
removeKeys conf keyList =
|
removeKeys conf keyList =
|
||||||
conf { keys = \cnf -> keys conf cnf `M.difference` M.fromList (zip keyList $ repeat ()) }
|
conf { keys = \cnf -> foldr M.delete (keys conf cnf) keyList }
|
||||||
|
|
||||||
-- | Like 'removeKeys', except using short @String@ key descriptors
|
-- | Like 'removeKeys', except using short @String@ key descriptors
|
||||||
-- like @\"M-m\"@ instead of @(modMask, xK_m)@, as described in the
|
-- like @\"M-m\"@ instead of @(modMask, xK_m)@, as described in the
|
||||||
@@ -130,8 +130,7 @@ additionalMouseBindings conf mouseBindingsList =
|
|||||||
-- | Like 'removeKeys', but for mouse bindings.
|
-- | Like 'removeKeys', but for mouse bindings.
|
||||||
removeMouseBindings :: XConfig a -> [(ButtonMask, Button)] -> XConfig a
|
removeMouseBindings :: XConfig a -> [(ButtonMask, Button)] -> XConfig a
|
||||||
removeMouseBindings conf mouseBindingList =
|
removeMouseBindings conf mouseBindingList =
|
||||||
conf { mouseBindings = \cnf -> mouseBindings conf cnf `M.difference`
|
conf { mouseBindings = \cnf -> foldr M.delete (mouseBindings conf cnf) mouseBindingList }
|
||||||
M.fromList (zip mouseBindingList $ repeat ()) }
|
|
||||||
|
|
||||||
|
|
||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user