How can I get xmonad to work with Gnome 3?
-Sidenote, some commands like recompile xmonad (Alt+Q) and quitting (Alt+Shift+Q) and dmenu (Alt+P) didnt work unless I added them to my xmonad.hs file, while the other commands did work. But then, the rest of the commands like switching between workspaces, opening terminal, changing layouts didnt work, so know I had to add all of them, weird.
import XMonad
import XMonad.Config.Gnome
import System.Exit
import qualified Data.Map as M
import qualified XMonad.StackSet as W
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
-- launch dmenu
[ ((modm, xK_p ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"")
-- Start a terminal. Terminal to start is specified by myTerminal variable.
, ((modm .|. shiftMask, xK_Return), spawn "gnome-terminal")
-- Rotate through the available layout algorithms
, ((modm, xK_space ), sendMessage NextLayout)
-- Reset the layouts on the current workspace to default
, ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
-- Resize viewed windows to the correct size
, ((modm, xK_n ), refresh)
-- Move focus to the next window
, ((modm, xK_Tab ), windows W.focusDown)
-- Move focus to the next window
, ((modm, xK_j ), windows W.focusDown)
-- Move focus to the previous window
, ((modm, xK_k ), windows W.focusUp )
-- Move focus to the master window
, ((modm, xK_m ), windows W.focusMaster )
-- Swap the focused window and the master window
, ((modm, xK_Return), windows W.swapMaster)
-- Swap the focused window with the next window
, ((modm .|. shiftMask, xK_j ), windows W.swapDown )
-- Swap the focused window with the previous window
, ((modm .|. shiftMask, xK_k ), windows W.swapUp )
-- Shrink the master area
, ((modm, xK_h ), sendMessage Shrink)
-- Expand the master area
, ((modm, xK_l ), sendMessage Expand)
-- Push window back into tiling
, ((modm, xK_t ), withFocused $ windows . W.sink)
-- Increment the number of windows in the master area
, ((modm , xK_comma ), sendMessage (IncMasterN 1))
-- Deincrement the number of windows in the master area
, ((modm , xK_period), sendMessage (IncMasterN (-1)))
-- close focused window
, ((modm .|. shiftMask, xK_c ), kill)
-- Quit xmonad
, ((modm .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
-- Restart xmonad
, ((modm , xK_q ), spawn "xmonad --recompile; xmonad --restart")
]
++
[((m .|. modm, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
myManageHook = composeAll (
[ manageHook gnomeConfig
, className =? "Unity-2d-panel" --> doIgnore
, className =? "Unity-2d-launcher" --> doFloat
])
main = xmonad gnomeConfig { manageHook = myManageHook, keys = myKeys }
/usr/share/gnome-session/sessions/xmonad.session
[GNOME Session]
Name=Xmonad/GNOME
RequiredComponents=gnome-settings-daemon;
RequiredProviders=windowmanager;notifications;
DefaultProvider-windowmanager=xmonad
DefaultProvider-notifications=notification-daemon
/usr/share/xsessions/xmonad
[Desktop Entry]
Name=Xmonad/GNOME
Comment=Tiling window manager
Exec=gnome-session --session=xmonad
TryExec=/usr/bin/gnome-session
Type=XSession