From 226b385729630bcd3e9132d55d77b9d6b8c2cf23 Mon Sep 17 00:00:00 2001 From: slotThe Date: Sat, 17 Apr 2021 21:17:14 +0200 Subject: [PATCH] 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. --- XMonad/Util/EZConfig.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/XMonad/Util/EZConfig.hs b/XMonad/Util/EZConfig.hs index b5bc71e6..227f3489 100644 --- a/XMonad/Util/EZConfig.hs +++ b/XMonad/Util/EZConfig.hs @@ -109,7 +109,7 @@ additionalKeysP conf keyList = -- > `removeKeys` [(mod1Mask .|. shiftMask, n) | n <- [xK_1 .. xK_9]] removeKeys :: XConfig a -> [(KeyMask, KeySym)] -> XConfig a 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 @\"M-m\"@ instead of @(modMask, xK_m)@, as described in the @@ -130,8 +130,7 @@ additionalMouseBindings conf mouseBindingsList = -- | Like 'removeKeys', but for mouse bindings. removeMouseBindings :: XConfig a -> [(ButtonMask, Button)] -> XConfig a removeMouseBindings conf mouseBindingList = - conf { mouseBindings = \cnf -> mouseBindings conf cnf `M.difference` - M.fromList (zip mouseBindingList $ repeat ()) } + conf { mouseBindings = \cnf -> foldr M.delete (mouseBindings conf cnf) mouseBindingList } --------------------------------------------------------------