[xmonad] Issue 475 in xmonad: [xmonad-contrib] removeKeys function bug
codesite-noreply at google.com
codesite-noreply at google.com
Sat Sep 17 22:03:31 CEST 2011
Status: New
Owner: ----
New issue 475 by Crash... at gmail.com: [xmonad-contrib] removeKeys function
bug
http://code.google.com/p/xmonad/issues/detail?id=475
Initially reported under Arch Linux as a bug in the package maintained
there:
https://bugs.archlinux.org/task/25964
Description:
The removeKeys function in XMonad.Util.EZConfig only operates on the first
element in the list.
There is an existing fix for this bug on github that can be applied:
https://github.com/bogner/xmonadcontrib/commit/81dd78145cfaa0a8484d96649f0501996eb0e70b
An example with a workaround is provided below.
Additional info:
* package version(s)
local/xmonad-contrib 0.9.2-2.1
* config and/or log files etc.
.xmonad/xmonad.hs:
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig
import XMonad.Layout.WindowNavigation
import System.IO
main = do
xmproc <- spawnPipe "xmobar"
xmonad $ defaultConfig
{ manageHook = manageDocks <+> manageHook defaultConfig
, layoutHook = avoidStruts $ windowNavigation
$ layoutHook defaultConfig
, logHook = dynamicLogWithPP xmobarPP
{ ppOutput = hPutStrLn xmproc
, ppTitle = xmobarColor "green" "" . shorten 50
}
, modMask = mod4Mask
, borderWidth = 2
, terminal = "urxvt"
, normalBorderColor = "#333333"
, focusedBorderColor = "#FFAA00"
}
-- Remove bindings to keys so they can be reassigned
--
-- NOTE: There is a bug in removeKeys that makes it act like what
-- you would expect from a function called removeKey (i.e. it only
-- operates on the first element in a list). Therefore, it is
-- currently being called for each keymapping that needs to be
-- unbound. Once the bug fix has been pulled into the current
-- xmonad-contrib package the code commented below can replace the
-- repeated calls below:
--
--`removeKeys`
--[ (i, j) | i <- [mod4Mask, mod4Mask .|. shiftMask],
-- j <- [xK_h, xK_j, xK_k, xK_l]
--]
`removeKeys` [ (mod4Mask, xK_h) ]
`removeKeys` [ (mod4Mask, xK_j) ]
`removeKeys` [ (mod4Mask, xK_k) ]
`removeKeys` [ (mod4Mask, xK_l) ]
`removeKeys` [ (mod4Mask .|. shiftMask, xK_h) ]
`removeKeys` [ (mod4Mask .|. shiftMask, xK_j) ]
`removeKeys` [ (mod4Mask .|. shiftMask, xK_k) ]
`removeKeys` [ (mod4Mask .|. shiftMask, xK_l) ]
--`additionalKeys`
-- Add bindings for moving windows within a workspace
--[ ((mod4Mask .|. shiftMask, xK_h), sendMessage $ Swap L)
--, ((mod4Mask .|. shiftMask, xK_j), sendMessage $ Swap D)
--, ((mod4Mask .|. shiftMask, xK_k), sendMessage $ Swap U)
--, ((mod4Mask .|. shiftMask, xK_l), sendMessage $ Swap R)
--, ((mod4Mask, xK_h), sendMessage $ Go L)
--, ((mod4Mask, xK_j), sendMessage $ Go D)
--, ((mod4Mask, xK_k), sendMessage $ Go U)
--, ((mod4Mask, xK_l), sendMessage $ Go R)
--]
Steps to reproduce:
Start xmonad using the provided xmonad.hs (Make sure that the xmonad.hs
file has been compiled with xmonad --recompile). Open multiple windows
(e.g. a terminal and 2 firefox windows). Attempt to use any of the key
bindings that have been removed using removeKeys function. None should
work. Change the xmonad.hs file above to use the commented out removeKeys
code and comment out the existing removeKeys code:
`removeKeys`
[ (i, j) | i <- [mod4Mask, mod4Mask .|. shiftMask],
j <- [xK_h, xK_j, xK_k, xK_l]
]
--`removeKeys` [ (mod4Mask, xK_h) ]
--`removeKeys` [ (mod4Mask, xK_j) ]
--`removeKeys` [ (mod4Mask, xK_k) ]
--`removeKeys` [ (mod4Mask, xK_l) ]
--`removeKeys` [ (mod4Mask .|. shiftMask, xK_h) ]
--`removeKeys` [ (mod4Mask .|. shiftMask, xK_j) ]
--`removeKeys` [ (mod4Mask .|. shiftMask, xK_k) ]
--`removeKeys` [ (mod4Mask .|. shiftMask, xK_l) ]
Run xmonad --recompile
Hit your mod4 key + q to reload
Try to use the keybindings removed. Only mod4 + h will not work because it
is the first list element. (Note that mod-shift-h and mod-shift-l are not
by default bound to anything and these removeKey commands are extraneous).
More information about the xmonad
mailing list