0

Hey there im having some troubles adding scratchpads to my xmonad config.

When im trying to compile the xmonad.hs file i get this:

Error detected while loading xmonad configuration

xmonad.hs:172:34 Not in scope ´m'

Please check file for errors.

My knowledge in haskell is very limited, and im aware that this might be a basic error but im afraid im not able to solve it.

This is the xmonad.hs config:

--
-- Imports needed for config
--
import System.IO
import System.Exit
import XMonad
import XMonad.Actions.FindEmptyWorkspace
import XMonad.Actions.TagWindows
import XMonad.Actions.OnScreen (greedyViewOnScreen, viewOnScreen)
import XMonad.Actions.Warp
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.SetWMName
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ICCCMFocus
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat)
import XMonad.Layout.Fullscreen
import XMonad.Layout.NoBorders
import XMonad.Layout.Spiral
import XMonad.Layout.Tabbed
import XMonad.Layout.ThreeColumns
import XMonad.Layout.Combo
import XMonad.Layout.Grid
import XMonad.Layout.LayoutModifier
import XMonad.Layout.Named
import XMonad.Layout.PerWorkspace
import XMonad.Layout.Reflect
import XMonad.Layout.TwoPane
import XMonad.Layout.WindowNavigation
import XMonad.Layout.IndependentScreens
import XMonad.Util.WindowProperties
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import XMonad.Util.Run
import XMonad.Util.Dmenu
import XMonad.Util.Scratchpad
import XMonad.Prompt
import qualified XMonad.StackSet as W
import qualified Data.Map        as M
import qualified XMonad.StackSet as S
import XMonad.Config.Gnome
import Control.Monad
import Data.Ratio
import Data.Maybe (fromMaybe)

----------------------
-- Define variables --
----------------------
myTerminal = "gnome-terminal"
myBrowser = "x-www-browser"
runMenu = spawn "dmenu_run"


-----------------------
-- Define Workspaces --
-----------------------
myWorkspaces = ["1:term","2:web","3:code","4:subl","5:media","6:vm"] ++ map show [7..9]

--
-- Define windows
-- Use 'xprop | grep WM_CLASS' to find the WM_NAME you want to move.
--

myManageHook = composeAll
    [ className =? "x-www-browser"  --> doShift "2:web"
    , className =? "Google-chrome"  --> doShift "2:web"
    , className =? "Sublime_text"   --> doShift "4:subl"
    , className =? "Eclipse"        --> doShift "3:code"
    , className =? "Java"       --> doShift "3:code"
    , className =? "spotify.exe"    --> doShift "5:media"
    , className =? "Wine"           --> doShift "5:media"
    , className =? "VirtualBox"     --> doShift "6:vm"
    , resource  =? "desktop_window" --> doIgnore
    , resource  =? "gpicview"       --> doFloat
    , className =? "MPlayer"        --> doFloat
    , className =? "stalonetray"    --> doIgnore
    , isFullscreen --> (doF W.focusDown <+> doFullFloat)] <+> manageScratchPad

manageScratchPad :: ManageHook
manageScratchPad = scratchpadManageHook (W.RationalRect l t w h)

  where

    h = 0.1     -- terminal height, 10%
    w = 1       -- terminal width, 100%
    t = 1 - h   -- distance from top edge, 90%
    l = 1 - w   -- distance from left edge, 0%


------------------------
-- Layout definitions --
------------------------

-- The layouts which xmonad switches between
myLayout = avoidStruts (
    Tall 1 (3/100) (1/2) |||
    Mirror (Tall 1 (3/100) (1/2)) |||
    tabbed shrinkText tabConfig |||
    Full |||
    spiral (6/7)) |||
    noBorders (fullscreenFull Full)


---------------------------------
-- Color and design properties --
---------------------------------


-- Define the colors and borders of windows in xmonad

myNormalBorderColor  = "#7c7c7c"
myFocusedBorderColor = "#ffb6b0"

-- Colors for text and backgrounds of each tab when in "Tabbed" layout.

tabConfig = defaultTheme {
    activeBorderColor = "#7C7C7C",
    activeTextColor = "green",
    activeColor = "#000000",
    inactiveBorderColor = "#7C7C7C",
    inactiveTextColor = "#EEEEEE",
    inactiveColor = "#000000"
}

-- Color of current window title in xmobar.
xmobarTitleColor = "#FFB6B0"

-- Color of current workspace in xmobar.
xmobarCurrentWorkspaceColor = "green"

-- Width of the window border in pixels.
myBorderWidth = 1



------------------
-- Key bindings --
------------------

-- Setting windows button as primary action (mod)
myModMask = mod4Mask
-- Alt as secondary action.
altMask   = mod1Mask

