Im only just beginning haskell and xmonad. I was wondering how one would configure it so that if no windows were open, any key input would launch dmenu. So say if i had a blank screen and started to type "firefox", dmenu would launch with my "firefox" for example within it.
Hardly important but it would be nice if I could get some pointers in the right direction :)
It's an interesting idea! For the moment, let's assume that you want to map just the 'f' key. The approach that comes to my mind is to map the key to a function that checks if there are any windows open. If there are no windows open, it launches dmenu, pre-populating it with the character you just typed (i.e., the 'f'). If there are other windows open, it does whatever you normally want that key to do.
main = xmonad $ blah blah blah
`additionalKeys`
[
((0, xK_f), multiMapKey f someAction)
-- other mappings
]
multiMapKey :: Char -> X () -> X ()
multiMapKey c someAction =
if ?a window is open?
then launch dmenu with c already entered
else someAction
Notes:
additionalKeys
for each key you want to map. Maybe just mapping the 26 alphabetic keys will be sufficient.For learning more about the Xmonad innards, I recommend jekor's videos: part 1 part 2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With