Finally found some time to tinker with this today.
@vogt, I used your solution. Works perfectly! Thanks a lot!
And thanks to everyone else too for your suggestions
]]>import XMonad.Util.Dmenu
import System.Exit
import Control.Monad
quitWithWarning :: X ()
quitWithWarning = do
let m = "confirm quit"
s <- dmenu [m]
when (m == s) (io exitSuccess)
Then bind quitWithWarning to a key as you normally do. If you press enter and type nothing or the whole "confirm quit", it'll quit. Otherwise it does nothing, such as when you hit escape.
]]>To spawn a script with mod+shift+q you have to put something like this in your config:
, ((modMask .|. shiftMask, xK_q), spawn "/path/to/script")
Have a look at the wiki article on xmonad and the config archive that is linked there, maybe someone already did something similar.
]]>While using xmonad, sometimes, I accidentally press mod-shift-q instead of mod-shift-c. So instead of closing a window, I end up staring at a blinking cursor.
Is there any way to show a confirmation dialog when I press mod-shift-q? I'm not familiar with Haskell and I find the syntax of the configuration file a bit hard to follow. Here's what it looks like right now:
import XMonad
import XMonad.Layout.NoBorders
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.SetWMName
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.FadeInactive
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO
myManageHook = composeAll
[ className =? "Gimp" --> doFloat
]
main = do
xmproc <- spawnPipe "xmobar"
xmonad $ defaultConfig
{ modMask = mod4Mask
, startupHook = setWMName "LG3D"
, borderWidth = 2
, terminal = "urxvt"
, normalBorderColor = "#cccccc"
, focusedBorderColor = "#cd8b00"
, manageHook = manageDocks <+> myManageHook <+> manageHook defaultConfig
, layoutHook = smartBorders $ avoidStruts $ layoutHook defaultConfig
, logHook = fadeInactiveLogHook 0xdddddddd >> (dynamicLogWithPP $ xmobarPP
{ ppOutput = hPutStrLn xmproc
, ppTitle = xmobarColor "green" "" . shorten 50
})
} `additionalKeys`
[ ((mod4Mask .|. shiftMask, xK_z), spawn "xscreensaver-command -lock")
, ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s")
, ((0, xK_Print), spawn "scrot")
, ((0, 0x1008ff13), spawn "/usr/local/bin/volume.sh -i")
, ((0, 0x1008ff11), spawn "/usr/local/bin/volume.sh -d")
, ((0, 0x1008ff12), spawn "/usr/local/bin/volume.sh -m")
]
Thanks!
]]>