Create a gist now

Instantly share code, notes, and snippets.

XMonad on Unity 2D (Ubuntu 11.10); Based on http://www.haskell.org/haskellwiki/Xmonad/Using_xmonad_in_Unity_2D
# in /usr/share/xsessions
[Desktop Entry]
Name=Xmonad GNOME
Comment=Tiling window manager
TryExec=/usr/bin/gnome-session
Exec=gnome-session --session=xmonad
Type=XSession
# in /usr/share/applications
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Xmonad
Exec=xmonad
NoDisplay=true
X-GNOME-WMName=Xmonad
X-GNOME-Autostart-Phase=WindowManager
X-GNOME-Provides=windowmanager
X-GNOME-Autostart-Notify=true
-- in ~/.xmonad
import XMonad
import XMonad.Config.Gnome
import XMonad.Hooks.ManageDocks
import XMonad.Util.EZConfig
import XMonad.Layout.Gaps
import Data.List
myManageHook = composeAll . concat $
[ [ className =? "Firefox-bin" --> doShift "6:ff" ]
, [ className =? "Firefox" --> doShift "6:ff" ]
, [(className =? "Firefox" <&&> resource =? "Dialog") --> doFloat]
, [ className =? "Emacs" --> doShift "2:emacs" ]
, [ className =? "Emacsclient" --> doShift "2:emacs" ]
, [ className =? "Unity-2d-panel" --> doIgnore ]
, [ className =? "Unity-2d-launcher" --> doIgnore ]
]
myLayouts = gaps [(U, 24)] $ layoutHook gnomeConfig
main = xmonad $ gnomeConfig
{ workspaces = ["1:chrome","2:emacs","3:console","4:server","5:mail","6:ff","7","8","9","0","-","="]
, manageHook = myManageHook <+> manageHook gnomeConfig
, modMask = mod4Mask
, layoutHook = myLayouts
, terminal = "urxvt"
, focusFollowsMouse = False
}
`additionalKeysP` [ ("M-S-q", spawn "gnome-session-quit --power-off") ]
# in /usr/share/gnome-session/sessions
[GNOME Session]
Name=Xmonad Unity-2D Desktop
RequiredComponents=gnome-settings-daemon;
RequiredProviders=windowmanager;panel;
DefaultProvider-windowmanager=xmonad
DefaultProvider-panel=unity-2d-panel
@kofno
Owner
kofno commented Oct 20, 2011

You'll note that my Xmonad configuration makes the Windows/Command key the modifier, rather then control, so as not to interfere w/ Emacs bliss. I also configured Xmonad to only display Emacs and Firefox on specific work spaces (2 and 6, respectively).

Known issue: in dual monitor mode, the unity menu bar does not render the proper width on one of the monitors if the monitors have different resolutions. Right now I don't care.

@onurgu
onurgu commented Oct 27, 2011

Hi,

I'll have a question even if I didn't try your configuration yet. However, I tried another recipe and went on to adapt my existing configuration.

What I would like to do is to have only unity-2d-panel and not unity-2d-launcher. Yet I also want the menubars (i.e. Firefox's menus, or any other ordinary gnome application's) to appear in unity-2d-panel. But it doesn't work as I like right away if I just comment out unity-2d-launcher from relevant files.

Could the reason be me not executing unity-2d-launcher?

Can you give me a pointer about the connection between the menubars in the panel and the applications?

Thank you in advance.

@gokulnath

@onurgu for unity-2d-panel you can give doFloat instead of doIgnore

@trygvis
trygvis commented Mar 23, 2012

@kofno How is xmonad.session used?

@gokulnath

i would read comments too 👀

@kofno
Owner
kofno commented Jul 8, 2012

Wow, too much noise in my github feed I guess @gokulnath

@trygvis that is the session configuration that is fed to gnome-session when it starts and tells it what services to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment