You are not logged in.
I am just starting to try and learn xmonad. It seems to be the only tiling window manager that has simplicity (i.e. not awesomewm) and some complexity to it (not dwm). The only problem I am running into is the fact that my xmonad.hs (mostly copied from other working configs) either gives me errors, or doesn't do anything. I can't even start a terminal with Mod+shift+enter.
Can someone take a look at my config and see what is going wrong?
-------------------- imports --------------------
--necessary
import XMonad
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import System.Exit
import Graphics.X11.Xlib
import IO (Handle, hPutStrLn)
--utilities
import XMonad.Util.Run (spawnPipe)
import XMonad.Actions.NoBorders
--hooks
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.XPropManage
--MO' HOOKS
import Graphics.X11.Xlib.Extras
import Foreign.C.Types (CLong)
--layouts
--import XMonad.Layout.NoBorders
--import XMonad.Layout.ResizableTile
--import XMonad.Layout.Gaps
--import XMonad.Layout.Named
--import XMonad.Layout.PerWorkspace
--import XMonad.Layout.Spacing
import Data.Ratio((%))
main = xmonad $ defaultConfig
-- h <- spawnPipe "xmobar ~/.xmobarrc"
{ workspaces = ["term", "www", "chat", "code", "else"]
, borderWidth = 3
, terminal = "urxvt"
, normalBorderColor = "#333333"
, focusedBorderColor = "#1793d1"
, modMask = mod4Mask
, keys = keys'
-- Make space for a systray app.
--, layoutHook = avoidStruts $ Tall ||| Wide ||| Full
--, manageHook = manageHook defaultConfig <+> manageDocks
}
where
tiled = Tall nmaster ratio
-- Default number of windows in the master pane
nmaster = 1
-- Default proportion of screen occupied by master pane
ratio = 2/(1+(toRational(sqrt(5)::Double))) -- golden
-- Percent of screen to increment by when resizing panes
delta = 5%100
-------------------- managehooks --------------------
myManageHook = composeAll . concat $
[ [className =? c --> doFloat | c <- myFloats]
, [title =? t --> doFloat | t <- myOtherFloats]
, [className =? r --> doIgnore | r <- myIgnores]
--, [className =? mp --> doF (W.shift "mp") | mp <- mediaPlayers]
--, [className =? im --> doF (W.shift "irc") | im <- imMessenger]
--, [className =? bw --> doF (W.shift "www") | bw <- browsers]
--, [className =? e --> doF (W.shift "else") | e <- elseApps]
]
where
myFloats = ["Gimp", "vlc", "Nitrogen", "Thunar", "Leafpad", "gmrun"]
myOtherFloats = ["Downloads", "Firefox Preferences", "Save As...", "Send file", "Open", "File Transfers"]
myIgnores = ["trayer", "stalonetray"]
mediaPlayers = ["Quodlibet"]
imMessenger = ["Pidgin"]
browsers = ["Shiretoko", "Firefox"]
elseApps = ["Mirage", "Gimp"]
----------------------- Key Bindings ------------------------------
keys' :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
keys' conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
[
-- ((modMask x, xK_b), sendMessage ToggleStruts)
-- Application hotkeys
((modMask, xK_f ), spawn "firefox")
, ((modMask .|. shiftMask, xK_m ), spawn "urxvt -e ncmpcpp")
]
None of my keybindings work. I was attempting to use the
main = do
xmonad $ defaultConfig
{ ... }
But that always complains about a parsing error with "{".
Any advice?
Offline
Have you installed XMonad-contrib package?
When It gives you error's at compiling on the fly by:
sudo xmonad --recompile
command.
Or at fly?
Shell Scripter | C/C++/Python/Java Coder | ZSH
Offline
Both. I have never run xmonad --recompile as root. Does that effect it?
I have installed xmonad-contrib
Offline
Can you post this error's message's?
I just giva an example how to recompile XMonad
Shell Scripter | C/C++/Python/Java Coder | ZSH
Offline
yes you will need xmonad-contrib to use some of the things in that first config.
i suggest you try something simple and go from there:
import XMonad
main = do
xmonad $ defaultConfig
{ terminal = "urxvt"
, modMask = mod4Mask
}
since your config might be borked, M-q might not work, so you should just restart X.
the keybind part always messes with my head because there's a few versions of keys' and myKeys out there and im unsure which /overwrites/ the default (meaning you need to specify all the key commands you want to use) and which version /adds to/ the default (meaning you just specify your changes in the list, as you did) my xmonad.hs can be viewed here and the method i use is such that i only have to specify my changed keybindings, feel free to use it.
*edit* fixed typo in codeblock (start of line whitespace matters in haskell)
Last edited by brisbin33 (2009-08-27 15:15:22)
//github/
Offline
I believe I have the completly overwriting definition. So if I switch it to myKeys, I should only have to define the bindings I want to change?
I tried the very simiple conf. I get
xmonad.hs:5:2: parse error on input `{'
I also tried your keybinding method. It gave me some errors for one line so I skipped it for now.
Last edited by semperfiguy (2009-08-27 15:03:30)
Offline
oh sorry about that, should've been:
import XMonad
main = do
xmonad $ defaultConfig
{ terminal = "urxvt"
, modMask = mod4Mask
}
*slight edit to make my earlier typo seem more justifiable*
Last edited by brisbin33 (2009-08-27 15:10:25)
//github/
Offline
Ok that works.
I threw in some definitions for border colors and width.. I tried to assign workspace names using a myWorkspaces variable, but gave me an error on the = so I just defined it right from main.
Last edited by semperfiguy (2009-08-27 15:14:53)
Offline
Still trying to get to where I can start meshing in other configs without getting errors. Most of the time they come from xmonad not being able to include certain modules.
I added in:
where
nmaster = 1
delta = 5 % 100
ratio = toRational (2/(1 + sqrt 5 :: Double)) -- golden ratio
To try and set the golden ration, for tiled. but that does nothing. still 50/50 with two windows.
Last edited by semperfiguy (2009-08-27 18:45:03)
Offline
semperfiguy: Perhaps your problem is caused by using configs which depend on xmonad-darcs and xmonad-contrib-darcs. Get them from the Aur - don't worry they're very stable.
A helpful thing you could do for us would be to post your current xmonad.hs and which modules XMonad has problems importing.
And a last thing; haskell is very sensitive to indentation, so this might be helpful: http://en.wikibooks.org/wiki/Haskell/Indentation
Offline
Still trying to get to where I can start meshing in other configs without getting errors. Most of the time they come from xmonad not being able to include certain modules.
I added in:
where nmaster = 1 delta = 5 % 100 ratio = toRational (2/(1 + sqrt 5 :: Double)) -- golden ratio
To try and set the golden ration, for tiled. but that does nothing. still 50/50 with two windows.
you've defined those variables but they need to be used somewhere. something like this:
main = do
xmonad $ defaultConfig
{ terminal = myTerminal
, layoutHook = myLayout
}
myTerminal = "urxvt"
myLayout = Tall nmaster delta ratio ||| Wide nmaster delta ratio ||| Full
where
nmaster = 1
delta = 5 % 100
ratio = toRational (2/(1 + sqrt 5 :: Double)) -- golden ratio
note: you need Data.Ratio to use toRational and 5 % 100.
hopefully the above shows you how you start to build a config. go through xmonad.org's documentation, they spell it out quite nicely if you understand the above concept: use "something = mySomething" in main, then define mySomething as specified in the documentation.
good luck!
Last edited by brisbin33 (2009-08-27 19:11:56)
//github/
Offline
I think I'm getting the hang of it now. Thank you very much. I have a basic dzen2 bar running now and I'm starting to get the hang of the config syntax.
I think my two problems were:
1. That indentation thing -- having the first line of xmonad $ defaultConfig inline with the bracket and first definition
2. Having xmonad-contrib -- I think this was where most of my module troubles were coming from.
Thank you very much.
Offline
I am having alot of difficulty with keybindings though. If I define my keybinds, it erases all others. It seems like I have to explicitly define every single key combo I need.
Here is xmonad.hs:
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.FadeInactive
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.XPropManage
import XMonad.Layout
--import XMonad.Layout.LayoutHints
--import XMonad.Layout.Reflect
--import XMonad.Layout.PerWorkspace
--import XMonad.Layout.NoBorders
--import XMonad.Layout.Tabbed
--import XMonad.Layout.DecorationMadness
--import XMonad.Layout.ThreeColumns
--import XMonad.Layout.TwoPane
import XMonad.Layout.Grid
import XMonad.Layout.Magnifier
import XMonad.Layout.MagicFocus
--import XMonad.Layout.IM
import XMonad.Layout.Circle
--import XMonad.Actions.WindowGo
import XMonad.Actions.UpdatePointer
--import XMonad.Util.Run
--import XMonad.Util.Loggers
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import qualified Data.Map as M
import qualified XMonad.StackSet as W
import Data.Ratio
import System.IO
import System.Exit
import Graphics.X11.Xlib
import Graphics.X11.Xlib.Extras
import Foreign.C.Types (CLong)
main = do
dzpipe <- spawnPipe statusBarCmd
xmonad $ defaultConfig { workspaces = myWorkspaces
, borderWidth = myBorderWidth
, normalBorderColor = myNormalBorderColor
, focusedBorderColor = myFocusedBorderColor
, terminal = myTerminal
, modMask = myModMask
--, keys = myKeys
, layoutHook = myLayout
, manageHook = manageHook'
, logHook = dynamicLogWithPP $ mPP dzpipe
}
------------------Status bar stuff -------------------------
-------- Theming Stuff --------------
-- Color names are easier to remember:
orange = "#ff7701"
colorDarkGray = "#171717"
colorGray = "#777777"
purple = "#e3008d"
colorGreen = "#17d193"
colorBlue = "#1793d1"
colorRed = "#d19090"
yellow = "#fee100"
colorWhite = "#ffffff"
colorBlack = "#000000"
barFont = "terminus"
barXFont = "Bauhaus Md BT:size=14"
xftFont = "xft: Bauhaus Md BT-14"
--}}}
statusBarCmd = "dzen2 -fn 'nu' -bg '#000000' -fg '#f0f0f0' -h 16 -w 280 -ta l"
-------- Pretty printer ----------
mPP dzenSbar = defaultPP
{ ppCurrent = dzenColor colorWhite colorBlue . pad
, ppUrgent = dzenColor colorWhite colorRed . pad
, ppVisible = dzenColor colorGreen colorWhite . pad
, ppHidden = dzenColor colorWhite colorBlack . pad
, ppHiddenNoWindows = dzenColor colorGray colorBlack . pad
, ppTitle = const ""
, ppSep = ""
, ppWsSep = ""
, ppLayout = dzenColor "#ffffff" "#000000" .
(\x -> case x of
"Tall" -> "^i(" ++ myBitmapsDir ++ "/tall.xbm)"
"Mirror Tall" -> "^i(" ++ myBitmapsDir ++ "/mtall.xbm)"
"Circle" -> "^i(" ++ myBitmapsDir ++ "/circle.xbm)"
"magnify Grid" -> "^i(" ++ myBitmapsDir ++ "/magnifier grid.xbm)"
"Full" -> "^i(" ++ myBitmapsDir ++ "/full.xbm)"
_ -> x
)
, ppOutput = hPutStrLn dzenSbar
}
where
------------------------- Define some Variables -----------------------------
myWorkspaces = ["alpha", "beta" ,"gamma", "delta", "epsilon", "zeta", "eta"]
myBorderWidth = 2
myNormalBorderColor = "#222222"
myFocusedBorderColor = "#1793d1"
myTerminal = "urxvt"
myModMask = mod4Mask
myBitmapsDir = "/home/semperfiguy/.xmonad/xbms"
------------------------------ Manage Hook ---------------------------
myManageHook :: ManageHook
myManageHook = composeAll . concat $
[ [ className =? c --> doFloat | c <- myFloats ]
, [ title =? t --> doFloat | t <- myOtherFloats ]
, [ resource =? r --> doIgnore | r <- myIgnores ]
, [ className =? "Firefox" --> doF (W.shift "beta") ]
, [ className =? "Shiretoko" --> doF (W.shift "beta") ]
, [ className =? "Xiphos" --> doF (W.shift "gamma") ]
, [ className =? "Thunar" --> doF (W.shift "epsilon") <+> doF (W.swapUp) ]
, [ className =? "ncmpcpp" --> doF (W.shift "epsilon") <+> doF (W.swapUp) ]
, [ className =? "Sonata" --> doF (W.shift "epsilon") <+> doF (W.swapUp) ]
, [ className =? "Gimp" --> doF (W.shift "zeta") <+> doF (W.swapUp) ]
, [ className =? "OpenOffice.org 3.0" --> doF (W.shift "gamma") ]
]
where
myIgnores = ["panel", "trayer"]
myFloats = ["feh", "Gimp", "Nvidia-settings", "Gtk-chtheme"]
myOtherFloats = ["alsamixer", "Firefox Preferences", "Session Manager - Mozilla Firefox", "Firefox Add-on Updates", "Clear Private Data", "Dialog"
]
manageHook' :: ManageHook
manageHook' = manageDocks <+> manageHook defaultConfig <+> myManageHook
---------------------- Layout Hook ---------------------------------------
myLayout = avoidStruts (tiled ||| Mirror tiled ||| circle ||| magnify Grid ||| Full)
where
--standardLayouts = hintedTile Tall ||| hintedTile Wide ||| tabLayout ||| noBorders Full
--webLayouts = tabLayout ||| twoPane ||| threeCol ||| noBorders Full
--imLayout = reflectHoriz $ withIM (1%10) (Role "roster") (standardLayouts)
--termLayouts = circle ||| magnified ||| grid ||| tabLayout ||| noBorders Full
--hintedTile = HintedTile nmaster delta ratio TopLeft
--tabLayout = tabbedBottom shrinkText myTabConfig
--twoPane = TwoPane delta (1/2)
--threeCol = ThreeCol nmaster delta (1%3)
circle = magicFocus (Circle)
magnify = magnifiercz (15%10)
--grid = (GridRatio (15/10))
tiled = Tall nmaster delta ratio
nmaster = 1
delta = 5 % 100
ratio = toRational (2/(1 + sqrt 5 :: Double)) -- golden ratio
------------------------------- Key Bindings ----------------------------------
--myKeys :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
[ ((modMask .|. shiftMask, xK_b), sendMessage ToggleStruts)
-- Application key bindings
, ((modMask .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
, ((modMask .|. shiftMask, xK_m), spawn "urxvt -e alsmixer")
, ((modMask .|. shiftMask, xK_P), spawn "gmrun")
, ((modMask, xK_f), spawn "firefox")
]
Offline
I would suggest XMonad.Util.EZConfig from contrib. It makes defining keybindings much easier, and leaves them alone unless you overwrite them specifically.
Offline
I already have that imported don't I? 9nth to last one in my list?
Last edited by semperfiguy (2009-08-28 02:44:53)
Offline
Offline
yup.
main = do
dzpipe <- spawnPipe statusBarCmd
xmonad $ defaultConfig
{ workspaces = myWorkspaces
, borderWidth = myBorderWidth
, normalBorderColor = myNormalBorderColor
, focusedBorderColor = myFocusedBorderColor
, terminal = myTerminal
, modMask = myModMask
--, keys = myKeys
, layoutHook = myLayout
, manageHook = manageHook'
, logHook = dynamicLogWithPP $ mPP dzpipe
}
*reformatted for readability.
those '--' means comment and keys is never evaluated (though, this means the default set should be in use).
if you want to use my method, i can confirm that you only need to list the keys you want to override/add
just uncomment keys = myKeys in main and use this:
myKeys = \c -> keyBinds c `M.union` keys defaultConfig c
where
keyBinds (XConfig {modMask = modm}) = M.fromList $
[ ((modm, xK_w), kill ) -- %! just use the same syntax to list yours
, ((modm .|. shiftMask, xK_a), spawn "whatever") -- %! and heres a spawn example
]
//github/
Offline
The reason I had it commented out was that my keybinds would erase all other keybinds. Your method of keybinding worked with the existing keybinds however. problem solved again. Thank you very much.
Offline