You are not logged in.
I'm trying to set a keybinding for taking screenshots in Xmonad. I want scrot bound to Print Screen, but without any mods, just that one button. How can this accomplished? Is there an empty KeyMask value?
EDIT: Seeing as this thread comes as a first result in my web searches, I'll put some of the possible solutions in this post.
myScreenshooter = "scrot -e 'mv $f ~/screenshots/'"
myControledScreenshooter = "sleep 0.2; " ++ myScreenshooter ++ " -s"Using noModMask:
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
...
-- Additional keybindings
++
[ ((noModMask, xK_Print), spawn myScreenshooter)
, ((controlMask, xK_Print), spawn myControledScreenshooter)
]Using additionalKeysP:
...
import XMonad.Util.EZConfig
...
main = xmonad myDefaults
defaults = defaultConfig {
-- simple stuff
terminal = myTerminal,
focusFollowsMouse = myFocusFollowsMouse,
clickJustFocuses = myClickJustFocuses,
borderWidth = myBorderWidth,
modMask = myModMask,
workspaces = myWorkspaces,
normalBorderColor = myNormalBorderColor,
focusedBorderColor = myFocusedBorderColor,
-- key bindings
keys = myKeys,
mouseBindings = myMouseBindings,
-- hooks, layouts
layoutHook = myLayout,
manageHook = myManageHook,
handleEventHook = myEventHook,
logHook = myLogHook,
startupHook = myStartupHook
}
myDefaults = defaults
`additionalKeysP`
[ ("<Print>", spawn myScreenshooter)
("C-<Print>", spawn myControledScreenshooter)
]Further information:
Real World Haskell: Chapter 4. Functional Programming: Infix Functions
XMonad.Util.EZConfig
Last edited by hauzer (2013-03-01 20:01:25)
Vanity of vanities, saith the Preacher, vanity of vanities; all is vanity.
What profit hath a man of all his labour which he taketh under the sun?
All the rivers run into the sea; yet the sea is not full; unto the place from whence the rivers come, thither they return again.
For in much wisdom is much grief: and he that increaseth knowledge increaseth sorrow.
Offline
I've solved the problem:
...
import XMonad.Util.EZConfig
...
main = xmonad myDefaults
defaults = defaultConfig {
-- simple stuff
terminal = myTerminal,
focusFollowsMouse = myFocusFollowsMouse,
clickJustFocuses = myClickJustFocuses,
borderWidth = myBorderWidth,
modMask = myModMask,
workspaces = myWorkspaces,
normalBorderColor = myNormalBorderColor,
focusedBorderColor = myFocusedBorderColor,
-- key bindings
keys = myKeys,
mouseBindings = myMouseBindings,
-- hooks, layouts
layoutHook = myLayout,
manageHook = myManageHook,
handleEventHook = myEventHook,
logHook = myLogHook,
startupHook = myStartupHook
}
myDefaults = defaults
`additionalKeysP`
[ ("<Print>", spawn "scrot")
]Further information:
Real World Haskell: Chapter 4. Functional Programming: Infix Functions
XMonad.Util.EZConfig
Vanity of vanities, saith the Preacher, vanity of vanities; all is vanity.
What profit hath a man of all his labour which he taketh under the sun?
All the rivers run into the sea; yet the sea is not full; unto the place from whence the rivers come, thither they return again.
For in much wisdom is much grief: and he that increaseth knowledge increaseth sorrow.
Offline
For those not using additionalKeysP, just pass in 0 as the modifier ((0, xk_Whwatever), dosomething)
Last edited by Mr.Elendig (2013-03-01 14:40:05)
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
That's what I was looking for. It isn't documented anywhere, as far as I know.
Vanity of vanities, saith the Preacher, vanity of vanities; all is vanity.
What profit hath a man of all his labour which he taketh under the sun?
All the rivers run into the sea; yet the sea is not full; unto the place from whence the rivers come, thither they return again.
For in much wisdom is much grief: and he that increaseth knowledge increaseth sorrow.
Offline
That's what I was looking for. It isn't documented anywhere, as far as I know.
It sure is documented, just not that visible. You will find the noModMask keymask here: http://hackage.haskell.org/packages/arc … s.html#g:6. In the source code, you see that noModMask is 0.
Offline
Wow.. I looked there and somehow missed it. I'm glad I was the one wrong, and not the documentation.
Vanity of vanities, saith the Preacher, vanity of vanities; all is vanity.
What profit hath a man of all his labour which he taketh under the sun?
All the rivers run into the sea; yet the sea is not full; unto the place from whence the rivers come, thither they return again.
For in much wisdom is much grief: and he that increaseth knowledge increaseth sorrow.
Offline