-- Key binds
myKeys conf = M.fromList $
    [ ((myModMask              , xK_Return    ), spawn myTerminal)
    , ((myModMask              , xK_x         ), spawn myBrowser)
    , ((myModMask              , xK_r         ), runMenu)
    , ((myModMask              , xK_c         ), kill)
    -- Empty Workspace Movement
    , ((altMask                , xK_space     ), viewEmptyWorkspace)
    , ((altMask .|. shiftMask  , xK_space     ), tagToEmptyWorkspace)
    -- Layout Commands
    , ((myModMask              , xK_space     ), sendMessage NextLayout)
    , ((altMask .|. shiftMask  , xK_Return    ), sendMessage FirstLayout)
    , ((myModMask              , xK_n         ), refresh)
    , ((myModMask              , xK_m         ), windows S.swapMaster)
    -- controlling window movement, position and location

    , ((myModMask              , m            ), scratchpadSpawnActionTerminal myTerminal) // ERROR ON THIS LINE
    , ((altMask                , xK_Tab       ), windows S.focusDown)
    , ((altMask .|. shiftMask  , xK_Tab       ), windows S.focusUp)
    , ((myModMask              , xK_Tab       ), windows S.focusDown)
    , ((myModMask .|. shiftMask, xK_Tab       ), windows S.focusUp)
    , ((myModMask              , xK_Down      ), windows S.swapDown)
    , ((myModMask              , xK_Up        ), windows S.swapUp)
    , ((myModMask              , xK_Left      ), sendMessage Shrink)
    , ((myModMask              , xK_Right     ), sendMessage Expand)
    , ((myModMask              , xK_t         ), withFocused $ windows . S.sink)
    , ((myModMask              , xK_w         ), sendMessage (IncMasterN 1))
    , ((myModMask              , xK_v         ), sendMessage (IncMasterN (-1)))
    -- Shutdown commands
    , ((myModMask              , xK_q         ), restart "xmonad" True)
    , ((myModMask              , xK_h         ), spawn "gksudo pm-hibernate")
    , ((myModMask .|. shiftMask, xK_q         ), io (exitWith ExitSuccess))
    , ((myModMask .|. shiftMask, xK_w         ), spawn "gnome-screensaver-command -l")
    -- Print Screen
    , ((myModMask              , xK_Print     ), spawn "gnome-screenshot")
    , ((altMask                , xK_Print     ), spawn "gnome-screenshot -a")
    -- MPC and Volume commands
    , ((myModMask               , xK_Page_Up  ), spawn "mpc next")
    , ((myModMask               , xK_Page_Down), spawn "mpc prev")
    , ((myModMask               , xK_Pause    ), spawn "mpc toggle")
    , ((myModMask               , xK_F12      ), spawn "amixer -q set Master 5%+")
    , ((myModMask               , xK_F11      ), spawn "amixer -q set Master 5%-")
    , ((myModMask               , xK_F10      ), spawn "amixer -D pulse set Master 1+ toggle")
    , ((0                       , 0x1008ff12  ), spawn "amixer -D pulse set Master 1+ toggle")
    , ((0                       , 0x1008ff11  ), spawn "amixer -q set Master 5%-")
    , ((0                       , 0x1008ff13  ), spawn "amixer -q set Master 5%+")

    ] ++

  -- mod-[1..9], Switch to workspace N
  -- mod-shift-[1..9], Move client to workspace N
  [((m .|. myModMask, k), windows $ f i)
      | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
      , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]] 

--------------------
-- Mouse bindings --
--------------------

-- Focus rules
myFocusFollowsMouse :: Bool
myFocusFollowsMouse = True


-- Movements of windows, user mod + t to reset tile.
myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
  [
    -- mod-button1, Set the window to floating mode and move by dragging
    ((modMask, button1),
     (\w -> focus w >> mouseMoveWindow w))

    -- mod-button2, Raise the window to the top of the stack
    , ((modMask, button2),
       (\w -> focus w >> windows W.swapMaster))

    -- mod-button3, Set the window to floating mode and resize by dragging
    , ((modMask, button3),
       (\w -> focus w >> mouseResizeWindow w))
  ]

------------------
-- Startup hook --
------------------
myStartupHook = return ()


----------------
-- Run xmonad --
----------------
main = do
  xmproc <- spawnPipe "xmobar ~/.xmonad/xmobar.hs"
  xmonad $ defaults {
      logHook = dynamicLogWithPP $ xmobarPP {
            ppOutput = hPutStrLn xmproc
          , ppTitle = xmobarColor xmobarTitleColor "" . shorten 100
          , ppCurrent = xmobarColor xmobarCurrentWorkspaceColor ""
          , ppSep = " | "
      }
      , manageHook = manageDocks <+> myManageHook
      , startupHook = setWMName "LG3D"
  }


------------------
-- Merge it all --
------------------
defaults = defaultConfig {
    -- simple stuff
    terminal           = myTerminal,
    focusFollowsMouse  = myFocusFollowsMouse,
    borderWidth        = myBorderWidth,
    modMask            = myModMask,
    workspaces         = myWorkspaces,
    normalBorderColor  = myNormalBorderColor,
    focusedBorderColor = myFocusedBorderColor,

    -- key bindings
    keys               = myKeys,
    mouseBindings      = myMouseBindings,

    -- hooks, layouts
    layoutHook         = smartBorders $ myLayout,
    manageHook         = myManageHook,
    startupHook        = myStartupHook
  }

Any hind on what the error is? This line is marked in the file.

0

Rookie mistake m should be xK_m

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.