myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
    [
      -- ((controlMask,          xK_q     ), spawn "noctrlq"),
      ((modm .|. controlMask, xK_1     ), spawn "screenlayout-only-internal"),
      ((modm .|. controlMask, xK_2     ), spawn "screenlayout-both"),
      ((modm .|. controlMask, xK_3     ), spawn "screenlayout-only-external"),
      ((modm .|. controlMask, xK_9     ), spawn "screenlayout-reset"),
      ((modm .|. controlMask, xK_c     ), spawn "xkill"),
      ((modm .|. controlMask, xK_p     ), spawn "pomodoro toggle 15"),
      ((modm .|. controlMask, xK_x     ), spawn "import -window $(xwininfo -int | awk '/Window id:/{print $4}') $(zenity --file-selection --save || echo png:-) | xclip -selection clipboard -t image/png -i"),
      ((modm .|. shiftMask,   xK_Return), spawn "zeal"),
      ((modm .|. shiftMask,   xK_Tab   ), windows W.focusUp),
      ((modm .|. shiftMask,   xK_c     ), kill),
      ((modm .|. shiftMask,   xK_g     ), spawn "amixer -D pulse sset Capture toggle,toggle"),
      ((modm .|. shiftMask,   xK_j     ), windows W.swapDown),
      ((modm .|. shiftMask,   xK_k     ), windows W.swapUp),
      ((modm .|. shiftMask,   xK_l     ), spawn "xautolock -locknow"),
      ((modm .|. shiftMask,   xK_m     ), spawn "gromit-mpx -q"),
      ((modm .|. shiftMask,   xK_x     ), spawn "import -window root $(zenity --file-selection --save || echo png:-) | xclip -selection clipboard -t image/png -i"),
      ((modm .|. shiftMask,   xK_p     ), spawn "pomodoro toggle 5"),
      ((modm .|. shiftMask,   xK_q     ), spawn "quitxmonad"),
      ((modm .|. shiftMask,   xK_v     ), killAllOtherCopies),
      ((modm,                 xK_Return), spawn $ XMonad.terminal conf),
      ((modm,                 xK_Tab   ), windows W.focusDown),
      ((modm,                 xK_a     ), sendMessage $ JumpToLayout "grid"),
      ((modm,                 xK_b     ), sendMessage ToggleStruts),
      ((modm,                 xK_comma ), sendMessage (IncMasterN 1)),
      ((modm,                 xK_d     ), sendMessage $ JumpToLayout "tabbed"),
      ((modm,                 xK_f     ), sendMessage $ JumpToLayout "fullscreen"),
      ((modm,                 xK_h     ), sendMessage Shrink),
      ((modm,                 xK_i     ), broadcastMessage Expand >> refresh),
      ((modm,                 xK_j     ), windows W.focusDown),
      ((modm,                 xK_k     ), windows W.focusUp  ),
      ((modm,                 xK_l     ), sendMessage Expand),
      ((modm,                 xK_m     ), spawn "(pgrep gromit-mpx || gromit-mpx --key XF86Tools --undo-key XF86WLAN -a) && gromit-mpx -t"),
      ((modm,                 xK_n     ), sendMessage Reset),
      ((modm,                 xK_o     ), namedScratchpadAction myScratchPads "terminal"),
      ((modm,                 xK_p     ), spawn "pomodoro toggle 25"),
      ((modm,                 xK_period), sendMessage (IncMasterN (-1))),
      ((modm,                 xK_q     ), spawn "xmonad --restart"),
      ((modm,                 xK_r     ), refresh),
      ((modm,                 xK_s     ), sendMessage $ JumpToLayout "tiled"),
      ((modm,                 xK_space ), withWindowSet $ \ws -> spawn ("spawnon " ++ (W.currentTag ws) ++ " dmenu_run -nb '#141414' -nf '#F8F8F2' -sb '#21889B' -fn 'Hack:size=10.8'")),
      ((modm,                 xK_t     ), withFocused $ windows . W.sink),
      ((modm,                 xK_u     ), broadcastMessage Shrink >> refresh),
      ((modm,                 xK_v     ), windows copyToAll),
      -- modm, xK_w does not work
      ((modm,                 xK_x     ), spawn "import $(zenity --file-selection --save || echo png:- ) | xclip -selection clipboard -t image/png -i"),
      ((modm,                 xK_z     ), windows W.swapMaster),
      ((noModMask,            xF86XK_AudioLowerVolume ), spawn "amixer -D pulse sset Master 5%-,5%-"),
      ((noModMask,            xF86XK_AudioMute        ), spawn "amixer -D pulse sset Master toggle,toggle"),
      ((noModMask,            xF86XK_AudioRaiseVolume ), spawn "amixer -D pulse sset Master 5%+,5%+"),
      ((noModMask,            xF86XK_MonBrightnessDown), spawn "brightnessctl s 5%-"),
      ((noModMask,            xF86XK_MonBrightnessUp  ), spawn "brightnessctl s 5%+")
    ]
    ++
    -- mod-[1..9], Switch to workspace N
    -- mod-shift-[1..9], Move client to workspace N
    [((m .|. modm, k), windows $ f i)
        | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
    ++
    -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
    -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
    [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
        | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
        , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
    [
      -- ((controlMask,          xK_q     ), spawn "noctrlq"),
      ((modm .|. controlMask, xK_1     ), spawn "screenlayout-only-internal"),
      ((modm .|. controlMask, xK_2     ), spawn "screenlayout-both"),
      ((modm .|. controlMask, xK_3     ), spawn "screenlayout-only-external"),
      ((modm .|. controlMask, xK_9     ), spawn "screenlayout-reset"),
      ((modm .|. controlMask, xK_c     ), spawn "xkill"),
      ((modm .|. controlMask, xK_p     ), spawn "pomodoro toggle 15"),
      ((modm .|. controlMask, xK_x     ), spawn "import -window $(xwininfo -int | awk '/Window id:/{print $4}') $(zenity --file-selection --save || echo png:-) | xclip -selection clipboard -t image/png -i"),
      ((modm .|. shiftMask,   xK_Return), spawn "zeal"),
      ((modm .|. shiftMask,   xK_Tab   ), windows W.focusUp),
      ((modm .|. shiftMask,   xK_c     ), kill),
      ((modm .|. shiftMask,   xK_g     ), spawn "amixer -D pulse sset Capture toggle,toggle"),
      ((modm .|. shiftMask,   xK_j     ), windows W.swapDown),
      ((modm .|. shiftMask,   xK_k     ), windows W.swapUp),
      ((modm .|. shiftMask,   xK_l     ), spawn "xautolock -locknow"),
      ((modm .|. shiftMask,   xK_m     ), spawn "gromit-mpx -q"),
      ((modm .|. shiftMask,   xK_x     ), spawn "import -window root $(zenity --file-selection --save || echo png:-) | xclip -selection clipboard -t image/png -i"),
      ((modm .|. shiftMask,   xK_p     ), spawn "pomodoro toggle 5"),
      ((modm .|. shiftMask,   xK_q     ), spawn "quitxmonad"),
      ((modm .|. shiftMask,   xK_v     ), killAllOtherCopies),
      ((modm,                 xK_Return), spawn $ XMonad.terminal conf),
      ((modm,                 xK_Tab   ), windows W.focusDown),
      ((modm,                 xK_a     ), sendMessage $ JumpToLayout "grid"),
      ((modm,                 xK_b     ), sendMessage ToggleStruts),
      ((modm,                 xK_comma ), sendMessage (IncMasterN 1)),
      ((modm,                 xK_d     ), sendMessage $ JumpToLayout "tabbed"),
      ((modm,                 xK_f     ), sendMessage $ JumpToLayout "fullscreen"),
      ((modm,                 xK_h     ), sendMessage Shrink),
      ((modm,                 xK_i     ), broadcastMessage Expand >> refresh),
      ((modm,                 xK_j     ), windows W.focusDown),
      ((modm,                 xK_k     ), windows W.focusUp  ),
      ((modm,                 xK_l     ), sendMessage Expand),
      ((modm,                 xK_m     ), spawn "(pgrep gromit-mpx || gromit-mpx --key XF86Tools --undo-key XF86WLAN -a) && gromit-mpx -t"),
      ((modm,                 xK_n     ), sendMessage Reset),
      ((modm,                 xK_o     ), namedScratchpadAction myScratchPads "terminal"),
      ((modm,                 xK_p     ), spawn "pomodoro toggle 25"),
      ((modm,                 xK_period), sendMessage (IncMasterN (-1))),
      ((modm,                 xK_q     ), spawn "xmonad --restart"),
      ((modm,                 xK_r     ), refresh),
      ((modm,                 xK_s     ), sendMessage $ JumpToLayout "tiled"),
      ((modm,                 xK_space ), withWindowSet $ \ws -> spawn ("spawnon " ++ (W.currentTag ws) ++ " dmenu_run -nb '#141414' -nf '#F8F8F2' -sb '#21889B' -fn 'Hack:size=10.8'")),
      ((modm,                 xK_t     ), withFocused $ windows . W.sink),
      ((modm,                 xK_u     ), broadcastMessage Shrink >> refresh),
      ((modm,                 xK_v     ), windows copyToAll),
      -- modm, xK_w does not work
      ((modm,                 xK_x     ), spawn "import $(zenity --file-selection --save || echo png:- ) | xclip -selection clipboard -t image/png -i"),
      ((modm,                 xK_z     ), windows W.swapMaster),
      ((noModMask,            xF86XK_AudioLowerVolume ), spawn "amixer -D pulse sset Master 5%-,5%-"),
      ((noModMask,            xF86XK_AudioMute        ), spawn "amixer -D pulse sset Master toggle,toggle"),
      ((noModMask,            xF86XK_AudioRaiseVolume ), spawn "amixer -D pulse sset Master 5%+,5%+"),
      ((noModMask,            xF86XK_MonBrightnessDown), spawn "brightnessctl s 5%-"),
      ((noModMask,            xF86XK_MonBrightnessUp  ), spawn "brightnessctl s 5%+")
    ]
    ++
    -- mod-[1..9], Switch to workspace N
    -- mod-shift-[1..9], Move client to workspace N
    [((m .|. modm, k), windows $ f i)
        | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
    ++
    -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
    -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
    [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
        | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
        , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
    [
      -- ((controlMask,          xK_q     ), spawn "noctrlq"),
      ((modm .|. controlMask, xK_1     ), spawn "screenlayout-only-internal"),
      ((modm .|. controlMask, xK_2     ), spawn "screenlayout-both"),
      ((modm .|. controlMask, xK_3     ), spawn "screenlayout-only-external"),
      ((modm .|. controlMask, xK_9     ), spawn "screenlayout-reset"),
      ((modm .|. controlMask, xK_c     ), spawn "xkill"),
      ((modm .|. controlMask, xK_p     ), spawn "pomodoro toggle 15"),
      ((modm .|. controlMask, xK_x     ), spawn "import -window $(xwininfo -int | awk '/Window id:/{print $4}') $(zenity --file-selection --save || echo png:-) | xclip -selection clipboard -t image/png -i"),
      ((modm .|. shiftMask,   xK_Return), spawn "zeal"),
      ((modm .|. shiftMask,   xK_Tab   ), windows W.focusUp),
      ((modm .|. shiftMask,   xK_c     ), kill),
      ((modm .|. shiftMask,   xK_g     ), spawn "amixer -D pulse sset Capture toggle,toggle"),
      ((modm .|. shiftMask,   xK_j     ), windows W.swapDown),
      ((modm .|. shiftMask,   xK_k     ), windows W.swapUp),
      ((modm .|. shiftMask,   xK_l     ), spawn "xautolock -locknow"),
      ((modm .|. shiftMask,   xK_m     ), spawn "gromit-mpx -q"),
      ((modm .|. shiftMask,   xK_x     ), spawn "import -window root $(zenity --file-selection --save || echo png:-) | xclip -selection clipboard -t image/png -i"),
      ((modm .|. shiftMask,   xK_p     ), spawn "pomodoro toggle 5"),
      ((modm .|. shiftMask,   xK_q     ), spawn "quitxmonad"),
      ((modm .|. shiftMask,   xK_v     ), killAllOtherCopies),
      ((modm,                 xK_Return), spawn $ XMonad.terminal conf),
      ((modm,                 xK_Tab   ), windows W.focusDown),
      ((modm,                 xK_a     ), sendMessage $ JumpToLayout "grid"),
      ((modm,                 xK_b     ), sendMessage ToggleStruts),
      ((modm,                 xK_comma ), sendMessage (IncMasterN 1)),
      ((modm,                 xK_d     ), sendMessage $ JumpToLayout "tabbed"),
      ((modm,                 xK_f     ), sendMessage $ JumpToLayout "fullscreen"),
      ((modm,                 xK_h     ), sendMessage Shrink),
      ((modm,                 xK_i     ), broadcastMessage Expand >> refresh),
      ((modm,                 xK_j     ), windows W.focusDown),
      ((modm,                 xK_k     ), windows W.focusUp  ),
      ((modm,                 xK_l     ), sendMessage Expand),
      ((modm,                 xK_m     ), spawn "(pgrep gromit-mpx || gromit-mpx --key XF86Tools --undo-key XF86WLAN -a) && gromit-mpx -t"),
      ((modm,                 xK_n     ), sendMessage Reset),
      ((modm,                 xK_o     ), namedScratchpadAction myScratchPads "terminal"),
      ((modm,                 xK_p     ), spawn "pomodoro toggle 25"),
      ((modm,                 xK_period), sendMessage (IncMasterN (-1))),
      ((modm,                 xK_q     ), spawn "xmonad --restart"),
      ((modm,                 xK_r     ), refresh),
      ((modm,                 xK_s     ), sendMessage $ JumpToLayout "tiled"),
      ((modm,                 xK_space ), withWindowSet $ \ws -> spawn ("spawnon " ++ (W.currentTag ws) ++ " dmenu_run -nb '#141414' -nf '#F8F8F2' -sb '#21889B' -fn 'Hack:size=10.8'")),
      ((modm,                 xK_t     ), withFocused $ windows . W.sink),
      ((modm,                 xK_u     ), broadcastMessage Shrink >> refresh),
      ((modm,                 xK_v     ), windows copyToAll),
      -- modm, xK_w does not work
      ((modm,                 xK_x     ), spawn "import $(zenity --file-selection --save || echo png:- ) | xclip -selection clipboard -t image/png -i"),
      ((modm,                 xK_z     ), windows W.swapMaster),
      ((noModMask,            xF86XK_AudioLowerVolume ), spawn "amixer -D pulse sset Master 5%-,5%-"),
      ((noModMask,            xF86XK_AudioMute        ), spawn "amixer -D pulse sset Master toggle,toggle"),
      ((noModMask,            xF86XK_AudioRaiseVolume ), spawn "amixer -D pulse sset Master 5%+,5%+"),
      ((noModMask,            xF86XK_MonBrightnessDown), spawn "brightnessctl s 5%-"),
      ((noModMask,            xF86XK_MonBrightnessUp  ), spawn "brightnessctl s 5%+")
    ]
    ++
    -- mod-[1..9], Switch to workspace N
    -- mod-shift-[1..9], Move client to workspace N
    [((m .|. modm, k), windows $ f i)
        | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
    ++
    -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
    -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
    [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
        | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
        , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]