Using Xmonad with custom keys to launch a function? -
how do this? tried following method gives me error saying brackets mismatched etc. not sure if function entry correct
main = xmonad defaultconfig { terminal = "terminator" , modmask = mod4mask , borderwidth = 3 , layouthook = mylayout , keys = inskeys } inskeys :: xconfig l -> [((keymask, keysym), x ())] inskeys conf@(xconfig {modmask = modm}) = [ ((mod1mask, xk_f2 ), savecurrentworkspace) ] getlayout :: x (layout window) getlayout = gets $ w.layout . w.workspace . w.current . windowset mylayout = tiled ||| mirror tiled ||| full tiled = spacing 5 $ tall nmaster delta ratio nmaster = 1 ratio = 1/2 delta = 3/100 savecurrentworkspace :: x () savecurrentworkspace = layout x <- getlayout liftio $ writefile "currentlayout" (show x)
to map custom keys launch function following. add xmonad.hs
myadditionalkeys = [ ((mod1mask .|. xk_f12), savecurrentworkspace), ]
and add
`addtionialkeys myaddtionialkeys`
at end of "main" function, in following example.
main = xmonad $ defaultconfig { managehook = managespawn <+> mymanagehook <+> managedocks, layouthook = mylayout, loghook = dynamiclogwithpp xmobarpp { ppoutput = hputstrln xmproc, pplayout = (\ x -> ""), pptitle = xmobarcolor "#b2ed00" "" } >> updatepointer (relative 0.99 0.99), modmask = mod4mask, borderwidth = 4, normalbordercolor = "#777777", focusedbordercolor = "#ccff00", workspaces = myworkspaces, focusfollowsmouse = true, terminal = "x-terminal-emulator" } `removekeys` myremovekeys `additionalkeys` myadditionalkeys
Comments
Post a Comment