https://wiki.haskell.org/api.php?action=feedcontributions&user=Datagrok&feedformat=atomHaskellWiki - User contributions [en]2024-03-19T14:05:45ZUser contributionsMediaWiki 1.35.5https://wiki.haskell.org/index.php?title=User:Datagrok&diff=65183User:Datagrok2022-06-09T04:19:44Z<p>Datagrok: Blanked the page</p>
<hr />
<div></div>Datagrokhttps://wiki.haskell.org/index.php?title=Xmonad/Using_xmonad_in_Gnome&diff=39722Xmonad/Using xmonad in Gnome2011-05-01T18:35:30Z<p>Datagrok: /* Setting up Gnome to use Xmonad */ mention docs in gnome-wm(1) man page</p>
<hr />
<div>{{xmonad}}<br />
[[Category:XMonad]]<br />
<br />
==Introduction==<br />
<br />
[[Image:Screen-nomeata-ewhm.png|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
Xmonad makes an excellent drop-in replacement for Gnome's default window manager (metacity) giving you a slick tiling window manager. This guide will help you set up Gnome to use Xmonad 0.9.<br />
<br />
This is an update to the previous page on [[Xmonad/Using xmonad in Gnome/0.6]].<br />
<br />
==Setting up Gnome to use Xmonad==<br />
Overall most people on a variety of distros seem to get best results by using an <code>applications/xmonad.desktop</code> file and running a full gnome session replacing only gnome's window manager. They tell gnome-session to use xmonad instead of metacity by running:<br />
<pre># gconftool-2 -s /desktop/gnome/session/required_components/windowmanager xmonad --type string</pre> Doing this from inside a full gnome session will replace metacity with xmonad and continue to run all the other gnome daemons and apps. See 'man gnome-wm' for details. See below to set up a separate customized xmonad or ~/.xsession based session separate from your gnome one.<br />
<br />
For xmonad to start automatically on login you need an <code>applications/xmonad.desktop</code> file on your system. If your distro doesn't provide it, create the following file:<br />
<pre><br />
$ cat /usr/share/applications/xmonad.desktop<br />
[Desktop Entry]<br />
Type=Application<br />
Encoding=UTF-8<br />
Name=Xmonad<br />
Exec=xmonad<br />
NoDisplay=true<br />
X-GNOME-WMName=Xmonad<br />
X-GNOME-Autostart-Phase=WindowManager<br />
X-GNOME-Provides=windowmanager<br />
X-GNOME-Autostart-Notify=false<br />
</pre><br />
Alternatively, you can create the above as <code>~/.local/share/applications/xmonad.desktop</code> for the current user only.<br />
<br />
To run a separate xmonad session in addition to gnome session(s) you need an <code>xsessions/xmonad.desktop</code> file. To start a minimal xmonad session from gdm (see notes* below to run more than just xmonad on login), create the following file:<br />
<pre><br />
$ cat /usr/share/xsessions/xmonad.desktop <br />
[Desktop Entry]<br />
Encoding=UTF-8<br />
Name=XMonad<br />
Comment=Lightweight tiling window manager<br />
Exec=xmonad<br />
Icon=xmonad.png<br />
Type=XSession<br />
</pre><br />
<br />
Your display manager must also be able to find the xmonad executable. If you are not using your distro package manager to install xmonad, for best results configure your build to install xmonad to a location in the system environment like /usr/local/bin/.<br />
<br />
<nowiki>*NOTE:</nowiki> Using an <code>xsessions/xmonad.desktop</code> file that runs a custom script <code>xmonad.start</code> instead of just plain xmonad is also how to add other startup actions to the gdm xmonad.desktop startup, such as starting gnome daemons, apps, etc. See<br />
[http://arjuna.deltoso.net/articoli/my-configuration-of-xmonad-window-manager-with-xmobar-and-trayer/en arjuna's blog] for more details. (simono says: Creating <code>/usr/share/xsessions/xmonad.desktop</code> and <code>/usr/local/bin/xmonad.start</code> files is the preferred method for configuring an alternative window manager. The applications/xmonad.desktop file is still required.) However, see the xsession section below to continue using the classic ~/.xsession method to run a custom session.<br />
<br />
====A Simple Hybrid Alternative====<br />
There is also a hybrid method that seems to work much more simply and easily than the custom start script, while still allowing XMonad to be chosen as a separate session. <code>applications/xmonad.desktop</code> and <code>xsessions/xmonad.desktop</code> are created as above. And, as above, <code>xsessions/xmonad.desktop</code> points to a custom <code>xmonad.start</code> script. But, the contents of the xmonad.start script are simply the following: <br />
<pre><br />
export WINDOW_MANAGER=xmonad<br />
gnome-session<br />
</pre><br />
<br />
This gives all the bells and whistles of gnome, including integrated logout support, etc, while also allowing xmonad and gnome to be selected as separate sessions from the login screen. Note that if you go this road with Ubuntu 10.04 (tested with gnome 2.30.0), you will also need to unset the gconf windowmanager setting.<br />
<br />
<code>gconftool-2 -u /desktop/gnome/session/required_components/windowmanager</code><br />
<br />
That alone didn't work for me. I have this in my xmonad.start instead<br />
<pre><br />
gconftool-2 -t string -s /desktop/gnome/session/required_components/windowmanager xmonad<br />
gconftool-2 -t string -s /desktop/gnome/applications/window_manager/current xmonad<br />
</pre><br />
<br />
After startup I am running<br />
<pre><br />
killall compiz<br />
xmonad &<br />
</pre><br />
<br />
===Ubuntu===<br />
I had tried above methods described by "simple hybrid", but they are not staight forward and didn't work.<br />
<pre><br />
export WINDOW_MANAGER=/path to xmonad<br />
gnome-sesson<br />
</pre><br />
If once I execute "gnome-wm" manually, after that it works, I got xmonad integrated in gnome well. However, once I switch to my gnome session, and then return back to my xmonad session, the xmonad window manager isn't run, just as I log into the gnome session.<br />
<br />
After delving into gnome-wm script and some analysis and many try, I found out why the plain script did not work. Because I had turned on the "auto save gnome session" function, I guess gnome-session wouldn't call gnome-wm again when I change from gnome session to xmonad session.<br />
So I disable the save session function, and remove the files in <code>.config/gnome-session/saved-session/*</code>.<br />
<br />
Finally it works! This indirectly prove the above guess is right.<br />
Actually I had put this script to xmonad-custom.start, then I can have gnome and xmonad session seperated, and they don't interfere with the other. I think this method is simple yet elegant, and easy to understand.<br />
<br />
===Ubuntu Karmic===<br />
Follow the above general instructions. Most people will probably want to use the "simple hybrid method", .xsession, or use gconftool to replace metacity in a full gnome session running all the other supporting gnome apps. You may also wish to install xterm if you don't already have it, since it's the terminal used by the default xmonad setup, at least till you get the gnomeConfig up and running as discussed in later sections.<br />
<br />
====using xsession under karmic====<br />
<nowiki>*NOTE:</nowiki>Ubuntu Karmic Koala users still can use their ~/.xsession scripts to run xmonad. For this, you need:<br />
<br />
1. sudo mkdir /etc/X11/sessions<br />
<br />
2. put into /etc/X11/sessions/Xsessions.desktop:<br />
<pre><br />
[Desktop Entry]<br />
Name=Xsession<br />
Comment=This runs ~/.xsession<br />
Exec=/etc/X11/Xsession<br />
</pre><br />
<br />
3. Then Xsession entry will appear in gdm, and will work as it worked for many years.<br />
<br />
WINDOW_MANAGER variable looks still working, you can use smth like:<br />
<pre><br />
export WINDOW_MANAGER="/path/to/xmonad"<br />
exec gnome-session <br />
</pre><br />
in your ~/.xsession<br />
<br />
For more info on this, check gdm bug description at launchpad [https://bugs.launchpad.net/ubuntu/karmic/+source/gdm/+bug/398300].<br />
<br />
====xmonad-0.9 for karmic====<br />
[http://www.haskell.org/pipermail/xmonad/2009-November/009060.html This mailing list thread] has instructions to use a PPA for newer xmonad, dzen, xmobar.<br />
<br />
===Ubuntu Jaunty===<br />
At least 3 XMonad users have found that the <tt>~/.gnomerc</tt> will not work on Jaunty Ubuntu when one is upgrading from Intrepid; apparently the <tt>~/.gconf/</tt> directory is incompatible or something, so Gnome/Ubuntu will not read .gnomerc and any settings in it will be ignored. <br />
<br />
The work-around is essentially to remove .gconf entirely. On the next login, a fresh default .gconf will be created and .gnomerc will be read. This of course implies that one's settings and preferences will also be removed, and one will have to redo them. (Copying over selected directories from the old .gconf to the new one may or may not work.)<br />
<br />
Or alternatively, the following worked for me (without touching .gconf or .gnomerc or exports):<br />
Add an xmonad launcher in the gnome-session-properties and then execute:<br />
$ gconftool -t string -s /desktop/gnome/applications/window_manager/current xmonad<br />
$ gconftool -t string -s /desktop/gnome/session/required_components/windowmanager xmonad<br />
$ killall metacity; xmonad &<br />
<br />
Also make sure to add the /usr/share/applications/xmonad.desktop file shown above, if it's not already present. This lets gnome know that xmonad is a windowmanager and where to look for it.<br />
<br />
====newer haskell and xmonad for jaunty====<br />
[https://launchpad.net/~gspreemann/+archive/haskell gspreemann's PPA] has newer haskell toolchain without some of the setup problems others have had, as well as xmonad-0.9.<br />
<br />
===Ubuntu Intrepid===<br />
[http://ubuntuforums.org/showthread.php?t=975329 This forum thread] has instructions for making Gnome play nice with xmonad on intrepid.<br />
<br />
<br />
===Ubuntu Natty===<br />
<br />
====Using New Session Files====<br />
<br />
On Natty you need to create a new gnome session description at<br />
<br />
/usr/share/gnome-session/sessions/xmonad.session which should look something like this<br />
<pre><br />
[GNOME Session]<br />
Name=Xmonad<br />
Required=windowmanager;panel;filemanager;<br />
Required-windowmanager=xmonad<br />
Required-panel=gnome-panel<br />
Required-filemanager=nautilus<br />
DefaultApps=gnome-settings-daemon;<br />
</pre><br />
<br />
You should also create a file at /usr/share/xsessions/xmonad.desktop with contents like this<br />
<br />
<pre><br />
[Desktop Entry]<br />
Name=XMonad<br />
Comment=Lightweight tiling window manager + Gnome<br />
Exec=gnome-session --session=xmonad<br />
Icon=<br />
Type=Application<br />
X-Ubuntu-Gettext-Domain=gnome-session-2.0<br />
</pre><br />
<br />
And then select the Xmonad session when logging in with GDM.<br />
<br />
I also had to uninstall the appmenu stuff to get my menus back for some reason. Not sure what the problem with the global menus are in Natty since the Gnome Classic session gets normal in-window menus and the appmenu panel still works. With xmonad it just seems totally broken.<br />
<br />
====Using GConf====<br />
<br />
Rather than having an administrator create new .desktop and .session files, an unprivileged user may configure gnome-wm to use Xmonad as Gnome's window manager through GConf as described at [[#Setting_up_Gnome_to_use_Xmonad]].<br />
<br />
This approach worked in previous versions of Ubuntu but at present with Natty, if /usr/lib/nux/unity_support_test is not installed, an administrator may have to comment out or remove the IsRunnableHelper line from /usr/share/xsessions/gnome-classic.desktop:<br />
<br />
# IsRunnableHelper=/usr/lib/nux/unity_support_test --compiz<br />
<br />
Logging in using the "Ubuntu Classic" session will then launch Xmonad and all the other Gnome widgets. See also [https://bugs.launchpad.net/ubuntu/+source/gnome-session/+bug/774357 Ubuntu Bug#774357].<br />
<br />
===Fedora===<br />
The Fedora xmonad package provides /usr/share/applications/xmonad.desktop<br />
and /usr/share/xsessions/xmonad.desktop, so the above generic instructions<br />
should just work (but not the "Simple Hybrid Alternative").<br />
<br />
====Fedora 10 and further links====<br />
[http://thread.gmane.org/gmane.comp.lang.haskell.xmonad/6557 This old mailing list thread] contains fedora 10 specific setup instructions, but also a bunch of other gnome setup links if you are having trouble with the above methods.<br />
<br />
===Using the startup applications menu to modify your gnome session===<br />
An alternative to using gconftool to change the window manager in a gnome session:<br />
<br />
On many distros you can replace metacity in your full gnome session by using the gnome menus to create a new item in the<br />
System>Preferences>Startup Applications menu Programs tab to run xmonad as<br />
window manager. (Disable "automatic saving of session components on logout" to use<br />
this setup method.)<br />
<br />
For example, for '''Name:''' you could use "Window Manager XMonad", then<br />
for '''Program:''' use <code>xmonad</code>. Un-check the old Metacity<br />
one (typically called Window Manager and using '''Program''' <code>gnome-wm</code>). Don't delete or over-write it so you can switch back if you want. Click the checkbox to turn on the new "Window Manager XMonad" entry instead, save your session, log out and log back in choosing gnome-session. If it's not already there, this will create the applications/xmonad.desktop file discussed above.<br />
(Not a great method for people who switch frequently between metacity, compiz, and xmonad.)<br />
<br />
==Configure Xmonad to interoperate with Gnome==<br />
<br />
<br />
[[Image:Screen-xmonad-gnome-darktheme4.jpg|200px|xmonad and gnome-panel|center]]<br />
<br />
=== Using the Config.Gnome module ===<br />
For xmonad-0.8 or greater, see [[Xmonad/Basic Desktop Environment Integration | Basic DE Integration]] for a simple three line <code>xmonad.hs</code> configuration that:<br />
* integrates docks and gnome-panel using ewmh's<br />
* allows gap-toggling<br />
* binds the gnome run dialog to mod-p, and mod-shift-q to save your session and logout <br />
* otherwise keeps xmonad defaults. <br />
<br />
It is a good starting point. You can then come back and add some of the features below once everything's working.<br />
<br />
Once the Config.Gnome module set up, you may want to customize these gnome settings.<br />
<br />
====Keys====<br />
Use [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Util-EZConfig.html EZConfig] to add keybindings. Note that you must use gnomeConfig whereever defaultConfig is mentioned.<br />
<haskell><br />
import XMonad<br />
import XMonad.Util.EZConfig<br />
main = xmonad $ gnomeConfig<br />
{ terminal = "urxvt"<br />
, modMask = mod4Mask -- set the mod key to the windows key<br />
}<br />
`additionalKeysP` <br />
[ ("M-m", spawn "echo 'Hi, mom!' | dzen2 -p 4")<br />
, ("M-<Backspace>", withFocused hide) -- N.B. this is an absurd thing to do<br />
]<br />
</haskell><br />
<br />
==== ManageHooks ====<br />
Be sure to include the default gnome manageHook when overriding manageHooks so that xmonad can leave a gap for gnome-panel:<br />
<haskell><br />
main = xmonad gnomeConfig<br />
{<br />
...<br />
, manageHook = composeAll<br />
[ manageHook gnomeConfig<br />
, title =? "foo" --> doShift "2"<br />
-- needs: import XMonad.Hooks.ManageHelpers (isFullscreen,doFullFloat)<br />
, isFullscreen --> doFullFloat<br />
]<br />
...<br />
}<br />
</haskell><br />
<br />
==== Layouts ====<br />
When overriding the default layouts, you must manually apply the desktopLayoutModifiers layout modifier.<br />
<haskell><br />
import XMonad.Config.Desktop (desktopLayoutModifiers)<br />
main = xmonad gnomeConfig<br />
{<br />
...<br />
, layoutHook = desktopLayoutModifiers (Tall 1 0.03 0.5 ||| Full)<br />
...<br />
}<br />
</haskell><br />
<br />
[[Image:screen-ohmega-tab-gnome-twopane.jpg|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
==Tweak Gnome to work better with Xmonad==<br />
<br />
These are a few steps that greatly improves the experience of running Xmonad under Gnome. Note that on some systems the binary <tt>gconftool</tt> is called <tt>gconftool-2</tt>.<br />
<br />
===Disable the Nautilus desktop===<br />
<br />
This step is not required, but some users prefer to disable the desktop. From the command line execute:<br />
<br />
gconftool --type boolean --set /apps/nautilus/preferences/show_desktop false<br />
<br />
(Using recent gnome and xmonad I found that it was necessary.)<br />
<br />
===Changing desktop background===<br />
<br />
If you need to change the workspace background programmatically (i.e. from some extension setting in xmonad's configuration file), you can use the command:<br />
<br />
gconftool --type string --set /desktop/gnome/background/picture_filename "/path/to/your/image.png"<br />
<br />
===Display XMonad logHook in gnome-panel===<br />
<br />
See [http://uhsure.com/xmonad-log-applet.html xmonad log applet] for a third party panel applet to display xmonad's logHook in gnome-panel via dbus. You will also need to install the [http://hackage.haskell.org/package/DBus DBus] package from hackage. For more detailed installation and setup instructions, see [[Installing xmonad log applet]].<br />
<br />
===Key bindings for switching desktops===<br />
<br />
====In 1 dimension: CycleWS====<br />
<br />
Gnome lays out the desktops in a row by default, and uses Ctrl+Alt+Left/Right for switching desktops left/right. To get similar behaviour in Xmonad, you need to add some keybindings. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-CycleWS.html XMonad.Actions.CycleWS] has some useful actions for cycling workspaces:<br />
<br />
<haskell><br />
main = xmonad gnomeConfig<br />
{ modMask = mod4Mask }<br />
`additionalKeysP`<br />
[<br />
...<br />
-- moving workspaces<br />
, ("M-<Left>", prevWS )<br />
, ("M-<Right>", nextWS )<br />
, ("M-S-<Left>", shiftToPrev )<br />
, ("M-S-<Right>", shiftToNext )<br />
]<br />
</haskell><br />
<br />
[[Image:Xmonad-screen-gnome-brownblack5.jpg|center|200px]]<br />
<br />
====In 2 dimensions: Plane====<br />
<br />
If Gnome is configured to lay out desktops in more than one line, it's possible to navigate with Ctrl+Alt+Up/Bottom also. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-Plane.html XMonad.Actions.Plane], available in the xmonad-0.8 or greater. The keybindings can be incorporated in with EZConfig as such:<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Config.Gnome<br />
import XMonad.Actions.Plane<br />
import XMonad.Util.EZConfig<br />
import qualified Data.Map as M<br />
main = xmonad $ gnomeConfig<br />
{ terminal = "urxvt"<br />
, modMask = mod4Mask -- set the mod key to the windows key<br />
}<br />
`additionalKeysP` <br />
[ ("M-m", spawn "echo 'Hi, mom!' | dzen2 -p 4")<br />
, ("M-<Backspace>", withFocused hide) -- N.B. this is an absurd thing to do<br />
]<br />
`additionalKeys`<br />
-- NOTE: planeKeys requires xmonad-0.9 or greater<br />
M.toList (planeKeys mod4Mask GConf Finite)<br />
</haskell><br />
<br />
[http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-WorkspaceCursors.html Actions.WorkspaceCursors] can be used to navigate workspaces arranged in three or more dimensions.<br />
<br />
===Logging out of the Gnome session vs. quitting Xmonad===<br />
<br />
When running Xmonad as above, it is launched by ''gnome-session'', the "Gnome session manager." Quitting Xmonad in this situation ''will not log you out.'' If you make no changes, using mod+shift+q will leave you with all your applications still running and no window manager to navigate them! There are several remedies for this.<br />
<br />
* Run 'xmonad &' from a command line.<br />
* Quit X using Alt-Ctrl-Backspace.<br />
* Rebind mod+shift+q<br />
<br />
====Rebind mod+shift+q====<br />
To avoid exiting Xmonad and being stuck with no window manager, you might rebind mod+shift+q to execute the gnome-session "log out" functionality. This will of course prevent you from "quitting" Xmonad in the normal way, which may or may not be desirable. When the session logs out, the X11 server is terminated, which will in turn terminate all running X11 applications, including Xmonad.<br />
<br />
(TODO: improve the description of changes that need to be made here.)<br />
<br />
, ("M-S-q", spawn "gnome-session-save --gui --logout-dialog") )<br />
<br />
==== Configure rudimentary power management ====<br />
<br />
It might be useful to include bindings for hibernation, screen locking, and other assorted basic functions. While Gnome provides the capability to do so, it's functionality is limited (Mod4 cannot be used as a mask), and you may prefer to have Xmonad manage it. Fortunately, these things can be controlled from the command line, and the following bindings may help. (NB: These are for one handed use of Dvorak control; make sure to bind them to something more fitting. They also use mod1 not to clash with mod4 by accident.)<br />
<br />
-- Lock Screen<br />
, ("M-S-l", spawn "gnome-screensaver-command -l")<br />
-- Logout<br />
, ("M1-M-S-l", spawn "gnome-session-save --gui --kill")<br />
-- Sleep<br />
, ("M1-S-'", spawn "gnome-power-cmd.sh suspend")<br />
-- Reboot<br />
, ("M1-S-,", spawn "gnome-power-cmd.sh reboot")<br />
-- Deep Sleep<br />
, ("M1-S-.", spawn "gnome-power-cmd.sh hibernate")<br />
-- Death<br />
, ("M1-S-p", spawn "gnome-power-cmd.sh shutdown")<br />
<br />
<br />
====Configure the session manager to relaunch Xmonad====<br />
You can configure the Gnome Session Manager to restart Xmonad whenever it exits (i.e., if you haven't rebound mod-shift-q.) This is rarely a useful feature as xmonad has its builtin compile-and-restart (mod-q), but it will prevent you from accidentally ending up with no window manager and no way to launch one.<br />
<br />
However, as of version 0.7, XMonad does not itself communicate with any session managers in they way they prefer, so setting things up takes some hackery:<br />
<br />
(TBD: steps, see also [[Xmonad/Using_xmonad_in_Gnome/0.5#Preparing_your_GNOME_session]])<br />
<br />
===Modify terminal===<br />
<br />
If you use prompts, e.g. [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Prompt-Ssh.html SshPrompt], due to an issue with how the terminal is invoked (see [http://code.google.com/p/xmonad/issues/detail?id=254]), you will need to either wrap gnome-terminal as described [http://xmonad.googlecode.com/issues/attachment?aid=-8330341117914417101&name=gnome-terminal-wrapper&token=420eee337a501da44ae2fe29b5950455 here] and then do something like<br />
<br />
main = xmonad $ gnomeConfig { terminal = "/path/to/gnome-terminal-wrapper" }<br />
<br />
or use a different terminal altogether<br />
<br />
main = xmonad $ gnomeConfig { terminal = "xterm" }</div>Datagrokhttps://wiki.haskell.org/index.php?title=Xmonad/Using_xmonad_in_Gnome&diff=39721Xmonad/Using xmonad in Gnome2011-05-01T18:32:54Z<p>Datagrok: /* Ubuntu Natty */ reference rather than repeat instructions</p>
<hr />
<div>{{xmonad}}<br />
[[Category:XMonad]]<br />
<br />
==Introduction==<br />
<br />
[[Image:Screen-nomeata-ewhm.png|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
Xmonad makes an excellent drop-in replacement for Gnome's default window manager (metacity) giving you a slick tiling window manager. This guide will help you set up Gnome to use Xmonad 0.9.<br />
<br />
This is an update to the previous page on [[Xmonad/Using xmonad in Gnome/0.6]].<br />
<br />
==Setting up Gnome to use Xmonad==<br />
Overall most people on a variety of distros seem to get best results by using an <code>applications/xmonad.desktop</code> file and running a full gnome session replacing only gnome's window manager. They tell gnome-session to use xmonad instead of metacity by running:<br />
<pre># gconftool-2 -s /desktop/gnome/session/required_components/windowmanager xmonad --type string</pre> Doing this from inside a full gnome session will replace metacity with xmonad and continue to run all the other gnome daemons and apps. See below to set up a separate customized xmonad or ~/.xsession based session separate from your gnome one.<br />
<br />
For xmonad to start automatically on login you need an <code>applications/xmonad.desktop</code> file on your system. If your distro doesn't provide it, create the following file:<br />
<pre><br />
$ cat /usr/share/applications/xmonad.desktop<br />
[Desktop Entry]<br />
Type=Application<br />
Encoding=UTF-8<br />
Name=Xmonad<br />
Exec=xmonad<br />
NoDisplay=true<br />
X-GNOME-WMName=Xmonad<br />
X-GNOME-Autostart-Phase=WindowManager<br />
X-GNOME-Provides=windowmanager<br />
X-GNOME-Autostart-Notify=false<br />
</pre><br />
Alternatively, you can create the above as <code>~/.local/share/applications/xmonad.desktop</code> for the current user only.<br />
<br />
To run a separate xmonad session in addition to gnome session(s) you need an <code>xsessions/xmonad.desktop</code> file. To start a minimal xmonad session from gdm (see notes* below to run more than just xmonad on login), create the following file:<br />
<pre><br />
$ cat /usr/share/xsessions/xmonad.desktop <br />
[Desktop Entry]<br />
Encoding=UTF-8<br />
Name=XMonad<br />
Comment=Lightweight tiling window manager<br />
Exec=xmonad<br />
Icon=xmonad.png<br />
Type=XSession<br />
</pre><br />
<br />
Your display manager must also be able to find the xmonad executable. If you are not using your distro package manager to install xmonad, for best results configure your build to install xmonad to a location in the system environment like /usr/local/bin/.<br />
<br />
<nowiki>*NOTE:</nowiki> Using an <code>xsessions/xmonad.desktop</code> file that runs a custom script <code>xmonad.start</code> instead of just plain xmonad is also how to add other startup actions to the gdm xmonad.desktop startup, such as starting gnome daemons, apps, etc. See<br />
[http://arjuna.deltoso.net/articoli/my-configuration-of-xmonad-window-manager-with-xmobar-and-trayer/en arjuna's blog] for more details. (simono says: Creating <code>/usr/share/xsessions/xmonad.desktop</code> and <code>/usr/local/bin/xmonad.start</code> files is the preferred method for configuring an alternative window manager. The applications/xmonad.desktop file is still required.) However, see the xsession section below to continue using the classic ~/.xsession method to run a custom session.<br />
<br />
====A Simple Hybrid Alternative====<br />
There is also a hybrid method that seems to work much more simply and easily than the custom start script, while still allowing XMonad to be chosen as a separate session. <code>applications/xmonad.desktop</code> and <code>xsessions/xmonad.desktop</code> are created as above. And, as above, <code>xsessions/xmonad.desktop</code> points to a custom <code>xmonad.start</code> script. But, the contents of the xmonad.start script are simply the following: <br />
<pre><br />
export WINDOW_MANAGER=xmonad<br />
gnome-session<br />
</pre><br />
<br />
This gives all the bells and whistles of gnome, including integrated logout support, etc, while also allowing xmonad and gnome to be selected as separate sessions from the login screen. Note that if you go this road with Ubuntu 10.04 (tested with gnome 2.30.0), you will also need to unset the gconf windowmanager setting.<br />
<br />
<code>gconftool-2 -u /desktop/gnome/session/required_components/windowmanager</code><br />
<br />
That alone didn't work for me. I have this in my xmonad.start instead<br />
<pre><br />
gconftool-2 -t string -s /desktop/gnome/session/required_components/windowmanager xmonad<br />
gconftool-2 -t string -s /desktop/gnome/applications/window_manager/current xmonad<br />
</pre><br />
<br />
After startup I am running<br />
<pre><br />
killall compiz<br />
xmonad &<br />
</pre><br />
<br />
===Ubuntu===<br />
I had tried above methods described by "simple hybrid", but they are not staight forward and didn't work.<br />
<pre><br />
export WINDOW_MANAGER=/path to xmonad<br />
gnome-sesson<br />
</pre><br />
If once I execute "gnome-wm" manually, after that it works, I got xmonad integrated in gnome well. However, once I switch to my gnome session, and then return back to my xmonad session, the xmonad window manager isn't run, just as I log into the gnome session.<br />
<br />
After delving into gnome-wm script and some analysis and many try, I found out why the plain script did not work. Because I had turned on the "auto save gnome session" function, I guess gnome-session wouldn't call gnome-wm again when I change from gnome session to xmonad session.<br />
So I disable the save session function, and remove the files in <code>.config/gnome-session/saved-session/*</code>.<br />
<br />
Finally it works! This indirectly prove the above guess is right.<br />
Actually I had put this script to xmonad-custom.start, then I can have gnome and xmonad session seperated, and they don't interfere with the other. I think this method is simple yet elegant, and easy to understand.<br />
<br />
===Ubuntu Karmic===<br />
Follow the above general instructions. Most people will probably want to use the "simple hybrid method", .xsession, or use gconftool to replace metacity in a full gnome session running all the other supporting gnome apps. You may also wish to install xterm if you don't already have it, since it's the terminal used by the default xmonad setup, at least till you get the gnomeConfig up and running as discussed in later sections.<br />
<br />
====using xsession under karmic====<br />
<nowiki>*NOTE:</nowiki>Ubuntu Karmic Koala users still can use their ~/.xsession scripts to run xmonad. For this, you need:<br />
<br />
1. sudo mkdir /etc/X11/sessions<br />
<br />
2. put into /etc/X11/sessions/Xsessions.desktop:<br />
<pre><br />
[Desktop Entry]<br />
Name=Xsession<br />
Comment=This runs ~/.xsession<br />
Exec=/etc/X11/Xsession<br />
</pre><br />
<br />
3. Then Xsession entry will appear in gdm, and will work as it worked for many years.<br />
<br />
WINDOW_MANAGER variable looks still working, you can use smth like:<br />
<pre><br />
export WINDOW_MANAGER="/path/to/xmonad"<br />
exec gnome-session <br />
</pre><br />
in your ~/.xsession<br />
<br />
For more info on this, check gdm bug description at launchpad [https://bugs.launchpad.net/ubuntu/karmic/+source/gdm/+bug/398300].<br />
<br />
====xmonad-0.9 for karmic====<br />
[http://www.haskell.org/pipermail/xmonad/2009-November/009060.html This mailing list thread] has instructions to use a PPA for newer xmonad, dzen, xmobar.<br />
<br />
===Ubuntu Jaunty===<br />
At least 3 XMonad users have found that the <tt>~/.gnomerc</tt> will not work on Jaunty Ubuntu when one is upgrading from Intrepid; apparently the <tt>~/.gconf/</tt> directory is incompatible or something, so Gnome/Ubuntu will not read .gnomerc and any settings in it will be ignored. <br />
<br />
The work-around is essentially to remove .gconf entirely. On the next login, a fresh default .gconf will be created and .gnomerc will be read. This of course implies that one's settings and preferences will also be removed, and one will have to redo them. (Copying over selected directories from the old .gconf to the new one may or may not work.)<br />
<br />
Or alternatively, the following worked for me (without touching .gconf or .gnomerc or exports):<br />
Add an xmonad launcher in the gnome-session-properties and then execute:<br />
$ gconftool -t string -s /desktop/gnome/applications/window_manager/current xmonad<br />
$ gconftool -t string -s /desktop/gnome/session/required_components/windowmanager xmonad<br />
$ killall metacity; xmonad &<br />
<br />
Also make sure to add the /usr/share/applications/xmonad.desktop file shown above, if it's not already present. This lets gnome know that xmonad is a windowmanager and where to look for it.<br />
<br />
====newer haskell and xmonad for jaunty====<br />
[https://launchpad.net/~gspreemann/+archive/haskell gspreemann's PPA] has newer haskell toolchain without some of the setup problems others have had, as well as xmonad-0.9.<br />
<br />
===Ubuntu Intrepid===<br />
[http://ubuntuforums.org/showthread.php?t=975329 This forum thread] has instructions for making Gnome play nice with xmonad on intrepid.<br />
<br />
<br />
===Ubuntu Natty===<br />
<br />
====Using New Session Files====<br />
<br />
On Natty you need to create a new gnome session description at<br />
<br />
/usr/share/gnome-session/sessions/xmonad.session which should look something like this<br />
<pre><br />
[GNOME Session]<br />
Name=Xmonad<br />
Required=windowmanager;panel;filemanager;<br />
Required-windowmanager=xmonad<br />
Required-panel=gnome-panel<br />
Required-filemanager=nautilus<br />
DefaultApps=gnome-settings-daemon;<br />
</pre><br />
<br />
You should also create a file at /usr/share/xsessions/xmonad.desktop with contents like this<br />
<br />
<pre><br />
[Desktop Entry]<br />
Name=XMonad<br />
Comment=Lightweight tiling window manager + Gnome<br />
Exec=gnome-session --session=xmonad<br />
Icon=<br />
Type=Application<br />
X-Ubuntu-Gettext-Domain=gnome-session-2.0<br />
</pre><br />
<br />
And then select the Xmonad session when logging in with GDM.<br />
<br />
I also had to uninstall the appmenu stuff to get my menus back for some reason. Not sure what the problem with the global menus are in Natty since the Gnome Classic session gets normal in-window menus and the appmenu panel still works. With xmonad it just seems totally broken.<br />
<br />
====Using GConf====<br />
<br />
Rather than having an administrator create new .desktop and .session files, an unprivileged user may configure gnome-wm to use Xmonad as Gnome's window manager through GConf as described at [[#Setting_up_Gnome_to_use_Xmonad]].<br />
<br />
This approach worked in previous versions of Ubuntu but at present with Natty, if /usr/lib/nux/unity_support_test is not installed, an administrator may have to comment out or remove the IsRunnableHelper line from /usr/share/xsessions/gnome-classic.desktop:<br />
<br />
# IsRunnableHelper=/usr/lib/nux/unity_support_test --compiz<br />
<br />
Logging in using the "Ubuntu Classic" session will then launch Xmonad and all the other Gnome widgets. See also [https://bugs.launchpad.net/ubuntu/+source/gnome-session/+bug/774357 Ubuntu Bug#774357].<br />
<br />
===Fedora===<br />
The Fedora xmonad package provides /usr/share/applications/xmonad.desktop<br />
and /usr/share/xsessions/xmonad.desktop, so the above generic instructions<br />
should just work (but not the "Simple Hybrid Alternative").<br />
<br />
====Fedora 10 and further links====<br />
[http://thread.gmane.org/gmane.comp.lang.haskell.xmonad/6557 This old mailing list thread] contains fedora 10 specific setup instructions, but also a bunch of other gnome setup links if you are having trouble with the above methods.<br />
<br />
===Using the startup applications menu to modify your gnome session===<br />
An alternative to using gconftool to change the window manager in a gnome session:<br />
<br />
On many distros you can replace metacity in your full gnome session by using the gnome menus to create a new item in the<br />
System>Preferences>Startup Applications menu Programs tab to run xmonad as<br />
window manager. (Disable "automatic saving of session components on logout" to use<br />
this setup method.)<br />
<br />
For example, for '''Name:''' you could use "Window Manager XMonad", then<br />
for '''Program:''' use <code>xmonad</code>. Un-check the old Metacity<br />
one (typically called Window Manager and using '''Program''' <code>gnome-wm</code>). Don't delete or over-write it so you can switch back if you want. Click the checkbox to turn on the new "Window Manager XMonad" entry instead, save your session, log out and log back in choosing gnome-session. If it's not already there, this will create the applications/xmonad.desktop file discussed above.<br />
(Not a great method for people who switch frequently between metacity, compiz, and xmonad.)<br />
<br />
==Configure Xmonad to interoperate with Gnome==<br />
<br />
<br />
[[Image:Screen-xmonad-gnome-darktheme4.jpg|200px|xmonad and gnome-panel|center]]<br />
<br />
=== Using the Config.Gnome module ===<br />
For xmonad-0.8 or greater, see [[Xmonad/Basic Desktop Environment Integration | Basic DE Integration]] for a simple three line <code>xmonad.hs</code> configuration that:<br />
* integrates docks and gnome-panel using ewmh's<br />
* allows gap-toggling<br />
* binds the gnome run dialog to mod-p, and mod-shift-q to save your session and logout <br />
* otherwise keeps xmonad defaults. <br />
<br />
It is a good starting point. You can then come back and add some of the features below once everything's working.<br />
<br />
Once the Config.Gnome module set up, you may want to customize these gnome settings.<br />
<br />
====Keys====<br />
Use [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Util-EZConfig.html EZConfig] to add keybindings. Note that you must use gnomeConfig whereever defaultConfig is mentioned.<br />
<haskell><br />
import XMonad<br />
import XMonad.Util.EZConfig<br />
main = xmonad $ gnomeConfig<br />
{ terminal = "urxvt"<br />
, modMask = mod4Mask -- set the mod key to the windows key<br />
}<br />
`additionalKeysP` <br />
[ ("M-m", spawn "echo 'Hi, mom!' | dzen2 -p 4")<br />
, ("M-<Backspace>", withFocused hide) -- N.B. this is an absurd thing to do<br />
]<br />
</haskell><br />
<br />
==== ManageHooks ====<br />
Be sure to include the default gnome manageHook when overriding manageHooks so that xmonad can leave a gap for gnome-panel:<br />
<haskell><br />
main = xmonad gnomeConfig<br />
{<br />
...<br />
, manageHook = composeAll<br />
[ manageHook gnomeConfig<br />
, title =? "foo" --> doShift "2"<br />
-- needs: import XMonad.Hooks.ManageHelpers (isFullscreen,doFullFloat)<br />
, isFullscreen --> doFullFloat<br />
]<br />
...<br />
}<br />
</haskell><br />
<br />
==== Layouts ====<br />
When overriding the default layouts, you must manually apply the desktopLayoutModifiers layout modifier.<br />
<haskell><br />
import XMonad.Config.Desktop (desktopLayoutModifiers)<br />
main = xmonad gnomeConfig<br />
{<br />
...<br />
, layoutHook = desktopLayoutModifiers (Tall 1 0.03 0.5 ||| Full)<br />
...<br />
}<br />
</haskell><br />
<br />
[[Image:screen-ohmega-tab-gnome-twopane.jpg|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
==Tweak Gnome to work better with Xmonad==<br />
<br />
These are a few steps that greatly improves the experience of running Xmonad under Gnome. Note that on some systems the binary <tt>gconftool</tt> is called <tt>gconftool-2</tt>.<br />
<br />
===Disable the Nautilus desktop===<br />
<br />
This step is not required, but some users prefer to disable the desktop. From the command line execute:<br />
<br />
gconftool --type boolean --set /apps/nautilus/preferences/show_desktop false<br />
<br />
(Using recent gnome and xmonad I found that it was necessary.)<br />
<br />
===Changing desktop background===<br />
<br />
If you need to change the workspace background programmatically (i.e. from some extension setting in xmonad's configuration file), you can use the command:<br />
<br />
gconftool --type string --set /desktop/gnome/background/picture_filename "/path/to/your/image.png"<br />
<br />
===Display XMonad logHook in gnome-panel===<br />
<br />
See [http://uhsure.com/xmonad-log-applet.html xmonad log applet] for a third party panel applet to display xmonad's logHook in gnome-panel via dbus. You will also need to install the [http://hackage.haskell.org/package/DBus DBus] package from hackage. For more detailed installation and setup instructions, see [[Installing xmonad log applet]].<br />
<br />
===Key bindings for switching desktops===<br />
<br />
====In 1 dimension: CycleWS====<br />
<br />
Gnome lays out the desktops in a row by default, and uses Ctrl+Alt+Left/Right for switching desktops left/right. To get similar behaviour in Xmonad, you need to add some keybindings. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-CycleWS.html XMonad.Actions.CycleWS] has some useful actions for cycling workspaces:<br />
<br />
<haskell><br />
main = xmonad gnomeConfig<br />
{ modMask = mod4Mask }<br />
`additionalKeysP`<br />
[<br />
...<br />
-- moving workspaces<br />
, ("M-<Left>", prevWS )<br />
, ("M-<Right>", nextWS )<br />
, ("M-S-<Left>", shiftToPrev )<br />
, ("M-S-<Right>", shiftToNext )<br />
]<br />
</haskell><br />
<br />
[[Image:Xmonad-screen-gnome-brownblack5.jpg|center|200px]]<br />
<br />
====In 2 dimensions: Plane====<br />
<br />
If Gnome is configured to lay out desktops in more than one line, it's possible to navigate with Ctrl+Alt+Up/Bottom also. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-Plane.html XMonad.Actions.Plane], available in the xmonad-0.8 or greater. The keybindings can be incorporated in with EZConfig as such:<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Config.Gnome<br />
import XMonad.Actions.Plane<br />
import XMonad.Util.EZConfig<br />
import qualified Data.Map as M<br />
main = xmonad $ gnomeConfig<br />
{ terminal = "urxvt"<br />
, modMask = mod4Mask -- set the mod key to the windows key<br />
}<br />
`additionalKeysP` <br />
[ ("M-m", spawn "echo 'Hi, mom!' | dzen2 -p 4")<br />
, ("M-<Backspace>", withFocused hide) -- N.B. this is an absurd thing to do<br />
]<br />
`additionalKeys`<br />
-- NOTE: planeKeys requires xmonad-0.9 or greater<br />
M.toList (planeKeys mod4Mask GConf Finite)<br />
</haskell><br />
<br />
[http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-WorkspaceCursors.html Actions.WorkspaceCursors] can be used to navigate workspaces arranged in three or more dimensions.<br />
<br />
===Logging out of the Gnome session vs. quitting Xmonad===<br />
<br />
When running Xmonad as above, it is launched by ''gnome-session'', the "Gnome session manager." Quitting Xmonad in this situation ''will not log you out.'' If you make no changes, using mod+shift+q will leave you with all your applications still running and no window manager to navigate them! There are several remedies for this.<br />
<br />
* Run 'xmonad &' from a command line.<br />
* Quit X using Alt-Ctrl-Backspace.<br />
* Rebind mod+shift+q<br />
<br />
====Rebind mod+shift+q====<br />
To avoid exiting Xmonad and being stuck with no window manager, you might rebind mod+shift+q to execute the gnome-session "log out" functionality. This will of course prevent you from "quitting" Xmonad in the normal way, which may or may not be desirable. When the session logs out, the X11 server is terminated, which will in turn terminate all running X11 applications, including Xmonad.<br />
<br />
(TODO: improve the description of changes that need to be made here.)<br />
<br />
, ("M-S-q", spawn "gnome-session-save --gui --logout-dialog") )<br />
<br />
==== Configure rudimentary power management ====<br />
<br />
It might be useful to include bindings for hibernation, screen locking, and other assorted basic functions. While Gnome provides the capability to do so, it's functionality is limited (Mod4 cannot be used as a mask), and you may prefer to have Xmonad manage it. Fortunately, these things can be controlled from the command line, and the following bindings may help. (NB: These are for one handed use of Dvorak control; make sure to bind them to something more fitting. They also use mod1 not to clash with mod4 by accident.)<br />
<br />
-- Lock Screen<br />
, ("M-S-l", spawn "gnome-screensaver-command -l")<br />
-- Logout<br />
, ("M1-M-S-l", spawn "gnome-session-save --gui --kill")<br />
-- Sleep<br />
, ("M1-S-'", spawn "gnome-power-cmd.sh suspend")<br />
-- Reboot<br />
, ("M1-S-,", spawn "gnome-power-cmd.sh reboot")<br />
-- Deep Sleep<br />
, ("M1-S-.", spawn "gnome-power-cmd.sh hibernate")<br />
-- Death<br />
, ("M1-S-p", spawn "gnome-power-cmd.sh shutdown")<br />
<br />
<br />
====Configure the session manager to relaunch Xmonad====<br />
You can configure the Gnome Session Manager to restart Xmonad whenever it exits (i.e., if you haven't rebound mod-shift-q.) This is rarely a useful feature as xmonad has its builtin compile-and-restart (mod-q), but it will prevent you from accidentally ending up with no window manager and no way to launch one.<br />
<br />
However, as of version 0.7, XMonad does not itself communicate with any session managers in they way they prefer, so setting things up takes some hackery:<br />
<br />
(TBD: steps, see also [[Xmonad/Using_xmonad_in_Gnome/0.5#Preparing_your_GNOME_session]])<br />
<br />
===Modify terminal===<br />
<br />
If you use prompts, e.g. [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Prompt-Ssh.html SshPrompt], due to an issue with how the terminal is invoked (see [http://code.google.com/p/xmonad/issues/detail?id=254]), you will need to either wrap gnome-terminal as described [http://xmonad.googlecode.com/issues/attachment?aid=-8330341117914417101&name=gnome-terminal-wrapper&token=420eee337a501da44ae2fe29b5950455 here] and then do something like<br />
<br />
main = xmonad $ gnomeConfig { terminal = "/path/to/gnome-terminal-wrapper" }<br />
<br />
or use a different terminal altogether<br />
<br />
main = xmonad $ gnomeConfig { terminal = "xterm" }</div>Datagrokhttps://wiki.haskell.org/index.php?title=Xmonad/Using_xmonad_in_Gnome&diff=39720Xmonad/Using xmonad in Gnome2011-05-01T18:25:10Z<p>Datagrok: /* Ubuntu Natty */</p>
<hr />
<div>{{xmonad}}<br />
[[Category:XMonad]]<br />
<br />
==Introduction==<br />
<br />
[[Image:Screen-nomeata-ewhm.png|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
Xmonad makes an excellent drop-in replacement for Gnome's default window manager (metacity) giving you a slick tiling window manager. This guide will help you set up Gnome to use Xmonad 0.9.<br />
<br />
This is an update to the previous page on [[Xmonad/Using xmonad in Gnome/0.6]].<br />
<br />
==Setting up Gnome to use Xmonad==<br />
Overall most people on a variety of distros seem to get best results by using an <code>applications/xmonad.desktop</code> file and running a full gnome session replacing only gnome's window manager. They tell gnome-session to use xmonad instead of metacity by running:<br />
<pre># gconftool-2 -s /desktop/gnome/session/required_components/windowmanager xmonad --type string</pre> Doing this from inside a full gnome session will replace metacity with xmonad and continue to run all the other gnome daemons and apps. See below to set up a separate customized xmonad or ~/.xsession based session separate from your gnome one.<br />
<br />
For xmonad to start automatically on login you need an <code>applications/xmonad.desktop</code> file on your system. If your distro doesn't provide it, create the following file:<br />
<pre><br />
$ cat /usr/share/applications/xmonad.desktop<br />
[Desktop Entry]<br />
Type=Application<br />
Encoding=UTF-8<br />
Name=Xmonad<br />
Exec=xmonad<br />
NoDisplay=true<br />
X-GNOME-WMName=Xmonad<br />
X-GNOME-Autostart-Phase=WindowManager<br />
X-GNOME-Provides=windowmanager<br />
X-GNOME-Autostart-Notify=false<br />
</pre><br />
Alternatively, you can create the above as <code>~/.local/share/applications/xmonad.desktop</code> for the current user only.<br />
<br />
To run a separate xmonad session in addition to gnome session(s) you need an <code>xsessions/xmonad.desktop</code> file. To start a minimal xmonad session from gdm (see notes* below to run more than just xmonad on login), create the following file:<br />
<pre><br />
$ cat /usr/share/xsessions/xmonad.desktop <br />
[Desktop Entry]<br />
Encoding=UTF-8<br />
Name=XMonad<br />
Comment=Lightweight tiling window manager<br />
Exec=xmonad<br />
Icon=xmonad.png<br />
Type=XSession<br />
</pre><br />
<br />
Your display manager must also be able to find the xmonad executable. If you are not using your distro package manager to install xmonad, for best results configure your build to install xmonad to a location in the system environment like /usr/local/bin/.<br />
<br />
<nowiki>*NOTE:</nowiki> Using an <code>xsessions/xmonad.desktop</code> file that runs a custom script <code>xmonad.start</code> instead of just plain xmonad is also how to add other startup actions to the gdm xmonad.desktop startup, such as starting gnome daemons, apps, etc. See<br />
[http://arjuna.deltoso.net/articoli/my-configuration-of-xmonad-window-manager-with-xmobar-and-trayer/en arjuna's blog] for more details. (simono says: Creating <code>/usr/share/xsessions/xmonad.desktop</code> and <code>/usr/local/bin/xmonad.start</code> files is the preferred method for configuring an alternative window manager. The applications/xmonad.desktop file is still required.) However, see the xsession section below to continue using the classic ~/.xsession method to run a custom session.<br />
<br />
====A Simple Hybrid Alternative====<br />
There is also a hybrid method that seems to work much more simply and easily than the custom start script, while still allowing XMonad to be chosen as a separate session. <code>applications/xmonad.desktop</code> and <code>xsessions/xmonad.desktop</code> are created as above. And, as above, <code>xsessions/xmonad.desktop</code> points to a custom <code>xmonad.start</code> script. But, the contents of the xmonad.start script are simply the following: <br />
<pre><br />
export WINDOW_MANAGER=xmonad<br />
gnome-session<br />
</pre><br />
<br />
This gives all the bells and whistles of gnome, including integrated logout support, etc, while also allowing xmonad and gnome to be selected as separate sessions from the login screen. Note that if you go this road with Ubuntu 10.04 (tested with gnome 2.30.0), you will also need to unset the gconf windowmanager setting.<br />
<br />
<code>gconftool-2 -u /desktop/gnome/session/required_components/windowmanager</code><br />
<br />
That alone didn't work for me. I have this in my xmonad.start instead<br />
<pre><br />
gconftool-2 -t string -s /desktop/gnome/session/required_components/windowmanager xmonad<br />
gconftool-2 -t string -s /desktop/gnome/applications/window_manager/current xmonad<br />
</pre><br />
<br />
After startup I am running<br />
<pre><br />
killall compiz<br />
xmonad &<br />
</pre><br />
<br />
===Ubuntu===<br />
I had tried above methods described by "simple hybrid", but they are not staight forward and didn't work.<br />
<pre><br />
export WINDOW_MANAGER=/path to xmonad<br />
gnome-sesson<br />
</pre><br />
If once I execute "gnome-wm" manually, after that it works, I got xmonad integrated in gnome well. However, once I switch to my gnome session, and then return back to my xmonad session, the xmonad window manager isn't run, just as I log into the gnome session.<br />
<br />
After delving into gnome-wm script and some analysis and many try, I found out why the plain script did not work. Because I had turned on the "auto save gnome session" function, I guess gnome-session wouldn't call gnome-wm again when I change from gnome session to xmonad session.<br />
So I disable the save session function, and remove the files in <code>.config/gnome-session/saved-session/*</code>.<br />
<br />
Finally it works! This indirectly prove the above guess is right.<br />
Actually I had put this script to xmonad-custom.start, then I can have gnome and xmonad session seperated, and they don't interfere with the other. I think this method is simple yet elegant, and easy to understand.<br />
<br />
===Ubuntu Karmic===<br />
Follow the above general instructions. Most people will probably want to use the "simple hybrid method", .xsession, or use gconftool to replace metacity in a full gnome session running all the other supporting gnome apps. You may also wish to install xterm if you don't already have it, since it's the terminal used by the default xmonad setup, at least till you get the gnomeConfig up and running as discussed in later sections.<br />
<br />
====using xsession under karmic====<br />
<nowiki>*NOTE:</nowiki>Ubuntu Karmic Koala users still can use their ~/.xsession scripts to run xmonad. For this, you need:<br />
<br />
1. sudo mkdir /etc/X11/sessions<br />
<br />
2. put into /etc/X11/sessions/Xsessions.desktop:<br />
<pre><br />
[Desktop Entry]<br />
Name=Xsession<br />
Comment=This runs ~/.xsession<br />
Exec=/etc/X11/Xsession<br />
</pre><br />
<br />
3. Then Xsession entry will appear in gdm, and will work as it worked for many years.<br />
<br />
WINDOW_MANAGER variable looks still working, you can use smth like:<br />
<pre><br />
export WINDOW_MANAGER="/path/to/xmonad"<br />
exec gnome-session <br />
</pre><br />
in your ~/.xsession<br />
<br />
For more info on this, check gdm bug description at launchpad [https://bugs.launchpad.net/ubuntu/karmic/+source/gdm/+bug/398300].<br />
<br />
====xmonad-0.9 for karmic====<br />
[http://www.haskell.org/pipermail/xmonad/2009-November/009060.html This mailing list thread] has instructions to use a PPA for newer xmonad, dzen, xmobar.<br />
<br />
===Ubuntu Jaunty===<br />
At least 3 XMonad users have found that the <tt>~/.gnomerc</tt> will not work on Jaunty Ubuntu when one is upgrading from Intrepid; apparently the <tt>~/.gconf/</tt> directory is incompatible or something, so Gnome/Ubuntu will not read .gnomerc and any settings in it will be ignored. <br />
<br />
The work-around is essentially to remove .gconf entirely. On the next login, a fresh default .gconf will be created and .gnomerc will be read. This of course implies that one's settings and preferences will also be removed, and one will have to redo them. (Copying over selected directories from the old .gconf to the new one may or may not work.)<br />
<br />
Or alternatively, the following worked for me (without touching .gconf or .gnomerc or exports):<br />
Add an xmonad launcher in the gnome-session-properties and then execute:<br />
$ gconftool -t string -s /desktop/gnome/applications/window_manager/current xmonad<br />
$ gconftool -t string -s /desktop/gnome/session/required_components/windowmanager xmonad<br />
$ killall metacity; xmonad &<br />
<br />
Also make sure to add the /usr/share/applications/xmonad.desktop file shown above, if it's not already present. This lets gnome know that xmonad is a windowmanager and where to look for it.<br />
<br />
====newer haskell and xmonad for jaunty====<br />
[https://launchpad.net/~gspreemann/+archive/haskell gspreemann's PPA] has newer haskell toolchain without some of the setup problems others have had, as well as xmonad-0.9.<br />
<br />
===Ubuntu Intrepid===<br />
[http://ubuntuforums.org/showthread.php?t=975329 This forum thread] has instructions for making Gnome play nice with xmonad on intrepid.<br />
<br />
<br />
===Ubuntu Natty===<br />
<br />
On Natty you need to create a new gnome session description at<br />
<br />
/usr/share/gnome-session/sessions/xmonad.session which should look something like this<br />
<pre><br />
[GNOME Session]<br />
Name=Xmonad<br />
Required=windowmanager;panel;filemanager;<br />
Required-windowmanager=xmonad<br />
Required-panel=gnome-panel<br />
Required-filemanager=nautilus<br />
DefaultApps=gnome-settings-daemon;<br />
</pre><br />
<br />
You should also create a file at /usr/share/xsessions/xmonad.desktop with contents like this<br />
<br />
<pre><br />
[Desktop Entry]<br />
Name=XMonad<br />
Comment=Lightweight tiling window manager + Gnome<br />
Exec=gnome-session --session=xmonad<br />
Icon=<br />
Type=Application<br />
X-Ubuntu-Gettext-Domain=gnome-session-2.0<br />
</pre><br />
<br />
And then select the Xmonad session when logging in with GDM.<br />
<br />
I also had to uninstall the appmenu stuff to get my menus back for some reason. Not sure what the problem with the global menus are in Natty since the Gnome Classic session gets normal in-window menus and the appmenu panel still works. With xmonad it just seems totally broken.<br />
<br />
Alternatively, rather than create new .desktop and .session files, an unprivileged user may configure gnome-wm to use Xmonad as Gnome's window manager through GConf:<br />
<br />
gconftool --type string --set /desktop/gnome/session/required_components/windowmanager "xmonad"<br />
<br />
This worked in previous versions of Ubuntu but at present with Natty, if /usr/lib/nux/unity_support_test is not installed, an administrator may have to comment out or remove the IsRunnableHelper line from /usr/share/xsessions/gnome-classic.desktop:<br />
<br />
# IsRunnableHelper=/usr/lib/nux/unity_support_test --compiz<br />
<br />
Logging in using the "Ubuntu Classic" session will then launch Xmonad and all the other Gnome widgets used by gnome-session. See also [https://bugs.launchpad.net/ubuntu/+source/gnome-session/+bug/774357 Ubuntu Bug#774357].<br />
<br />
===Fedora===<br />
The Fedora xmonad package provides /usr/share/applications/xmonad.desktop<br />
and /usr/share/xsessions/xmonad.desktop, so the above generic instructions<br />
should just work (but not the "Simple Hybrid Alternative").<br />
<br />
====Fedora 10 and further links====<br />
[http://thread.gmane.org/gmane.comp.lang.haskell.xmonad/6557 This old mailing list thread] contains fedora 10 specific setup instructions, but also a bunch of other gnome setup links if you are having trouble with the above methods.<br />
<br />
===Using the startup applications menu to modify your gnome session===<br />
An alternative to using gconftool to change the window manager in a gnome session:<br />
<br />
On many distros you can replace metacity in your full gnome session by using the gnome menus to create a new item in the<br />
System>Preferences>Startup Applications menu Programs tab to run xmonad as<br />
window manager. (Disable "automatic saving of session components on logout" to use<br />
this setup method.)<br />
<br />
For example, for '''Name:''' you could use "Window Manager XMonad", then<br />
for '''Program:''' use <code>xmonad</code>. Un-check the old Metacity<br />
one (typically called Window Manager and using '''Program''' <code>gnome-wm</code>). Don't delete or over-write it so you can switch back if you want. Click the checkbox to turn on the new "Window Manager XMonad" entry instead, save your session, log out and log back in choosing gnome-session. If it's not already there, this will create the applications/xmonad.desktop file discussed above.<br />
(Not a great method for people who switch frequently between metacity, compiz, and xmonad.)<br />
<br />
==Configure Xmonad to interoperate with Gnome==<br />
<br />
<br />
[[Image:Screen-xmonad-gnome-darktheme4.jpg|200px|xmonad and gnome-panel|center]]<br />
<br />
=== Using the Config.Gnome module ===<br />
For xmonad-0.8 or greater, see [[Xmonad/Basic Desktop Environment Integration | Basic DE Integration]] for a simple three line <code>xmonad.hs</code> configuration that:<br />
* integrates docks and gnome-panel using ewmh's<br />
* allows gap-toggling<br />
* binds the gnome run dialog to mod-p, and mod-shift-q to save your session and logout <br />
* otherwise keeps xmonad defaults. <br />
<br />
It is a good starting point. You can then come back and add some of the features below once everything's working.<br />
<br />
Once the Config.Gnome module set up, you may want to customize these gnome settings.<br />
<br />
====Keys====<br />
Use [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Util-EZConfig.html EZConfig] to add keybindings. Note that you must use gnomeConfig whereever defaultConfig is mentioned.<br />
<haskell><br />
import XMonad<br />
import XMonad.Util.EZConfig<br />
main = xmonad $ gnomeConfig<br />
{ terminal = "urxvt"<br />
, modMask = mod4Mask -- set the mod key to the windows key<br />
}<br />
`additionalKeysP` <br />
[ ("M-m", spawn "echo 'Hi, mom!' | dzen2 -p 4")<br />
, ("M-<Backspace>", withFocused hide) -- N.B. this is an absurd thing to do<br />
]<br />
</haskell><br />
<br />
==== ManageHooks ====<br />
Be sure to include the default gnome manageHook when overriding manageHooks so that xmonad can leave a gap for gnome-panel:<br />
<haskell><br />
main = xmonad gnomeConfig<br />
{<br />
...<br />
, manageHook = composeAll<br />
[ manageHook gnomeConfig<br />
, title =? "foo" --> doShift "2"<br />
-- needs: import XMonad.Hooks.ManageHelpers (isFullscreen,doFullFloat)<br />
, isFullscreen --> doFullFloat<br />
]<br />
...<br />
}<br />
</haskell><br />
<br />
==== Layouts ====<br />
When overriding the default layouts, you must manually apply the desktopLayoutModifiers layout modifier.<br />
<haskell><br />
import XMonad.Config.Desktop (desktopLayoutModifiers)<br />
main = xmonad gnomeConfig<br />
{<br />
...<br />
, layoutHook = desktopLayoutModifiers (Tall 1 0.03 0.5 ||| Full)<br />
...<br />
}<br />
</haskell><br />
<br />
[[Image:screen-ohmega-tab-gnome-twopane.jpg|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
==Tweak Gnome to work better with Xmonad==<br />
<br />
These are a few steps that greatly improves the experience of running Xmonad under Gnome. Note that on some systems the binary <tt>gconftool</tt> is called <tt>gconftool-2</tt>.<br />
<br />
===Disable the Nautilus desktop===<br />
<br />
This step is not required, but some users prefer to disable the desktop. From the command line execute:<br />
<br />
gconftool --type boolean --set /apps/nautilus/preferences/show_desktop false<br />
<br />
(Using recent gnome and xmonad I found that it was necessary.)<br />
<br />
===Changing desktop background===<br />
<br />
If you need to change the workspace background programmatically (i.e. from some extension setting in xmonad's configuration file), you can use the command:<br />
<br />
gconftool --type string --set /desktop/gnome/background/picture_filename "/path/to/your/image.png"<br />
<br />
===Display XMonad logHook in gnome-panel===<br />
<br />
See [http://uhsure.com/xmonad-log-applet.html xmonad log applet] for a third party panel applet to display xmonad's logHook in gnome-panel via dbus. You will also need to install the [http://hackage.haskell.org/package/DBus DBus] package from hackage. For more detailed installation and setup instructions, see [[Installing xmonad log applet]].<br />
<br />
===Key bindings for switching desktops===<br />
<br />
====In 1 dimension: CycleWS====<br />
<br />
Gnome lays out the desktops in a row by default, and uses Ctrl+Alt+Left/Right for switching desktops left/right. To get similar behaviour in Xmonad, you need to add some keybindings. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-CycleWS.html XMonad.Actions.CycleWS] has some useful actions for cycling workspaces:<br />
<br />
<haskell><br />
main = xmonad gnomeConfig<br />
{ modMask = mod4Mask }<br />
`additionalKeysP`<br />
[<br />
...<br />
-- moving workspaces<br />
, ("M-<Left>", prevWS )<br />
, ("M-<Right>", nextWS )<br />
, ("M-S-<Left>", shiftToPrev )<br />
, ("M-S-<Right>", shiftToNext )<br />
]<br />
</haskell><br />
<br />
[[Image:Xmonad-screen-gnome-brownblack5.jpg|center|200px]]<br />
<br />
====In 2 dimensions: Plane====<br />
<br />
If Gnome is configured to lay out desktops in more than one line, it's possible to navigate with Ctrl+Alt+Up/Bottom also. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-Plane.html XMonad.Actions.Plane], available in the xmonad-0.8 or greater. The keybindings can be incorporated in with EZConfig as such:<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Config.Gnome<br />
import XMonad.Actions.Plane<br />
import XMonad.Util.EZConfig<br />
import qualified Data.Map as M<br />
main = xmonad $ gnomeConfig<br />
{ terminal = "urxvt"<br />
, modMask = mod4Mask -- set the mod key to the windows key<br />
}<br />
`additionalKeysP` <br />
[ ("M-m", spawn "echo 'Hi, mom!' | dzen2 -p 4")<br />
, ("M-<Backspace>", withFocused hide) -- N.B. this is an absurd thing to do<br />
]<br />
`additionalKeys`<br />
-- NOTE: planeKeys requires xmonad-0.9 or greater<br />
M.toList (planeKeys mod4Mask GConf Finite)<br />
</haskell><br />
<br />
[http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-WorkspaceCursors.html Actions.WorkspaceCursors] can be used to navigate workspaces arranged in three or more dimensions.<br />
<br />
===Logging out of the Gnome session vs. quitting Xmonad===<br />
<br />
When running Xmonad as above, it is launched by ''gnome-session'', the "Gnome session manager." Quitting Xmonad in this situation ''will not log you out.'' If you make no changes, using mod+shift+q will leave you with all your applications still running and no window manager to navigate them! There are several remedies for this.<br />
<br />
* Run 'xmonad &' from a command line.<br />
* Quit X using Alt-Ctrl-Backspace.<br />
* Rebind mod+shift+q<br />
<br />
====Rebind mod+shift+q====<br />
To avoid exiting Xmonad and being stuck with no window manager, you might rebind mod+shift+q to execute the gnome-session "log out" functionality. This will of course prevent you from "quitting" Xmonad in the normal way, which may or may not be desirable. When the session logs out, the X11 server is terminated, which will in turn terminate all running X11 applications, including Xmonad.<br />
<br />
(TODO: improve the description of changes that need to be made here.)<br />
<br />
, ("M-S-q", spawn "gnome-session-save --gui --logout-dialog") )<br />
<br />
==== Configure rudimentary power management ====<br />
<br />
It might be useful to include bindings for hibernation, screen locking, and other assorted basic functions. While Gnome provides the capability to do so, it's functionality is limited (Mod4 cannot be used as a mask), and you may prefer to have Xmonad manage it. Fortunately, these things can be controlled from the command line, and the following bindings may help. (NB: These are for one handed use of Dvorak control; make sure to bind them to something more fitting. They also use mod1 not to clash with mod4 by accident.)<br />
<br />
-- Lock Screen<br />
, ("M-S-l", spawn "gnome-screensaver-command -l")<br />
-- Logout<br />
, ("M1-M-S-l", spawn "gnome-session-save --gui --kill")<br />
-- Sleep<br />
, ("M1-S-'", spawn "gnome-power-cmd.sh suspend")<br />
-- Reboot<br />
, ("M1-S-,", spawn "gnome-power-cmd.sh reboot")<br />
-- Deep Sleep<br />
, ("M1-S-.", spawn "gnome-power-cmd.sh hibernate")<br />
-- Death<br />
, ("M1-S-p", spawn "gnome-power-cmd.sh shutdown")<br />
<br />
<br />
====Configure the session manager to relaunch Xmonad====<br />
You can configure the Gnome Session Manager to restart Xmonad whenever it exits (i.e., if you haven't rebound mod-shift-q.) This is rarely a useful feature as xmonad has its builtin compile-and-restart (mod-q), but it will prevent you from accidentally ending up with no window manager and no way to launch one.<br />
<br />
However, as of version 0.7, XMonad does not itself communicate with any session managers in they way they prefer, so setting things up takes some hackery:<br />
<br />
(TBD: steps, see also [[Xmonad/Using_xmonad_in_Gnome/0.5#Preparing_your_GNOME_session]])<br />
<br />
===Modify terminal===<br />
<br />
If you use prompts, e.g. [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Prompt-Ssh.html SshPrompt], due to an issue with how the terminal is invoked (see [http://code.google.com/p/xmonad/issues/detail?id=254]), you will need to either wrap gnome-terminal as described [http://xmonad.googlecode.com/issues/attachment?aid=-8330341117914417101&name=gnome-terminal-wrapper&token=420eee337a501da44ae2fe29b5950455 here] and then do something like<br />
<br />
main = xmonad $ gnomeConfig { terminal = "/path/to/gnome-terminal-wrapper" }<br />
<br />
or use a different terminal altogether<br />
<br />
main = xmonad $ gnomeConfig { terminal = "xterm" }</div>Datagrokhttps://wiki.haskell.org/index.php?title=Xmonad/Using_xmonad_in_Gnome&diff=39719Xmonad/Using xmonad in Gnome2011-05-01T18:19:56Z<p>Datagrok: /* Ubuntu Natty */ Configuration in Ubuntu 11.04</p>
<hr />
<div>{{xmonad}}<br />
[[Category:XMonad]]<br />
<br />
==Introduction==<br />
<br />
[[Image:Screen-nomeata-ewhm.png|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
Xmonad makes an excellent drop-in replacement for Gnome's default window manager (metacity) giving you a slick tiling window manager. This guide will help you set up Gnome to use Xmonad 0.9.<br />
<br />
This is an update to the previous page on [[Xmonad/Using xmonad in Gnome/0.6]].<br />
<br />
==Setting up Gnome to use Xmonad==<br />
Overall most people on a variety of distros seem to get best results by using an <code>applications/xmonad.desktop</code> file and running a full gnome session replacing only gnome's window manager. They tell gnome-session to use xmonad instead of metacity by running:<br />
<pre># gconftool-2 -s /desktop/gnome/session/required_components/windowmanager xmonad --type string</pre> Doing this from inside a full gnome session will replace metacity with xmonad and continue to run all the other gnome daemons and apps. See below to set up a separate customized xmonad or ~/.xsession based session separate from your gnome one.<br />
<br />
For xmonad to start automatically on login you need an <code>applications/xmonad.desktop</code> file on your system. If your distro doesn't provide it, create the following file:<br />
<pre><br />
$ cat /usr/share/applications/xmonad.desktop<br />
[Desktop Entry]<br />
Type=Application<br />
Encoding=UTF-8<br />
Name=Xmonad<br />
Exec=xmonad<br />
NoDisplay=true<br />
X-GNOME-WMName=Xmonad<br />
X-GNOME-Autostart-Phase=WindowManager<br />
X-GNOME-Provides=windowmanager<br />
X-GNOME-Autostart-Notify=false<br />
</pre><br />
Alternatively, you can create the above as <code>~/.local/share/applications/xmonad.desktop</code> for the current user only.<br />
<br />
To run a separate xmonad session in addition to gnome session(s) you need an <code>xsessions/xmonad.desktop</code> file. To start a minimal xmonad session from gdm (see notes* below to run more than just xmonad on login), create the following file:<br />
<pre><br />
$ cat /usr/share/xsessions/xmonad.desktop <br />
[Desktop Entry]<br />
Encoding=UTF-8<br />
Name=XMonad<br />
Comment=Lightweight tiling window manager<br />
Exec=xmonad<br />
Icon=xmonad.png<br />
Type=XSession<br />
</pre><br />
<br />
Your display manager must also be able to find the xmonad executable. If you are not using your distro package manager to install xmonad, for best results configure your build to install xmonad to a location in the system environment like /usr/local/bin/.<br />
<br />
<nowiki>*NOTE:</nowiki> Using an <code>xsessions/xmonad.desktop</code> file that runs a custom script <code>xmonad.start</code> instead of just plain xmonad is also how to add other startup actions to the gdm xmonad.desktop startup, such as starting gnome daemons, apps, etc. See<br />
[http://arjuna.deltoso.net/articoli/my-configuration-of-xmonad-window-manager-with-xmobar-and-trayer/en arjuna's blog] for more details. (simono says: Creating <code>/usr/share/xsessions/xmonad.desktop</code> and <code>/usr/local/bin/xmonad.start</code> files is the preferred method for configuring an alternative window manager. The applications/xmonad.desktop file is still required.) However, see the xsession section below to continue using the classic ~/.xsession method to run a custom session.<br />
<br />
====A Simple Hybrid Alternative====<br />
There is also a hybrid method that seems to work much more simply and easily than the custom start script, while still allowing XMonad to be chosen as a separate session. <code>applications/xmonad.desktop</code> and <code>xsessions/xmonad.desktop</code> are created as above. And, as above, <code>xsessions/xmonad.desktop</code> points to a custom <code>xmonad.start</code> script. But, the contents of the xmonad.start script are simply the following: <br />
<pre><br />
export WINDOW_MANAGER=xmonad<br />
gnome-session<br />
</pre><br />
<br />
This gives all the bells and whistles of gnome, including integrated logout support, etc, while also allowing xmonad and gnome to be selected as separate sessions from the login screen. Note that if you go this road with Ubuntu 10.04 (tested with gnome 2.30.0), you will also need to unset the gconf windowmanager setting.<br />
<br />
<code>gconftool-2 -u /desktop/gnome/session/required_components/windowmanager</code><br />
<br />
That alone didn't work for me. I have this in my xmonad.start instead<br />
<pre><br />
gconftool-2 -t string -s /desktop/gnome/session/required_components/windowmanager xmonad<br />
gconftool-2 -t string -s /desktop/gnome/applications/window_manager/current xmonad<br />
</pre><br />
<br />
After startup I am running<br />
<pre><br />
killall compiz<br />
xmonad &<br />
</pre><br />
<br />
===Ubuntu===<br />
I had tried above methods described by "simple hybrid", but they are not staight forward and didn't work.<br />
<pre><br />
export WINDOW_MANAGER=/path to xmonad<br />
gnome-sesson<br />
</pre><br />
If once I execute "gnome-wm" manually, after that it works, I got xmonad integrated in gnome well. However, once I switch to my gnome session, and then return back to my xmonad session, the xmonad window manager isn't run, just as I log into the gnome session.<br />
<br />
After delving into gnome-wm script and some analysis and many try, I found out why the plain script did not work. Because I had turned on the "auto save gnome session" function, I guess gnome-session wouldn't call gnome-wm again when I change from gnome session to xmonad session.<br />
So I disable the save session function, and remove the files in <code>.config/gnome-session/saved-session/*</code>.<br />
<br />
Finally it works! This indirectly prove the above guess is right.<br />
Actually I had put this script to xmonad-custom.start, then I can have gnome and xmonad session seperated, and they don't interfere with the other. I think this method is simple yet elegant, and easy to understand.<br />
<br />
===Ubuntu Karmic===<br />
Follow the above general instructions. Most people will probably want to use the "simple hybrid method", .xsession, or use gconftool to replace metacity in a full gnome session running all the other supporting gnome apps. You may also wish to install xterm if you don't already have it, since it's the terminal used by the default xmonad setup, at least till you get the gnomeConfig up and running as discussed in later sections.<br />
<br />
====using xsession under karmic====<br />
<nowiki>*NOTE:</nowiki>Ubuntu Karmic Koala users still can use their ~/.xsession scripts to run xmonad. For this, you need:<br />
<br />
1. sudo mkdir /etc/X11/sessions<br />
<br />
2. put into /etc/X11/sessions/Xsessions.desktop:<br />
<pre><br />
[Desktop Entry]<br />
Name=Xsession<br />
Comment=This runs ~/.xsession<br />
Exec=/etc/X11/Xsession<br />
</pre><br />
<br />
3. Then Xsession entry will appear in gdm, and will work as it worked for many years.<br />
<br />
WINDOW_MANAGER variable looks still working, you can use smth like:<br />
<pre><br />
export WINDOW_MANAGER="/path/to/xmonad"<br />
exec gnome-session <br />
</pre><br />
in your ~/.xsession<br />
<br />
For more info on this, check gdm bug description at launchpad [https://bugs.launchpad.net/ubuntu/karmic/+source/gdm/+bug/398300].<br />
<br />
====xmonad-0.9 for karmic====<br />
[http://www.haskell.org/pipermail/xmonad/2009-November/009060.html This mailing list thread] has instructions to use a PPA for newer xmonad, dzen, xmobar.<br />
<br />
===Ubuntu Jaunty===<br />
At least 3 XMonad users have found that the <tt>~/.gnomerc</tt> will not work on Jaunty Ubuntu when one is upgrading from Intrepid; apparently the <tt>~/.gconf/</tt> directory is incompatible or something, so Gnome/Ubuntu will not read .gnomerc and any settings in it will be ignored. <br />
<br />
The work-around is essentially to remove .gconf entirely. On the next login, a fresh default .gconf will be created and .gnomerc will be read. This of course implies that one's settings and preferences will also be removed, and one will have to redo them. (Copying over selected directories from the old .gconf to the new one may or may not work.)<br />
<br />
Or alternatively, the following worked for me (without touching .gconf or .gnomerc or exports):<br />
Add an xmonad launcher in the gnome-session-properties and then execute:<br />
$ gconftool -t string -s /desktop/gnome/applications/window_manager/current xmonad<br />
$ gconftool -t string -s /desktop/gnome/session/required_components/windowmanager xmonad<br />
$ killall metacity; xmonad &<br />
<br />
Also make sure to add the /usr/share/applications/xmonad.desktop file shown above, if it's not already present. This lets gnome know that xmonad is a windowmanager and where to look for it.<br />
<br />
====newer haskell and xmonad for jaunty====<br />
[https://launchpad.net/~gspreemann/+archive/haskell gspreemann's PPA] has newer haskell toolchain without some of the setup problems others have had, as well as xmonad-0.9.<br />
<br />
===Ubuntu Intrepid===<br />
[http://ubuntuforums.org/showthread.php?t=975329 This forum thread] has instructions for making Gnome play nice with xmonad on intrepid.<br />
<br />
<br />
===Ubuntu Natty===<br />
<br />
On Natty you need to create a new gnome session description at<br />
<br />
/usr/share/gnome-session/sessions/xmonad.session which should look something like this<br />
<pre><br />
[GNOME Session]<br />
Name=Xmonad<br />
Required=windowmanager;panel;filemanager;<br />
Required-windowmanager=xmonad<br />
Required-panel=gnome-panel<br />
Required-filemanager=nautilus<br />
DefaultApps=gnome-settings-daemon;<br />
</pre><br />
<br />
You should also create a file at /usr/share/xsessions/xmonad.desktop with contents like this<br />
<br />
<pre><br />
[Desktop Entry]<br />
Name=XMonad<br />
Comment=Lightweight tiling window manager + Gnome<br />
Exec=gnome-session --session=xmonad<br />
Icon=<br />
Type=Application<br />
X-Ubuntu-Gettext-Domain=gnome-session-2.0<br />
</pre><br />
<br />
And then select the Xmonad session when logging in with GDM.<br />
<br />
I also had to uninstall the appmenu stuff to get my menus back for some reason. Not sure what the problem with the global menus are in Natty since the Gnome Classic session gets normal in-window menus and the appmenu panel still works. With xmonad it just seems totally broken.<br />
<br />
Alternatively, rather than create new .desktop and .session files, an unpriveleged user may configure gnome-wm to use Xmonad as Gnome's window manager by setting the GConf value for /desktop/gnome/session/required_components/windowmanager to 'xmonad'. This worked in previous versions of Ubuntu but at present with Natty an administrator may have to comment out or remove the IsRunnableHelper line from /usr/share/xsessions/gnome-classic.desktop. Logging in using the "Ubuntu Classic" session will then launch Xmonad and all the other Gnome widgets used by gnome-session. See also [https://bugs.launchpad.net/ubuntu/+source/gnome-session/+bug/774357 Ubuntu Bug#774357].<br />
<br />
===Fedora===<br />
The Fedora xmonad package provides /usr/share/applications/xmonad.desktop<br />
and /usr/share/xsessions/xmonad.desktop, so the above generic instructions<br />
should just work (but not the "Simple Hybrid Alternative").<br />
<br />
====Fedora 10 and further links====<br />
[http://thread.gmane.org/gmane.comp.lang.haskell.xmonad/6557 This old mailing list thread] contains fedora 10 specific setup instructions, but also a bunch of other gnome setup links if you are having trouble with the above methods.<br />
<br />
===Using the startup applications menu to modify your gnome session===<br />
An alternative to using gconftool to change the window manager in a gnome session:<br />
<br />
On many distros you can replace metacity in your full gnome session by using the gnome menus to create a new item in the<br />
System>Preferences>Startup Applications menu Programs tab to run xmonad as<br />
window manager. (Disable "automatic saving of session components on logout" to use<br />
this setup method.)<br />
<br />
For example, for '''Name:''' you could use "Window Manager XMonad", then<br />
for '''Program:''' use <code>xmonad</code>. Un-check the old Metacity<br />
one (typically called Window Manager and using '''Program''' <code>gnome-wm</code>). Don't delete or over-write it so you can switch back if you want. Click the checkbox to turn on the new "Window Manager XMonad" entry instead, save your session, log out and log back in choosing gnome-session. If it's not already there, this will create the applications/xmonad.desktop file discussed above.<br />
(Not a great method for people who switch frequently between metacity, compiz, and xmonad.)<br />
<br />
==Configure Xmonad to interoperate with Gnome==<br />
<br />
<br />
[[Image:Screen-xmonad-gnome-darktheme4.jpg|200px|xmonad and gnome-panel|center]]<br />
<br />
=== Using the Config.Gnome module ===<br />
For xmonad-0.8 or greater, see [[Xmonad/Basic Desktop Environment Integration | Basic DE Integration]] for a simple three line <code>xmonad.hs</code> configuration that:<br />
* integrates docks and gnome-panel using ewmh's<br />
* allows gap-toggling<br />
* binds the gnome run dialog to mod-p, and mod-shift-q to save your session and logout <br />
* otherwise keeps xmonad defaults. <br />
<br />
It is a good starting point. You can then come back and add some of the features below once everything's working.<br />
<br />
Once the Config.Gnome module set up, you may want to customize these gnome settings.<br />
<br />
====Keys====<br />
Use [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Util-EZConfig.html EZConfig] to add keybindings. Note that you must use gnomeConfig whereever defaultConfig is mentioned.<br />
<haskell><br />
import XMonad<br />
import XMonad.Util.EZConfig<br />
main = xmonad $ gnomeConfig<br />
{ terminal = "urxvt"<br />
, modMask = mod4Mask -- set the mod key to the windows key<br />
}<br />
`additionalKeysP` <br />
[ ("M-m", spawn "echo 'Hi, mom!' | dzen2 -p 4")<br />
, ("M-<Backspace>", withFocused hide) -- N.B. this is an absurd thing to do<br />
]<br />
</haskell><br />
<br />
==== ManageHooks ====<br />
Be sure to include the default gnome manageHook when overriding manageHooks so that xmonad can leave a gap for gnome-panel:<br />
<haskell><br />
main = xmonad gnomeConfig<br />
{<br />
...<br />
, manageHook = composeAll<br />
[ manageHook gnomeConfig<br />
, title =? "foo" --> doShift "2"<br />
-- needs: import XMonad.Hooks.ManageHelpers (isFullscreen,doFullFloat)<br />
, isFullscreen --> doFullFloat<br />
]<br />
...<br />
}<br />
</haskell><br />
<br />
==== Layouts ====<br />
When overriding the default layouts, you must manually apply the desktopLayoutModifiers layout modifier.<br />
<haskell><br />
import XMonad.Config.Desktop (desktopLayoutModifiers)<br />
main = xmonad gnomeConfig<br />
{<br />
...<br />
, layoutHook = desktopLayoutModifiers (Tall 1 0.03 0.5 ||| Full)<br />
...<br />
}<br />
</haskell><br />
<br />
[[Image:screen-ohmega-tab-gnome-twopane.jpg|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
==Tweak Gnome to work better with Xmonad==<br />
<br />
These are a few steps that greatly improves the experience of running Xmonad under Gnome. Note that on some systems the binary <tt>gconftool</tt> is called <tt>gconftool-2</tt>.<br />
<br />
===Disable the Nautilus desktop===<br />
<br />
This step is not required, but some users prefer to disable the desktop. From the command line execute:<br />
<br />
gconftool --type boolean --set /apps/nautilus/preferences/show_desktop false<br />
<br />
(Using recent gnome and xmonad I found that it was necessary.)<br />
<br />
===Changing desktop background===<br />
<br />
If you need to change the workspace background programmatically (i.e. from some extension setting in xmonad's configuration file), you can use the command:<br />
<br />
gconftool --type string --set /desktop/gnome/background/picture_filename "/path/to/your/image.png"<br />
<br />
===Display XMonad logHook in gnome-panel===<br />
<br />
See [http://uhsure.com/xmonad-log-applet.html xmonad log applet] for a third party panel applet to display xmonad's logHook in gnome-panel via dbus. You will also need to install the [http://hackage.haskell.org/package/DBus DBus] package from hackage. For more detailed installation and setup instructions, see [[Installing xmonad log applet]].<br />
<br />
===Key bindings for switching desktops===<br />
<br />
====In 1 dimension: CycleWS====<br />
<br />
Gnome lays out the desktops in a row by default, and uses Ctrl+Alt+Left/Right for switching desktops left/right. To get similar behaviour in Xmonad, you need to add some keybindings. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-CycleWS.html XMonad.Actions.CycleWS] has some useful actions for cycling workspaces:<br />
<br />
<haskell><br />
main = xmonad gnomeConfig<br />
{ modMask = mod4Mask }<br />
`additionalKeysP`<br />
[<br />
...<br />
-- moving workspaces<br />
, ("M-<Left>", prevWS )<br />
, ("M-<Right>", nextWS )<br />
, ("M-S-<Left>", shiftToPrev )<br />
, ("M-S-<Right>", shiftToNext )<br />
]<br />
</haskell><br />
<br />
[[Image:Xmonad-screen-gnome-brownblack5.jpg|center|200px]]<br />
<br />
====In 2 dimensions: Plane====<br />
<br />
If Gnome is configured to lay out desktops in more than one line, it's possible to navigate with Ctrl+Alt+Up/Bottom also. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-Plane.html XMonad.Actions.Plane], available in the xmonad-0.8 or greater. The keybindings can be incorporated in with EZConfig as such:<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Config.Gnome<br />
import XMonad.Actions.Plane<br />
import XMonad.Util.EZConfig<br />
import qualified Data.Map as M<br />
main = xmonad $ gnomeConfig<br />
{ terminal = "urxvt"<br />
, modMask = mod4Mask -- set the mod key to the windows key<br />
}<br />
`additionalKeysP` <br />
[ ("M-m", spawn "echo 'Hi, mom!' | dzen2 -p 4")<br />
, ("M-<Backspace>", withFocused hide) -- N.B. this is an absurd thing to do<br />
]<br />
`additionalKeys`<br />
-- NOTE: planeKeys requires xmonad-0.9 or greater<br />
M.toList (planeKeys mod4Mask GConf Finite)<br />
</haskell><br />
<br />
[http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-WorkspaceCursors.html Actions.WorkspaceCursors] can be used to navigate workspaces arranged in three or more dimensions.<br />
<br />
===Logging out of the Gnome session vs. quitting Xmonad===<br />
<br />
When running Xmonad as above, it is launched by ''gnome-session'', the "Gnome session manager." Quitting Xmonad in this situation ''will not log you out.'' If you make no changes, using mod+shift+q will leave you with all your applications still running and no window manager to navigate them! There are several remedies for this.<br />
<br />
* Run 'xmonad &' from a command line.<br />
* Quit X using Alt-Ctrl-Backspace.<br />
* Rebind mod+shift+q<br />
<br />
====Rebind mod+shift+q====<br />
To avoid exiting Xmonad and being stuck with no window manager, you might rebind mod+shift+q to execute the gnome-session "log out" functionality. This will of course prevent you from "quitting" Xmonad in the normal way, which may or may not be desirable. When the session logs out, the X11 server is terminated, which will in turn terminate all running X11 applications, including Xmonad.<br />
<br />
(TODO: improve the description of changes that need to be made here.)<br />
<br />
, ("M-S-q", spawn "gnome-session-save --gui --logout-dialog") )<br />
<br />
==== Configure rudimentary power management ====<br />
<br />
It might be useful to include bindings for hibernation, screen locking, and other assorted basic functions. While Gnome provides the capability to do so, it's functionality is limited (Mod4 cannot be used as a mask), and you may prefer to have Xmonad manage it. Fortunately, these things can be controlled from the command line, and the following bindings may help. (NB: These are for one handed use of Dvorak control; make sure to bind them to something more fitting. They also use mod1 not to clash with mod4 by accident.)<br />
<br />
-- Lock Screen<br />
, ("M-S-l", spawn "gnome-screensaver-command -l")<br />
-- Logout<br />
, ("M1-M-S-l", spawn "gnome-session-save --gui --kill")<br />
-- Sleep<br />
, ("M1-S-'", spawn "gnome-power-cmd.sh suspend")<br />
-- Reboot<br />
, ("M1-S-,", spawn "gnome-power-cmd.sh reboot")<br />
-- Deep Sleep<br />
, ("M1-S-.", spawn "gnome-power-cmd.sh hibernate")<br />
-- Death<br />
, ("M1-S-p", spawn "gnome-power-cmd.sh shutdown")<br />
<br />
<br />
====Configure the session manager to relaunch Xmonad====<br />
You can configure the Gnome Session Manager to restart Xmonad whenever it exits (i.e., if you haven't rebound mod-shift-q.) This is rarely a useful feature as xmonad has its builtin compile-and-restart (mod-q), but it will prevent you from accidentally ending up with no window manager and no way to launch one.<br />
<br />
However, as of version 0.7, XMonad does not itself communicate with any session managers in they way they prefer, so setting things up takes some hackery:<br />
<br />
(TBD: steps, see also [[Xmonad/Using_xmonad_in_Gnome/0.5#Preparing_your_GNOME_session]])<br />
<br />
===Modify terminal===<br />
<br />
If you use prompts, e.g. [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Prompt-Ssh.html SshPrompt], due to an issue with how the terminal is invoked (see [http://code.google.com/p/xmonad/issues/detail?id=254]), you will need to either wrap gnome-terminal as described [http://xmonad.googlecode.com/issues/attachment?aid=-8330341117914417101&name=gnome-terminal-wrapper&token=420eee337a501da44ae2fe29b5950455 here] and then do something like<br />
<br />
main = xmonad $ gnomeConfig { terminal = "/path/to/gnome-terminal-wrapper" }<br />
<br />
or use a different terminal altogether<br />
<br />
main = xmonad $ gnomeConfig { terminal = "xterm" }</div>Datagrokhttps://wiki.haskell.org/index.php?title=Talk:Xmonad/Using_xmonad_in_Gnome&diff=20410Talk:Xmonad/Using xmonad in Gnome2008-04-04T09:08:27Z<p>Datagrok: reply to Thayer</p>
<hr />
<div>Excellent update! I came back to re-install xmonad to my joy found that all the instruction were already updated! --Jevin<br />
<br />
Are these instructions for 0.6 or 0.7? The first paragraph says that these are 0.6 but there has been a lot of changes in the page since the release of 0.7. I am confused --[[User:Adityam|Adityam]]<br />
: I think everything mentioned should work for 0.6, but I have not double-checked to be sure. Give it a try. &mdash;[[User:Datagrok|Datagrok]]<br />
<br />
:: It was easier to just install 0.7 :) --[[User:Adityam|Adityam]]<br />
<br />
I'd like to revert the [http://haskell.org/haskellwiki/?title=Xmonad/Using_xmonad_in_Gnome&diff=20393&oldid=20383 recent changes by Thayer]; I think a FAQ should link to canonical information in categorized pages rather than the other way around. (Also, Thayer did not update the language when cut+pasting to the FAQ!) If there is an issue about duplicating content, I think there should be a new page created for common content among Gnome/KDE/XFCE/etc environments. Better yet we should link to the module docs ([http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-ManageDocks.html for example]) rather than duplicate it many times on the wiki. If there is an issue with the content of the module docs, we should fix them; patching via darcs is nearly as easy as wiki-editing. Thoughts? &mdash;[[User:Datagrok|Datagrok]] 15:10, 3 April 2008 (UTC)<br />
<br />
: I'm not sure what 'language' you are referring to, as I did update the title and text to be more appropriate. Did I miss something less obvious? I'm happy to fix it.<br />
<br />
:: I was referring to: "''ManageDocks'' has been enabled in the example configuration above," which only makes sense in the context on the Gnome page. I've overreacted, thinking that someone had been careless with my careful improvements, and then wandered off. Thanks for taking the trouble to consider my complaints. :-) &mdash;[[User:Datagrok|Datagrok]]<br />
<br />
: As for reverting the changes, I'll let someone else make that call, but what I will say is that it doesn't make much sense to include instructions on avoidStruts only under GNOME. I don't use GNOME, but I definitely need avoidStruts info, as do KDE users and for that matter anyone not running a DE period. I placed it in the FAQ simply because it was a more appropriate place than the GNOME page and it didn't quite feel like a 'config tip' to me. I agree that the FAQ should be kept brief and to the point, so perhaps we ''should'' reference the module docs instead, so long as they contain a layman's implementation. &mdash;[[User:Thayer|Thayer]] 17:29, 2008-04-03 (PST)<br />
<br />
:: I'll suggest a "layman's implementation" patch to the module docs that we can link to from both the FAQ and the various DE pages, if someone else doesn't do it first. If that patch is rejected let's build a page for the content that the DEs have in common. &mdash;[[User:Datagrok|Datagrok]] 09:08, 4 April 2008 (UTC)</div>Datagrokhttps://wiki.haskell.org/index.php?title=Talk:Xmonad/Using_xmonad_in_Gnome&diff=20403Talk:Xmonad/Using xmonad in Gnome2008-04-03T15:10:45Z<p>Datagrok: Duplicating content between Gnome page / KDE page / FAQ / module docs?</p>
<hr />
<div>Excellent update! I came back to re-install xmonad to my joy found that all the instruction were already updated! --Jevin<br />
<br />
Are these instructions for 0.6 or 0.7? The first paragraph says that these are 0.6 but there has been a lot of changes in the page since the release of 0.7. I am confused --[[User:Adityam|Adityam]]<br />
: I think everything mentioned should work for 0.6, but I have not double-checked to be sure. Give it a try. &mdash;[[User:Datagrok|Datagrok]]<br />
<br />
:: It was easier to just install 0.7 :) --[[User:Adityam|Adityam]]<br />
<br />
I'd like to revert the [http://haskell.org/haskellwiki/?title=Xmonad/Using_xmonad_in_Gnome&diff=20393&oldid=20383 recent changes by Thayer]; I think a FAQ should link to canonical information in categorized pages rather than the other way around. (Also, Thayer did not update the language when cut+pasting to the FAQ!) If there is an issue about duplicating content, I think there should be a new page created for common content among Gnome/KDE/XFCE/etc environments. Better yet we should link to the module docs ([http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-ManageDocks.html for example]) rather than duplicate it many times on the wiki. If there is an issue with the content of the module docs, we should fix them; patching via darcs is nearly as easy as wiki-editing. Thoughts? &mdash;[[User:Datagrok|Datagrok]] 15:10, 3 April 2008 (UTC)</div>Datagrokhttps://wiki.haskell.org/index.php?title=Talk:Xmonad/Using_xmonad_in_Gnome&diff=20384Talk:Xmonad/Using xmonad in Gnome2008-04-02T11:25:38Z<p>Datagrok: .7 vs. .6</p>
<hr />
<div>Excellent update! I came back to re-install xmonad to my joy found that all the instruction were already updated! --Jevin<br />
<br />
Are these instructions for 0.6 or 0.7? The first paragraph says that these are 0.6 but there has been a lot of changes in the page since the release of 0.7. I am confused --[[User:Adityam|Adityam]]<br />
: I think everything mentioned should work for 0.6, but I have not double-checked to be sure. Give it a try. &mdash;[[User:Datagrok|Datagrok]]</div>Datagrokhttps://wiki.haskell.org/index.php?title=Xmonad/Using_xmonad_in_Gnome&diff=20383Xmonad/Using xmonad in Gnome2008-04-02T11:14:53Z<p>Datagrok: link to probably working instructions</p>
<hr />
<div>{{xmonad}}<br />
[[Category:XMonad]]<br />
<br />
==Introduction==<br />
<br />
[[Image:Screen-nomeata-ewhm.png|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
Xmonad makes an excellent drop-in replacement for Gnome's default window manager (metacity) giving you a slick tiling window manager. This guide will help you set up Gnome to use Xmonad 0.6.<br />
<br />
This is an update to the previous page on [[Xmonad/Using xmonad in Gnome/0.5]], <br />
which in turn was an update to the<br />
[http://xmonad.org/gnome.html original page on the subject].<br />
<br />
==Setting up Gnome to use Xmonad==<br />
<br />
The easiest way is to let Gnome start Xmonad itself by setting the environment variable WINDOW_MANAGER to point to the xmonad executable before the Gnome session manager starts. On most systems, this means modifying one of ''~/.xprofile'' or ''~/.gnomerc'' to contain:<br />
<br />
export WINDOW_MANAGER=xmonad<br />
<br />
If the binary is not in one of the directories in your $PATH, you must give the full path, i.e.:<br />
<br />
export WINDOW_MANAGER=${HOME}/bin/xmonad<br />
<br />
==Configure Xmonad to interoperate with Gnome==<br />
<br />
Put this in ''~/.xmonad/xmonad.hs'':<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Hooks.ManageDocks<br />
import XMonad.Hooks.EwmhDesktops<br />
<br />
main = xmonad defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, logHook = ewmhDesktopsLogHook<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
, modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
This should set up Xmonad to make space for Gnome's panel and status bar automatically. Note that this requires xmonad-contrib to be installed.<br />
<br />
Having done this, you should now be able to use Gnome with Xmonad, and most things will work. At the time of writing, there are a couple of things that don't fully work: clicking on the taskbar to select a window doesn't focus the window, and clicking on the panel to switch desktops doesn't. Of course you can use the standard Xmonad keys to perform these actions instead. <br />
<br />
Explanations of the various options are given below, along with some other things you might want to tweak.<br />
<br />
[[Image:screen-ohmega-tab-gnome-twopane.jpg|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
==Tweak Gnome to work better with Xmonad==<br />
<br />
These are a few steps that greatly improves the experience of running Xmonad under Gnome. Note that on some systems the binary <tt>gconftool</tt> is called <tt>gconftool-2</tt>.<br />
<br />
===Disable the Nautilus desktop===<br />
<br />
From the command line execute:<br />
<br />
gconftool --type boolean --set /apps/nautilus/preferences/show_desktop false<br />
<br />
===Changing desktop background===<br />
<br />
If you need to change the workspace background programmatically (i.e. from some extension setting in xmonad's configuration file), you can use the command:<br />
<br />
gconftool --type string --set /desktop/gnome/background/picture_filename "/path/to/your/image.png"<br />
<br />
===Fixing the pointer===<br />
<br />
If you're not using the Gnome Display Manager, after switching to Xmonad you might notice that the default pointer isn't the one you chose in your beautiful Gnome theme. The way to address this is to run ''xsetroot'' during session startup. Open the session configuration dialogue (''System -> Preferences -> Sessions''). Add a new startup program, choose any name and comment you want but make the command <br />
<br />
/usr/bin/xsetroot -cursor_name left_ptr<br />
<br />
==Tips on configuring Xmonad==<br />
<br />
Allthe configuration is done in <tt>~/.xmonad/xmonad.hs</tt>.<br />
<br />
===Change the mod key===<br />
<br />
The default ''mod key'' is ''alt'', which conflicts with Gnome keybindings. In order to use be able to use the keyboard to e.g. getting rid of dialogues we rebind it to the left ''logo key'':<br />
<br />
<haskell><br />
main = xmonad defaultConfig<br />
{ modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
===Make space for the panel===<br />
<br />
[http://hackage.haskell.org/packages/archive/xmonad-contrib/0.5/doc/html/XMonad-Hooks-ManageDocks.html ManageDocks] makes it possible for Xmonad to work with panels in the way they expect, automatically leaving the appropriate amount of room for them at the edges of the screen. ''ManageDocks'' has been enabled in the example configuration above. By itself, configuration looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.ManageDocks<br />
main = xmonad defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
}<br />
</haskell><br />
<br />
Prior to version 0.7, Xmonad alternatively supported a ''gaps'' option, configured like this:<br />
<br />
<haskell><br />
main = xmonad defaultConfig<br />
{ defaultGaps = [(24,24,0,0)]<br />
}<br />
</haskell><br />
<br />
===Extended Window Manager Hints===<br />
<br />
[http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-EwmhDesktops.html EwmhDesktops] makes it possible to let Gnome know about Xmonad windows and workspaces. ''EwmhDesktops'' has been enabled in the example configuration above. By itself, configuration looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.EwmhDesktops<br />
main = xmonad defaultConfig<br />
{ logHook = ewmhDesktopsLogHook<br />
}<br />
</haskell><br />
<br />
===Key bindings for switching desktops===<br />
<br />
Gnome lays out the desktops in a row by default, and uses Ctrl+Alt+Left/Right for switching desktops left/right. To get similar behaviour in Xmonad, you need to add some keybindings. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-CycleWS.html XMonad.Actions.CycleWS] has some useful actions for cycling workspaces, and I use these keybindings:<br />
<br />
<haskell><br />
-- moving workspaces<br />
, ((modMask, xK_Left ), prevWS )<br />
, ((modMask, xK_Right ), nextWS )<br />
, ((modMask .|. shiftMask, xK_Left ), shiftToPrev )<br />
, ((modMask .|. shiftMask, xK_Right ), shiftToNext )<br />
</haskell><br />
<br />
===Logging out of the Gnome session vs. quitting Xmonad===<br />
<br />
When running Xmonad as above, it is launched by ''gnome-session'', the "Gnome session manager." Quitting Xmonad in this situation ''will not log you out.'' If you make no changes, using mod+shift+q will leave you with all your applications still running and no window manager to navigate them! There's two different remedies to this, you may enjoy either or both:<br />
<br />
====Rebind mod+shift+q====<br />
To avoid exiting Xmonad and being stuck with no window manager, you might rebind mod+shift+q to execute the gnome-session "log out" functionality. This will of course prevent you from "quitting" Xmonad in the normal way, which may or may not be desirable. When the session logs out, the X11 server is terminated, which will in turn terminate all running X11 applications, including Xmonad.<br />
<br />
(TODO: improve the description of changes that need to be made here.)<br />
<br />
, ((modMask .|. shiftMask, xK_q ), spawn "gnome-session-save --gui --kill") )<br />
<br />
====Configure the session manager to relaunch Xmonad====<br />
You can configure the Gnome Session Manager to restart Xmonad whenever it exits (i.e., if you haven't rebound mod-shift-q.) This is rarely a useful feature as xmonad has its builtin compile-and-restart (mod-q), but it will prevent you from accidentally ending up with no window manager and no way to launch one.<br />
<br />
However, as of version 0.7, XMonad does not itself communicate with any session managers in they way they prefer, so setting things up takes some hackery:<br />
<br />
(TBD: steps, see also [[Xmonad/Using_xmonad_in_Gnome/0.5#Preparing_your_GNOME_session]])</div>Datagrokhttps://wiki.haskell.org/index.php?title=Xmonad/Using_xmonad_in_Gnome&diff=20382Xmonad/Using xmonad in Gnome2008-04-02T11:10:20Z<p>Datagrok: </p>
<hr />
<div>{{xmonad}}<br />
[[Category:XMonad]]<br />
<br />
==Introduction==<br />
<br />
[[Image:Screen-nomeata-ewhm.png|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
Xmonad makes an excellent drop-in replacement for Gnome's default window manager (metacity) giving you a slick tiling window manager. This guide will help you set up Gnome to use Xmonad 0.6.<br />
<br />
This is an update to the previous page on [[Xmonad/Using xmonad in Gnome/0.5]], <br />
which in turn was an update to the<br />
[http://xmonad.org/gnome.html original page on the subject].<br />
<br />
==Setting up Gnome to use Xmonad==<br />
<br />
The easiest way is to let Gnome start Xmonad itself by setting the environment variable WINDOW_MANAGER to point to the xmonad executable before the Gnome session manager starts. On most systems, this means modifying one of ''~/.xprofile'' or ''~/.gnomerc'' to contain:<br />
<br />
export WINDOW_MANAGER=xmonad<br />
<br />
If the binary is not in one of the directories in your $PATH, you must give the full path, i.e.:<br />
<br />
export WINDOW_MANAGER=${HOME}/bin/xmonad<br />
<br />
==Configure Xmonad to interoperate with Gnome==<br />
<br />
Put this in ''~/.xmonad/xmonad.hs'':<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Hooks.ManageDocks<br />
import XMonad.Hooks.EwmhDesktops<br />
<br />
main = xmonad defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, logHook = ewmhDesktopsLogHook<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
, modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
This should set up Xmonad to make space for Gnome's panel and status bar automatically. Note that this requires xmonad-contrib to be installed.<br />
<br />
Having done this, you should now be able to use Gnome with Xmonad, and most things will work. At the time of writing, there are a couple of things that don't fully work: clicking on the taskbar to select a window doesn't focus the window, and clicking on the panel to switch desktops doesn't. Of course you can use the standard Xmonad keys to perform these actions instead. <br />
<br />
Explanations of the various options are given below, along with some other things you might want to tweak.<br />
<br />
[[Image:screen-ohmega-tab-gnome-twopane.jpg|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
==Tweak Gnome to work better with Xmonad==<br />
<br />
These are a few steps that greatly improves the experience of running Xmonad under Gnome. Note that on some systems the binary <tt>gconftool</tt> is called <tt>gconftool-2</tt>.<br />
<br />
===Disable the Nautilus desktop===<br />
<br />
From the command line execute:<br />
<br />
gconftool --type boolean --set /apps/nautilus/preferences/show_desktop false<br />
<br />
===Changing desktop background===<br />
<br />
If you need to change the workspace background programmatically (i.e. from some extension setting in xmonad's configuration file), you can use the command:<br />
<br />
gconftool --type string --set /desktop/gnome/background/picture_filename "/path/to/your/image.png"<br />
<br />
===Fixing the pointer===<br />
<br />
If you're not using the Gnome Display Manager, after switching to Xmonad you might notice that the default pointer isn't the one you chose in your beautiful Gnome theme. The way to address this is to run ''xsetroot'' during session startup. Open the session configuration dialogue (''System -> Preferences -> Sessions''). Add a new startup program, choose any name and comment you want but make the command <br />
<br />
/usr/bin/xsetroot -cursor_name left_ptr<br />
<br />
==Tips on configuring Xmonad==<br />
<br />
Allthe configuration is done in <tt>~/.xmonad/xmonad.hs</tt>.<br />
<br />
===Change the mod key===<br />
<br />
The default ''mod key'' is ''alt'', which conflicts with Gnome keybindings. In order to use be able to use the keyboard to e.g. getting rid of dialogues we rebind it to the left ''logo key'':<br />
<br />
<haskell><br />
main = xmonad defaultConfig<br />
{ modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
===Make space for the panel===<br />
<br />
[http://hackage.haskell.org/packages/archive/xmonad-contrib/0.5/doc/html/XMonad-Hooks-ManageDocks.html ManageDocks] makes it possible for Xmonad to work with panels in the way they expect, automatically leaving the appropriate amount of room for them at the edges of the screen. ''ManageDocks'' has been enabled in the example configuration above. By itself, configuration looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.ManageDocks<br />
main = xmonad defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
}<br />
</haskell><br />
<br />
Prior to version 0.7, Xmonad alternatively supported a ''gaps'' option, configured like this:<br />
<br />
<haskell><br />
main = xmonad defaultConfig<br />
{ defaultGaps = [(24,24,0,0)]<br />
}<br />
</haskell><br />
<br />
===Extended Window Manager Hints===<br />
<br />
[http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-EwmhDesktops.html EwmhDesktops] makes it possible to let Gnome know about Xmonad windows and workspaces. ''EwmhDesktops'' has been enabled in the example configuration above. By itself, configuration looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.EwmhDesktops<br />
main = xmonad defaultConfig<br />
{ logHook = ewmhDesktopsLogHook<br />
}<br />
</haskell><br />
<br />
===Key bindings for switching desktops===<br />
<br />
Gnome lays out the desktops in a row by default, and uses Ctrl+Alt+Left/Right for switching desktops left/right. To get similar behaviour in Xmonad, you need to add some keybindings. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-CycleWS.html XMonad.Actions.CycleWS] has some useful actions for cycling workspaces, and I use these keybindings:<br />
<br />
<haskell><br />
-- moving workspaces<br />
, ((modMask, xK_Left ), prevWS )<br />
, ((modMask, xK_Right ), nextWS )<br />
, ((modMask .|. shiftMask, xK_Left ), shiftToPrev )<br />
, ((modMask .|. shiftMask, xK_Right ), shiftToNext )<br />
</haskell><br />
<br />
===Logging out of the Gnome session vs. quitting Xmonad===<br />
<br />
When running Xmonad as above, it is launched by ''gnome-session'', the "Gnome session manager." Quitting Xmonad in this situation ''will not log you out.'' If you make no changes, using mod+shift+q will leave you with all your applications still running and no window manager to navigate them! There's two different remedies to this, you may enjoy either or both:<br />
<br />
====Rebind mod+shift+q====<br />
To avoid exiting Xmonad and being stuck with no window manager, you might rebind mod+shift+q to execute the gnome-session "log out" functionality. This will of course prevent you from "quitting" Xmonad in the normal way, which may or may not be desirable. When the session logs out, the X11 server is terminated, which will in turn terminate all running X11 applications, including Xmonad.<br />
<br />
(TODO: improve the description of changes that need to be made here.)<br />
<br />
, ((modMask .|. shiftMask, xK_q ), spawn "gnome-session-save --gui --kill") )<br />
<br />
====Configure the session manager to relaunch Xmonad====<br />
You can configure the Gnome Session Manager to restart Xmonad whenever it exits (i.e., if you haven't rebound mod-shift-q.) This is rarely a useful feature as xmonad has its builtin compile-and-restart (mod-q), but it will prevent you from accidentally ending up with no window manager and no way to launch one.<br />
<br />
However, as of version 0.7, XMonad does not itself communicate with any session managers in they way they prefer, so setting things up takes some hackery:<br />
<br />
(TBD: steps)</div>Datagrokhttps://wiki.haskell.org/index.php?title=Xmonad/Using_xmonad_in_Gnome&diff=20381Xmonad/Using xmonad in Gnome2008-04-02T11:07:40Z<p>Datagrok: paths, also my prior edit should have been marked "minor"</p>
<hr />
<div>{{xmonad}}<br />
[[Category:XMonad]]<br />
<br />
==Introduction==<br />
<br />
[[Image:Screen-nomeata-ewhm.png|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
Xmonad makes an excellent drop-in replacement for Gnome's default window manager (metacity) giving you a slick tiling window manager. This guide will help you set up Gnome to use Xmonad 0.6.<br />
<br />
This is an update to the previous page on [[Xmonad/Using xmonad in Gnome/0.5]], <br />
which in turn was an update to the<br />
[http://xmonad.org/gnome.html original page on the subject].<br />
<br />
==Setting up Gnome to use Xmonad==<br />
<br />
The easiest way is to let Gnome start Xmonad itself by setting the environment variable WINDOW_MANAGER to point to the xmonad executable before the Gnome session manager starts. On most systems, this means modifying one of ''~/.xprofile'' or ''~/.gnomerc'' to contain:<br />
<br />
export WINDOW_MANAGER=xmonad<br />
<br />
If the binary is not in one of the directories in your $PATH, you must give the full path, i.e.:<br />
<br />
export WINDOW_MANAGER=${HOME}/bin/xmonad<br />
<br />
==Configure Xmonad to interoperate with Gnome==<br />
<br />
Put this in ''~/.xmonad/xmonad.hs'':<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Hooks.ManageDocks<br />
import XMonad.Hooks.EwmhDesktops<br />
<br />
main = xmonad defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, logHook = ewmhDesktopsLogHook<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
, modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
This should set up Xmonad to make space for Gnome's panel and status bar automatically. Note that this requires xmonad-contrib to be installed.<br />
<br />
Having done this, you should now be able to use Gnome with Xmonad, and most things will work. At the time of writing, there are a couple of things that don't fully work: clicking on the taskbar to select a window doesn't focus the window, and clicking on the panel to switch desktops doesn't. Of course you can use the standard Xmonad keys to perform these actions instead. <br />
<br />
Explanations of the various options are given below, along with some other things you might want to tweak.<br />
<br />
[[Image:screen-ohmega-tab-gnome-twopane.jpg|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
==Tweak Gnome to work better with Xmonad==<br />
<br />
These are a few steps that greatly improves the experience of running Xmonad under Gnome. Note that on some systems the binary <tt>gconftool</tt> is called <tt>gconftool-2</tt>.<br />
<br />
===Disable the Nautilus desktop===<br />
<br />
From the command line execute:<br />
<br />
gconftool --type boolean --set /apps/nautilus/preferences/show_desktop false<br />
<br />
===Changing desktop background===<br />
<br />
If you need to change the workspace background programmatically (i.e. from some extension setting in xmonad's configuration file), you can use the command:<br />
<br />
gconftool --type string --set /desktop/gnome/background/picture_filename "/path/to/your/image.png"<br />
<br />
===Fixing the pointer===<br />
<br />
After switching to Xmonad you might notice that the default pointer isn't the one you chose in your beautiful Gnome theme. The way to address this is to run ''xsetroot'' during session startup. Open the session configuration dialogue (''System -> Preferences -> Sessions''). Add a new startup program, choose any name and comment you want but make the command <br />
<br />
/usr/bin/xsetroot -cursor_name left_ptr<br />
<br />
==Tips on configuring Xmonad==<br />
<br />
Allthe configuration is done in <tt>~/.xmonad/xmonad.hs</tt>.<br />
<br />
===Change the mod key===<br />
<br />
The default ''mod key'' is ''alt'', which conflicts with Gnome keybindings. In order to use be able to use the keyboard to e.g. getting rid of dialogues we rebind it to the left ''logo key'':<br />
<br />
<haskell><br />
main = xmonad defaultConfig<br />
{ modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
===Make space for the panel===<br />
<br />
[http://hackage.haskell.org/packages/archive/xmonad-contrib/0.5/doc/html/XMonad-Hooks-ManageDocks.html ManageDocks] makes it possible for Xmonad to work with panels in the way they expect, automatically leaving the appropriate amount of room for them at the edges of the screen. ''ManageDocks'' has been enabled in the example configuration above. By itself, configuration looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.ManageDocks<br />
main = xmonad defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
}<br />
</haskell><br />
<br />
Prior to version 0.7, Xmonad alternatively supported a ''gaps'' option, configured like this:<br />
<br />
<haskell><br />
main = xmonad defaultConfig<br />
{ defaultGaps = [(24,24,0,0)]<br />
}<br />
</haskell><br />
<br />
===Extended Window Manager Hints===<br />
<br />
[http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-EwmhDesktops.html EwmhDesktops] makes it possible to let Gnome know about Xmonad windows and workspaces. ''EwmhDesktops'' has been enabled in the example configuration above. By itself, configuration looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.EwmhDesktops<br />
main = xmonad defaultConfig<br />
{ logHook = ewmhDesktopsLogHook<br />
}<br />
</haskell><br />
<br />
===Key bindings for switching desktops===<br />
<br />
Gnome lays out the desktops in a row by default, and uses Ctrl+Alt+Left/Right for switching desktops left/right. To get similar behaviour in Xmonad, you need to add some keybindings. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-CycleWS.html XMonad.Actions.CycleWS] has some useful actions for cycling workspaces, and I use these keybindings:<br />
<br />
<haskell><br />
-- moving workspaces<br />
, ((modMask, xK_Left ), prevWS )<br />
, ((modMask, xK_Right ), nextWS )<br />
, ((modMask .|. shiftMask, xK_Left ), shiftToPrev )<br />
, ((modMask .|. shiftMask, xK_Right ), shiftToNext )<br />
</haskell><br />
<br />
===Logging out of the Gnome session vs. quitting Xmonad===<br />
<br />
When running Xmonad as above, it is launched by ''gnome-session'', the "Gnome session manager." Quitting Xmonad in this situation ''will not log you out.'' If you make no changes, using mod+shift+q will leave you with all your applications still running and no window manager to navigate them! There's two different remedies to this, you may enjoy either or both:<br />
<br />
====Rebind mod+shift+q====<br />
To avoid exiting Xmonad and being stuck with no window manager, you might rebind mod+shift+q to execute the gnome-session "log out" functionality. This will of course prevent you from "quitting" Xmonad in the normal way, which may or may not be desirable. When the session logs out, the X11 server is terminated, which will in turn terminate all running X11 applications, including Xmonad.<br />
<br />
(TODO: improve the description of changes that need to be made here.)<br />
<br />
, ((modMask .|. shiftMask, xK_q ), spawn "gnome-session-save --gui --kill") )<br />
<br />
====Configure the session manager to relaunch Xmonad====<br />
You can configure the Gnome Session Manager to restart Xmonad whenever it exits (i.e., if you haven't rebound mod-shift-q.) This is rarely a useful feature as xmonad has its builtin compile-and-restart (mod-q), but it will prevent you from accidentally ending up with no window manager and no way to launch one.<br />
<br />
However, as of version 0.7, XMonad does not itself communicate with any session managers in they way they prefer, so setting things up takes some hackery:<br />
<br />
(TBD: steps)</div>Datagrokhttps://wiki.haskell.org/index.php?title=Xmonad/Using_xmonad_in_Gnome&diff=20380Xmonad/Using xmonad in Gnome2008-04-02T10:53:18Z<p>Datagrok: </p>
<hr />
<div>{{xmonad}}<br />
[[Category:XMonad]]<br />
<br />
==Introduction==<br />
<br />
[[Image:Screen-nomeata-ewhm.png|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
Xmonad makes an excellent drop-in replacement for Gnome's default window manager (metacity) giving you a slick tiling window manager. This guide will help you set up Gnome to use Xmonad 0.6.<br />
<br />
This is an update to the previous page on [[Xmonad/Using xmonad in Gnome/0.5]], <br />
which in turn was an update to the<br />
[http://xmonad.org/gnome.html original page on the subject].<br />
<br />
==Setting up Gnome to use Xmonad==<br />
<br />
The easiest way is to let Gnome start Xmonad itself by setting the environment variable WINDOW_MANAGER to point to the xmonad executable before Gnome starts. On most systems, this means modifying one of ''~/.xprofile'' or ''~/.gnomerc'' to contain:<br />
<br />
export WINDOW_MANAGER=/usr/bin/xmonad<br />
<br />
or, if the binary is in your home directory,<br />
<br />
export WINDOW_MANAGER=${HOME}/bin/xmonad<br />
<br />
==Configure Xmonad to interoperate with Gnome==<br />
<br />
Put this in ''~/.xmonad/xmonad.hs'':<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Hooks.ManageDocks<br />
import XMonad.Hooks.EwmhDesktops<br />
<br />
main = xmonad defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, logHook = ewmhDesktopsLogHook<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
, modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
This should set up Xmonad to make space for Gnome's panel and status bar automatically. Note that this requires xmonad-contrib to be installed.<br />
<br />
Having done this, you should now be able to use Gnome with Xmonad, and most things will work. At the time of writing, there are a couple of things that don't fully work: clicking on the taskbar to select a window doesn't focus the window, and clicking on the panel to switch desktops doesn't. Of course you can use the standard Xmonad keys to perform these actions instead. <br />
<br />
Explanations of the various options are given below, along with some other things you might want to tweak.<br />
<br />
[[Image:screen-ohmega-tab-gnome-twopane.jpg|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
==Tweak Gnome to work better with Xmonad==<br />
<br />
These are a few steps that greatly improves the experience of running Xmonad under Gnome. Note that on some systems the binary <tt>gconftool</tt> is called <tt>gconftool-2</tt>.<br />
<br />
===Disable the Nautilus desktop===<br />
<br />
From the command line execute:<br />
<br />
gconftool --type boolean --set /apps/nautilus/preferences/show_desktop false<br />
<br />
===Changing desktop background===<br />
<br />
If you need to change the workspace background programmatically (i.e. from some extension setting in xmonad's configuration file), you can use the command:<br />
<br />
gconftool --type string --set /desktop/gnome/background/picture_filename "/path/to/your/image.png"<br />
<br />
===Fixing the pointer===<br />
<br />
After switching to Xmonad you might notice that the default pointer isn't the one you chose in your beautiful Gnome theme. The way to address this is to run ''xsetroot'' during session startup. Open the session configuration dialogue (''System -> Preferences -> Sessions''). Add a new startup program, choose any name and comment you want but make the command <br />
<br />
/usr/bin/xsetroot -cursor_name left_ptr<br />
<br />
==Tips on configuring Xmonad==<br />
<br />
Allthe configuration is done in <tt>~/.xmonad/xmonad.hs</tt>.<br />
<br />
===Change the mod key===<br />
<br />
The default ''mod key'' is ''alt'', which conflicts with Gnome keybindings. In order to use be able to use the keyboard to e.g. getting rid of dialogues we rebind it to the left ''logo key'':<br />
<br />
<haskell><br />
main = xmonad defaultConfig<br />
{ modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
===Make space for the panel===<br />
<br />
[http://hackage.haskell.org/packages/archive/xmonad-contrib/0.5/doc/html/XMonad-Hooks-ManageDocks.html ManageDocks] makes it possible for Xmonad to work with panels in the way they expect, automatically leaving the appropriate amount of room for them at the edges of the screen. ''ManageDocks'' has been enabled in the example configuration above. By itself, configuration looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.ManageDocks<br />
main = xmonad defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
}<br />
</haskell><br />
<br />
Prior to version 0.7, Xmonad alternatively supported a ''gaps'' option, configured like this:<br />
<br />
<haskell><br />
main = xmonad defaultConfig<br />
{ defaultGaps = [(24,24,0,0)]<br />
}<br />
</haskell><br />
<br />
===Extended Window Manager Hints===<br />
<br />
[http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-EwmhDesktops.html EwmhDesktops] makes it possible to let Gnome know about Xmonad windows and workspaces. ''EwmhDesktops'' has been enabled in the example configuration above. By itself, configuration looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.EwmhDesktops<br />
main = xmonad defaultConfig<br />
{ logHook = ewmhDesktopsLogHook<br />
}<br />
</haskell><br />
<br />
===Key bindings for switching desktops===<br />
<br />
Gnome lays out the desktops in a row by default, and uses Ctrl+Alt+Left/Right for switching desktops left/right. To get similar behaviour in Xmonad, you need to add some keybindings. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-CycleWS.html XMonad.Actions.CycleWS] has some useful actions for cycling workspaces, and I use these keybindings:<br />
<br />
<haskell><br />
-- moving workspaces<br />
, ((modMask, xK_Left ), prevWS )<br />
, ((modMask, xK_Right ), nextWS )<br />
, ((modMask .|. shiftMask, xK_Left ), shiftToPrev )<br />
, ((modMask .|. shiftMask, xK_Right ), shiftToNext )<br />
</haskell><br />
<br />
===Logging out of the Gnome session vs. quitting Xmonad===<br />
<br />
When running Xmonad as above, it is launched by ''gnome-session'', the "Gnome session manager." Quitting Xmonad in this situation ''will not log you out.'' If you make no changes, using mod+shift+q will leave you with all your applications still running and no window manager to navigate them! There's two different remedies to this, you may enjoy either or both:<br />
<br />
====Rebind mod+shift+q====<br />
To avoid exiting Xmonad and being stuck with no window manager, you might rebind mod+shift+q to execute the gnome-session "log out" functionality. This will of course prevent you from "quitting" Xmonad in the normal way, which may or may not be desirable. When the session logs out, the X11 server is terminated, which will in turn terminate all running X11 applications, including Xmonad.<br />
<br />
(TODO: improve the description of changes that need to be made here.)<br />
<br />
, ((modMask .|. shiftMask, xK_q ), spawn "gnome-session-save --gui --kill") )<br />
<br />
====Configure the session manager to relaunch Xmonad====<br />
You can configure the Gnome Session Manager to restart Xmonad whenever it exits (i.e., if you haven't rebound mod-shift-q.) This is rarely a useful feature as xmonad has its builtin compile-and-restart (mod-q), but it will prevent you from accidentally ending up with no window manager and no way to launch one.<br />
<br />
However, as of version 0.7, XMonad does not itself communicate with any session managers in they way they prefer, so setting things up takes some hackery:<br />
<br />
(TBD: steps)</div>Datagrokhttps://wiki.haskell.org/index.php?title=Xmonad/Using_xmonad_in_Gnome&diff=20379Xmonad/Using xmonad in Gnome2008-04-02T10:50:57Z<p>Datagrok: incremental notes re: sessions</p>
<hr />
<div>{{xmonad}}<br />
[[Category:XMonad]]<br />
<br />
==Introduction==<br />
<br />
[[Image:Screen-nomeata-ewhm.png|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
Xmonad makes an excellent drop-in replacement for Gnome's default window manager (metacity) giving you a slick tiling window manager. This guide will help you set up Gnome to use Xmonad 0.6.<br />
<br />
This is an update to the previous page on [[Xmonad/Using xmonad in Gnome/0.5]], <br />
which in turn was an update to the<br />
[http://xmonad.org/gnome.html original page on the subject].<br />
<br />
==Setting up Gnome to use Xmonad==<br />
<br />
The easiest way is to let Gnome start Xmonad itself by setting the environment variable WINDOW_MANAGER to point to the xmonad executable before Gnome starts. On most systems, this means modifying one of ''~/.xprofile'' or ''~/.gnomerc'' to contain:<br />
<br />
export WINDOW_MANAGER=/usr/bin/xmonad<br />
<br />
or, if the binary is in your home directory,<br />
<br />
export WINDOW_MANAGER=${HOME}/bin/xmonad<br />
<br />
==Configure Xmonad to interoperate with Gnome==<br />
<br />
Put this in ''~/.xmonad/xmonad.hs'':<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Hooks.ManageDocks<br />
import XMonad.Hooks.EwmhDesktops<br />
<br />
main = xmonad defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, logHook = ewmhDesktopsLogHook<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
, modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
This should set up Xmonad to make space for Gnome's panel and status bar automatically. Note that this requires xmonad-contrib to be installed.<br />
<br />
Having done this, you should now be able to use Gnome with Xmonad, and most things will work. At the time of writing, there are a couple of things that don't fully work: clicking on the taskbar to select a window doesn't focus the window, and clicking on the panel to switch desktops doesn't. Of course you can use the standard Xmonad keys to perform these actions instead. <br />
<br />
Explanations of the various options are given below, along with some other things you might want to tweak.<br />
<br />
[[Image:screen-ohmega-tab-gnome-twopane.jpg|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
==Tweak Gnome to work better with Xmonad==<br />
<br />
These are a few steps that greatly improves the experience of running Xmonad under Gnome. Note that on some systems the binary <tt>gconftool</tt> is called <tt>gconftool-2</tt>.<br />
<br />
===Disable the Nautilus desktop===<br />
<br />
From the command line execute:<br />
<br />
gconftool --type boolean --set /apps/nautilus/preferences/show_desktop false<br />
<br />
===Changing desktop background===<br />
<br />
If you need to change the workspace background programmatically (i.e. from some extension setting in xmonad's configuration file), you can use the command:<br />
<br />
gconftool --type string --set /desktop/gnome/background/picture_filename "/path/to/your/image.png"<br />
<br />
===Fixing the pointer===<br />
<br />
After switching to Xmonad you might notice that the default pointer isn't the one you chose in your beautiful Gnome theme. The way to address this is to run ''xsetroot'' during session startup. Open the session configuration dialogue (''System -> Preferences -> Sessions''). Add a new startup program, choose any name and comment you want but make the command <br />
<br />
/usr/bin/xsetroot -cursor_name left_ptr<br />
<br />
==Tips on configuring Xmonad==<br />
<br />
Allthe configuration is done in <tt>~/.xmonad/xmonad.hs</tt>.<br />
<br />
===Change the mod key===<br />
<br />
The default ''mod key'' is ''alt'', which conflicts with Gnome keybindings. In order to use be able to use the keyboard to e.g. getting rid of dialogues we rebind it to the left ''logo key'':<br />
<br />
<haskell><br />
main = xmonad defaultConfig<br />
{ modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
===Make space for the panel===<br />
<br />
[http://hackage.haskell.org/packages/archive/xmonad-contrib/0.5/doc/html/XMonad-Hooks-ManageDocks.html ManageDocks] makes it possible for Xmonad to work with panels in the way they expect, automatically leaving the appropriate amount of room for them at the edges of the screen. ''ManageDocks'' has been enabled in the example configuration above. By itself, configuration looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.ManageDocks<br />
main = xmonad defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
}<br />
</haskell><br />
<br />
Prior to version 0.7, Xmonad alternatively supported a ''gaps'' option, configured like this:<br />
<br />
<haskell><br />
main = xmonad defaultConfig<br />
{ defaultGaps = [(24,24,0,0)]<br />
}<br />
</haskell><br />
<br />
===Extended Window Manager Hints===<br />
<br />
[http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-EwmhDesktops.html EwmhDesktops] makes it possible to let Gnome know about Xmonad windows and workspaces. ''EwmhDesktops'' has been enabled in the example configuration above. By itself, configuration looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.EwmhDesktops<br />
main = xmonad defaultConfig<br />
{ logHook = ewmhDesktopsLogHook<br />
}<br />
</haskell><br />
<br />
===Key bindings for switching desktops===<br />
<br />
Gnome lays out the desktops in a row by default, and uses Ctrl+Alt+Left/Right for switching desktops left/right. To get similar behaviour in Xmonad, you need to add some keybindings. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-CycleWS.html XMonad.Actions.CycleWS] has some useful actions for cycling workspaces, and I use these keybindings:<br />
<br />
<haskell><br />
-- moving workspaces<br />
, ((modMask, xK_Left ), prevWS )<br />
, ((modMask, xK_Right ), nextWS )<br />
, ((modMask .|. shiftMask, xK_Left ), shiftToPrev )<br />
, ((modMask .|. shiftMask, xK_Right ), shiftToNext )<br />
</haskell><br />
<br />
===Logging out of the Gnome session vs. quitting Xmonad===<br />
<br />
When running Xmonad as above, it is launched by ''gnome-session'', the "Gnome session manager." Quitting Xmonad in this situation ''will not log you out.'' If you make no changes, using mod+shift+q will leave you with all your applications still running and no window manager to navigate them! There's two different remedies to this, you may enjoy either or both:<br />
<br />
====Rebind mod+shift+q====<br />
To avoid exiting Xmonad and being stuck with no window manager, you might rebind mod+shift+q to execute the gnome-session "log out" functionality. This will of course prevent you from "quitting" Xmonad in the normal way, which may or may not be desirable. When the session logs out, the X session is terminated, which will in turn terminate all running X11 applications, including Xmonad.<br />
<br />
(TODO: improve the description of changes that need to be made here.)<br />
<br />
, ((modMask .|. shiftMask, xK_q ), spawn "gnome-session-save --gui --kill") )<br />
<br />
====Configure the session manager to relaunch Xmonad====<br />
You can configure the Gnome Session Manager to restart Xmonad whenever it exits (i.e., if you haven't rebound mod-shift-q.) This is rarely a useful feature as xmonad has its builtin compile-and-restart (mod-q), but it will prevent you from accidentally ending up with no window manager and no way to launch one.<br />
<br />
However, as of version 0.7, XMonad does not itself communicate with any session managers in they way they prefer, so setting things up takes some hackery:<br />
<br />
(TBD: steps)</div>Datagrokhttps://wiki.haskell.org/index.php?title=Xmonad/Using_xmonad_in_Gnome&diff=20365Xmonad/Using xmonad in Gnome2008-04-01T08:49:20Z<p>Datagrok: Logging out vs. quitting</p>
<hr />
<div>{{xmonad}}<br />
[[Category:XMonad]]<br />
<br />
==Introduction==<br />
<br />
[[Image:Screen-nomeata-ewhm.png|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
Xmonad makes an excellent drop-in replacement for Gnome's default window manager (metacity) giving you a slick tiling window manager. This guide will help you set up Gnome to use Xmonad 0.6.<br />
<br />
This is an update to the previous page on [[Xmonad/Using xmonad in Gnome/0.5]], <br />
which in turn was an update to the<br />
[http://xmonad.org/gnome.html original page on the subject].<br />
<br />
==Setting up Gnome to use Xmonad==<br />
<br />
The easiest way is to let Gnome start Xmonad itself by setting the environment variable WINDOW_MANAGER to point to the xmonad executable before Gnome starts. On most systems, this means modifying one of ''~/.xprofile'' or ''~/.gnomerc'' to contain:<br />
<br />
export WINDOW_MANAGER=/usr/bin/xmonad<br />
<br />
or, if the binary is in your home directory,<br />
<br />
export WINDOW_MANAGER=${HOME}/bin/xmonad<br />
<br />
==Configure Xmonad to interoperate with Gnome==<br />
<br />
Put this in ''~/.xmonad/xmonad.hs'':<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Hooks.ManageDocks<br />
import XMonad.Hooks.EwmhDesktops<br />
<br />
main = xmonad defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, logHook = ewmhDesktopsLogHook<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
, modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
This should set up Xmonad to make space for Gnome's panel and status bar automatically. <br />
<br />
Having done this, you should now be able to use Gnome with Xmonad, and most things will work. At the time of writing, there are a couple of things that don't fully work: clicking on the taskbar to select a window doesn't focus the window, and clicking on the panel to switch desktops doesn't. Of course you can use the standard Xmonad keys to perform these actions instead. <br />
<br />
Explanations of the various options are given below, along with some other things you might want to tweak.<br />
<br />
[[Image:screen-ohmega-tab-gnome-twopane.jpg|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
==Tweak Gnome to work better with Xmonad==<br />
<br />
These are a few steps that greatly improves the experience of running Xmonad under Gnome. Note that on some systems the binary <tt>gconftool</tt> is called <tt>gconftool-2</tt>.<br />
<br />
===Disable the Nautilus desktop===<br />
<br />
From the command line execute:<br />
<br />
gconftool --type boolean --set /apps/nautilus/preferences/show_desktop false<br />
<br />
===Changing desktop background===<br />
<br />
If you need to change the workspace background programmatically (i.e. from some extension setting in xmonad's configuration file), you can use the command:<br />
<br />
gconftool --type string --set /desktop/gnome/background/picture_filename "/path/to/your/image.png"<br />
<br />
===Fixing the pointer===<br />
<br />
After switching to Xmonad you might notice that the default pointer isn't the one you chose in your beautiful Gnome theme. The way to address this is to run ''xsetroot'' during session startup. Open the session configuration dialogue (''System -> Preferences -> Sessions''). Add a new startup program, choose any name and comment you want but make the command <br />
<br />
/usr/bin/xsetroot -cursor_name left_ptr<br />
<br />
==Tips on configuring Xmonad==<br />
<br />
Allthe configuration is done in <tt>~/.xmonad/xmonad.hs</tt>.<br />
<br />
===Change the mod key===<br />
<br />
The default ''mod key'' is ''alt'', which conflicts with Gnome keybindings. In order to use be able to use the keyboard to e.g. getting rid of dialogues we rebind it to the left ''logo key'':<br />
<br />
<haskell><br />
main = xmonad defaultConfig<br />
{ modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
===Make space for the panel===<br />
<br />
[http://hackage.haskell.org/packages/archive/xmonad-contrib/0.5/doc/html/XMonad-Hooks-ManageDocks.html ManageDocks] makes it possible for Xmonad to work with panels in the way they expect, automatically leaving the appropriate amount of room for them at the edges of the screen. ''ManageDocks'' has been enabled in the example configuration above. By itself, configuration looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.ManageDocks<br />
main = xmonad defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
}<br />
</haskell><br />
<br />
Prior to version 0.7, Xmonad alternatively supported a ''gaps'' option, configured like this:<br />
<br />
<haskell><br />
main = xmonad defaultConfig<br />
{ defaultGaps = [(24,24,0,0)]<br />
}<br />
</haskell><br />
<br />
===Extended Window Manager Hints===<br />
<br />
[http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-EwmhDesktops.html EwmhDesktops] makes it possible to let Gnome know about Xmonad windows and workspaces. ''EwmhDesktops'' has been enabled in the example configuration above. By itself, configuration looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.EwmhDesktops<br />
main = xmonad defaultConfig<br />
{ logHook = ewmhDesktopsLogHook<br />
}<br />
</haskell><br />
<br />
===Key bindings for switching desktops===<br />
<br />
Gnome lays out the desktops in a row by default, and uses Ctrl+Alt+Left/Right for switching desktops left/right. To get similar behaviour in Xmonad, you need to add some keybindings. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-CycleWS.html XMonad.Actions.CycleWS] has some useful actions for cycling workspaces, and I use these keybindings:<br />
<br />
<haskell><br />
-- moving workspaces<br />
, ((modMask, xK_Left ), prevWS )<br />
, ((modMask, xK_Right ), nextWS )<br />
, ((modMask .|. shiftMask, xK_Left ), shiftToPrev )<br />
, ((modMask .|. shiftMask, xK_Right ), shiftToNext )<br />
</haskell><br />
<br />
===Logging out of the Gnome session vs. quitting Xmonad===<br />
<br />
When running Xmonad as above, it is launched by ''gnome-session'', the "Gnome session manager." Quitting Xmonad in this situation ''will not log you out.'' If you make no changes, using mod+shift+q will leave you with all your applications still running and no window manager to navigate them! There's two different remedies to this, you may enjoy either or both:<br />
<br />
====Configure the session manager to relaunch Xmonad====<br />
You can configure the Gnome Session Manager to restart Xmonad whenever it is "quit" (with mod-shift-q.) This is rarely useful as xmonad has its builtin compile-and-restart feature (mod-q), but it will prevent you from accidentally quitting Xmonad and ending up with no window manager.<br />
<br />
TBD: steps<br />
<br />
====Rebind mod+shift+q====<br />
If you do not use 'gnome-panel', you might also rebind mod+shift+q to execute the "log out of the session" functionality. This will of course prevent you from "quitting" Xmonad in the normal way, which may or may not be desirable. When the session logs out, it will kill all the running applications including Xmonad.<br />
<br />
TBD: steps</div>Datagrokhttps://wiki.haskell.org/index.php?title=Xmonad/Using_xmonad_in_Gnome&diff=20359Xmonad/Using xmonad in Gnome2008-03-31T22:20:39Z<p>Datagrok: cleanup, verbiage, indentation</p>
<hr />
<div>{{xmonad}}<br />
[[Category:XMonad]]<br />
<br />
==Introduction==<br />
<br />
[[Image:Screen-nomeata-ewhm.png|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
Xmonad makes an excellent drop-in replacement for Gnome's default window manager (metacity) giving you a slick tiling window manager. This guide will help you set up Gnome to use Xmonad 0.6.<br />
<br />
This is an update to the previous page on [[Xmonad/Using xmonad in Gnome/0.5]], <br />
which in turn was an update to the<br />
[http://xmonad.org/gnome.html original page on the subject].<br />
<br />
==Setting up Gnome to use Xmonad==<br />
<br />
The easiest way is to let Gnome start Xmonad itself by setting the environment variable WINDOW_MANAGER to point to the xmonad executable before Gnome starts. On most systems, this means modifying one of ''~/.xprofile'' or ''~/.gnomerc'' to contain:<br />
<br />
export WINDOW_MANAGER=/usr/bin/xmonad<br />
<br />
or, if the binary is in your home directory,<br />
<br />
export WINDOW_MANAGER=${HOME}/bin/xmonad<br />
<br />
==Configure Xmonad to interoperate with Gnome==<br />
<br />
Put this in ''~/.xmonad/xmonad.hs'':<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Hooks.ManageDocks<br />
import XMonad.Hooks.EwmhDesktops<br />
<br />
main = xmonad defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, logHook = ewmhDesktopsLogHook<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
, modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
This should set up Xmonad to make space for Gnome's panel and status bar automatically. <br />
<br />
Having done this, you should now be able to use Gnome with Xmonad, and most things will work. At the time of writing, there are a couple of things that don't fully work: clicking on the taskbar to select a window doesn't focus the window, and clicking on the panel to switch desktops doesn't. Of course you can use the standard Xmonad keys to perform these actions instead. <br />
<br />
Explanations of the various options are given below, along with some other things you might want to tweak.<br />
<br />
[[Image:screen-ohmega-tab-gnome-twopane.jpg|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
==Tweak Gnome to work better with Xmonad==<br />
<br />
These are a few steps that greatly improves the experience of running Xmonad under Gnome. Note that on some systems the binary <tt>gconftool</tt> is called <tt>gconftool-2</tt>.<br />
<br />
===Disable the Nautilus desktop===<br />
<br />
From the command line execute:<br />
<br />
gconftool --type boolean --set /apps/nautilus/preferences/show_desktop false<br />
<br />
===Changing desktop background===<br />
<br />
If you need to change the workspace background programmatically (i.e. from some extension setting in xmonad's configuration file), you can use the command:<br />
<br />
gconftool --type string --set /desktop/gnome/background/picture_filename "/path/to/your/image.png"<br />
<br />
===Fixing the pointer===<br />
<br />
After switching to Xmonad you might notice that the default pointer isn't the one you chose in your beautiful Gnome theme. The way to address this is to run ''xsetroot'' during session startup. Open the session configuration dialogue (''System -> Preferences -> Sessions''). Add a new startup program, choose any name and comment you want but make the command <br />
<br />
/usr/bin/xsetroot -cursor_name left_ptr<br />
<br />
==Tips on configuring Xmonad==<br />
<br />
Allthe configuration is done in <tt>~/.xmonad/xmonad.hs</tt>.<br />
<br />
===Change the mod key===<br />
<br />
The default ''mod key'' is ''alt'', which conflicts with Gnome keybindings. In order to use be able to use the keyboard to e.g. getting rid of dialogues we rebind it to the left ''logo key'':<br />
<br />
<haskell><br />
main = xmonad defaultConfig<br />
{ modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
===Make space for the panel===<br />
<br />
[http://hackage.haskell.org/packages/archive/xmonad-contrib/0.5/doc/html/XMonad-Hooks-ManageDocks.html ManageDocks] makes it possible for Xmonad to work with panels in the way they expect, automatically leaving the appropriate amount of room for them at the edges of the screen. ''ManageDocks'' has been enabled in the example configuration above. By itself, configuration looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.ManageDocks<br />
main = xmonad defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
}<br />
</haskell><br />
<br />
Prior to version 0.7, Xmonad alternatively supported a ''gaps'' option, configured like this:<br />
<br />
<haskell><br />
main = xmonad defaultConfig<br />
{ defaultGaps = [(24,24,0,0)]<br />
}<br />
</haskell><br />
<br />
===Extended Window Manager Hints===<br />
<br />
[http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-EwmhDesktops.html EwmhDesktops] makes it possible to let Gnome know about Xmonad windows and workspaces. ''EwmhDesktops'' has been enabled in the example configuration above. By itself, configuration looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.EwmhDesktops<br />
main = xmonad defaultConfig<br />
{ logHook = ewmhDesktopsLogHook<br />
}<br />
</haskell><br />
<br />
===Key bindings for switching desktops===<br />
<br />
Gnome lays out the desktops in a row by default, and uses Ctrl+Alt+Left/Right for switching desktops left/right. To get similar behaviour in Xmonad, you need to add some keybindings. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-CycleWS.html XMonad.Actions.CycleWS] has some useful actions for cycling workspaces, and I use these keybindings:<br />
<br />
<haskell><br />
-- moving workspaces<br />
, ((modMask, xK_Left ), prevWS )<br />
, ((modMask, xK_Right ), nextWS )<br />
, ((modMask .|. shiftMask, xK_Left ), shiftToPrev )<br />
, ((modMask .|. shiftMask, xK_Right ), shiftToNext )<br />
</haskell></div>Datagrokhttps://wiki.haskell.org/index.php?title=Xmonad/Using_xmonad_in_Gnome&diff=20351Xmonad/Using xmonad in Gnome2008-03-30T22:35:47Z<p>Datagrok: Link to full-size image; not thumbnail</p>
<hr />
<div>{{xmonad}}<br />
[[Category:XMonad]]<br />
<br />
==Introduction==<br />
<br />
[[Image:Screen-nomeata-ewhm.png|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
Xmonad makes an excellent drop-in replacement for Gnome's default window manager (metacity) giving you a slick tiling window manager. This guide will help you set up Gnome to use Xmonad 0.6.<br />
<br />
This is an update to the previous page on [[Xmonad/Using xmonad in Gnome/0.5]], <br />
which in turn was an update to the<br />
[http://xmonad.org/gnome.html original page on the subject].<br />
<br />
==Setting up Gnome to use Xmonad==<br />
<br />
The easiest way is to let Gnome start Xmonad itself by modifying ''~/.gnomerc'' to contain<br />
<br />
export WINDOW_MANAGER=/usr/bin/xmonad<br />
<br />
if the binary is somewhere in your home directory. Be sure to avoid using a tilda. It doesn't work in this expression. Instead use the absolute path:<br />
export WINDOW_MANAGER=/home/<userid>/bin/xmonad<br />
<br />
==Configure Xmonad to interoperate with Gnome==<br />
<br />
Put this in ''~/.xmonad/xmonad.hs'':<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Hooks.ManageDocks<br />
import XMonad.Hooks.EwmhDesktops<br />
<br />
main = xmonad $ defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, logHook = ewmhDesktopsLogHook<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
, modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
This should set up Xmonad to make space for Gnome's panel and status bar automatically. <br />
<br />
Having done this, you should now be able to use Gnome with Xmonad, and most things will work. At the time of writing, there are a couple of things that don't fully work: clicking on the taskbar to select a window doesn't focus the window, and clicking on the panel to switch desktops doesn't. Of course you can use the standard Xmonad keys to perform these actions instead. <br />
<br />
Explanations of the various options are given below, along with some other things you might want to tweak.<br />
<br />
[[Image:screen-ohmega-tab-gnome-twopane.jpg|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
==Tweak Gnome to work better with Xmonad==<br />
<br />
These are a few steps that greatly improves the experience of running Xmonad under Gnome. Note that on some systems the binary <tt>gconftool</tt> is called <tt>gconftool-2</tt>.<br />
<br />
===Disable the Nautilus desktop===<br />
<br />
From the command line execute:<br />
<br />
gconftool --type boolean --set /apps/nautilus/preferences/show_desktop false<br />
<br />
===Changing desktop background===<br />
<br />
If you need to change the workspace background programmatically (i.e. from some extension setting in xmonad's configuration file), you can use the command:<br />
<br />
gconftool --type string --set /desktop/gnome/background/picture_filename "/path/to/your/image.png"<br />
<br />
===Fixing the pointer===<br />
<br />
After switching to Xmonad you might notice that the default pointer isn't the one you chose in your beautiful Gnome theme. The way to address this is to run ''xsetroot'' during session startup. Open the session configuration dialogue (''System -> Preferences -> Sessions''). Add a new startup program, choose any name and comment you want but make the command <br />
<br />
/usr/bin/xsetroot -cursor_name left_ptr<br />
<br />
==Tips on configuring Xmonad==<br />
<br />
Allthe configuration is done in <tt>~/.xmonad/xmonad.hs</tt>.<br />
<br />
===Change the mod key===<br />
<br />
The default ''mod key'' is ''alt'', which conflicts with Gnome keybindings. In order to use be able to use the keyboard to e.g. getting rid of dialogues we rebind it to the left ''logo key'':<br />
<br />
<haskell><br />
main = xmonad $ defaultConfig<br />
{ modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
===Make space for the panel===<br />
<br />
[http://hackage.haskell.org/packages/archive/xmonad-contrib/0.5/doc/html/XMonad-Hooks-ManageDocks.html ManageDocks] makes it possible for Xmonad to work with panels in the way they expect, automatically leaving the appropriate amount of room for them at the edges of the screen. ''ManageDocks'' has been enabled in the example configuration above. By itself, configuration looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.ManageDocks<br />
main = xmonad defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
}<br />
</haskell><br />
<br />
Prior to version 0.7, Xmonad alternatively supported a ''gaps'' option, configured like this:<br />
<br />
<haskell><br />
main = xmonad $ defaultConfig<br />
{ defaultGaps = [(24,24,0,0)]<br />
}<br />
</haskell><br />
<br />
===Extended Window Manager Hints===<br />
<br />
[http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-EwmhDesktops.html EwmhDesktops] makes it possible to let Gnome know about Xmonad windows and workspaces. ''EwmhDesktops'' has been enabled in the example configuration above. By itself, configuration looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.EwmhDesktops<br />
main = xmonad $ defaultConfig<br />
{ logHook = ewmhDesktopsLogHook<br />
}<br />
</haskell><br />
<br />
===Key bindings for switching desktops===<br />
<br />
Gnome lays out the desktops in a row by default, and uses Ctrl+Alt+Left/Right for switching desktops left/right. To get similar behaviour in Xmonad, you need to add some keybindings. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-CycleWS.html XMonad.Actions.CycleWS] has some useful actions for cycling workspaces, and I use these keybindings:<br />
<br />
<haskell><br />
-- moving workspaces<br />
, ((modMask, xK_Left ), prevWS )<br />
, ((modMask, xK_Right ), nextWS )<br />
, ((modMask .|. shiftMask, xK_Left ), shiftToPrev )<br />
, ((modMask .|. shiftMask, xK_Right ), shiftToNext )<br />
</haskell></div>Datagrokhttps://wiki.haskell.org/index.php?title=Xmonad/Using_xmonad_in_Gnome&diff=20336Xmonad/Using xmonad in Gnome2008-03-30T01:09:43Z<p>Datagrok: EwmhDesktops</p>
<hr />
<div>{{xmonad}}<br />
[[Category:XMonad]]<br />
<br />
==Introduction==<br />
<br />
[[Image:Screen-nomeata-ewhm.png|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
Xmonad makes an excellent drop-in replacement for Gnome's default window manager (metacity) giving you a slick tiling window manager. This guide will help you set up Gnome to use Xmonad 0.6.<br />
<br />
This is an update to the previous page on [[Xmonad/Using xmonad in Gnome/0.5]], <br />
which in turn was an update to the<br />
[http://xmonad.org/gnome.html original page on the subject].<br />
<br />
==Setting up Gnome to use Xmonad==<br />
<br />
The easiest way is to let Gnome start Xmonad itself by modifying ''~/.gnomerc'' to contain<br />
<br />
export WINDOW_MANAGER=/usr/bin/xmonad<br />
<br />
==Configure Xmonad to interoperate with Gnome==<br />
<br />
Put this in ''~/.xmonad/xmonad.hs'':<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Hooks.ManageDocks<br />
import XMonad.Hooks.EwmhDesktops<br />
<br />
main = xmonad $ defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, logHook = ewmhDesktopsLogHook<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
, modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
This should set up Xmonad to make space for Gnome's panel and status bar automatically. <br />
<br />
Having done this, you should now be able to use Gnome with Xmonad, and most things will work. At the time of writing, there are a couple of things that don't fully work: clicking on the taskbar to select a window doesn't focus the window, and clicking on the panel to switch desktops doesn't. Of course you can use the standard Xmonad keys to perform these actions instead. <br />
<br />
Explanations of the various options are given below, along with some other things you might want to tweak.<br />
<br />
[[Image:screen-ohmega-tab-gnome-twopane-thumb.jpg|center]]<br />
<br />
==Tweak Gnome to work better with Xmonad==<br />
<br />
These are a few steps that greatly improves the experience of running Xmonad under Gnome. Note that on some systems the binary <tt>gconftool</tt> is called <tt>gconftool-2</tt>.<br />
<br />
===Disable the Nautilus desktop===<br />
<br />
From the command line execute:<br />
<br />
gconftool --type boolean --set /apps/nautilus/preferences/show_desktop false<br />
<br />
===Changing desktop background===<br />
<br />
If you need to change the workspace background programmatically (i.e. from some extension setting in xmonad's configuration file), you can use the command:<br />
<br />
gconftool --type string --set /desktop/gnome/background/picture_filename "/path/to/your/image.png"<br />
<br />
===Fixing the pointer===<br />
<br />
After switching to Xmonad you might notice that the default pointer isn't the one you chose in your beautiful Gnome theme. The way to address this is to run ''xsetroot'' during session startup. Open the session configuration dialogue (''System -> Preferences -> Sessions''). Add a new startup program, choose any name and comment you want but make the command <br />
<br />
/usr/bin/xsetroot -cursor_name left_ptr<br />
<br />
==Tips on configuring Xmonad==<br />
<br />
Allthe configuration is done in <tt>~/.xmonad/xmonad.hs</tt>.<br />
<br />
===Change the mod key===<br />
<br />
The default ''mod key'' is ''alt'', which conflicts with Gnome keybindings. In order to use be able to use the keyboard to e.g. getting rid of dialogues we rebind it to the left ''logo key'':<br />
<br />
<haskell><br />
main = xmonad $ defaultConfig<br />
{ modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
===Make space for the panel===<br />
<br />
[http://hackage.haskell.org/packages/archive/xmonad-contrib/0.5/doc/html/XMonad-Hooks-ManageDocks.html ManageDocks] makes it possible for Xmonad to work with panels in the way they expect, automatically leaving the appropriate amount of room for them at the edges of the screen. ''ManageDocks'' has been enabled in the example configuration above. By itself, configuration looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.ManageDocks<br />
main = xmonad defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
}<br />
</haskell><br />
<br />
Prior to version 0.7, Xmonad alternatively supported a ''gaps'' option, configured like this:<br />
<br />
<haskell><br />
main = xmonad $ defaultConfig<br />
{ defaultGaps = [(24,24,0,0)]<br />
}<br />
</haskell><br />
<br />
===Extended Window Manager Hints===<br />
<br />
[http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-EwmhDesktops.html EwmhDesktops] makes it possible to let Gnome know about Xmonad windows and workspaces. ''EwmhDesktops'' has been enabled in the example configuration above. By itself, configuration looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.EwmhDesktops<br />
main = xmonad $ defaultConfig<br />
{ logHook = ewmhDesktopsLogHook<br />
}<br />
</haskell><br />
<br />
===Key bindings for switching desktops===<br />
<br />
Gnome lays out the desktops in a row by default, and uses Ctrl+Alt+Left/Right for switching desktops left/right. To get similar behaviour in Xmonad, you need to add some keybindings. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-CycleWS.html XMonad.Actions.CycleWS] has some useful actions for cycling workspaces, and I use these keybindings:<br />
<br />
<haskell><br />
-- moving workspaces<br />
, ((modMask, xK_Left ), prevWS )<br />
, ((modMask, xK_Right ), nextWS )<br />
, ((modMask .|. shiftMask, xK_Left ), shiftToPrev )<br />
, ((modMask .|. shiftMask, xK_Right ), shiftToNext )<br />
</haskell></div>Datagrokhttps://wiki.haskell.org/index.php?title=Xmonad/Using_xmonad_in_Gnome&diff=20335Xmonad/Using xmonad in Gnome2008-03-30T01:07:02Z<p>Datagrok: Minor verbiage, style edits</p>
<hr />
<div>{{xmonad}}<br />
[[Category:XMonad]]<br />
<br />
==Introduction==<br />
<br />
[[Image:Screen-nomeata-ewhm.png|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
Xmonad makes an excellent drop-in replacement for Gnome's default window manager (metacity) giving you a slick tiling window manager. This guide will help you set up Gnome to use Xmonad 0.6.<br />
<br />
This is an update to the previous page on [[Xmonad/Using xmonad in Gnome/0.5]], <br />
which in turn was an update to the<br />
[http://xmonad.org/gnome.html original page on the subject].<br />
<br />
==Setting up Gnome to use Xmonad==<br />
<br />
The easiest way is to let Gnome start Xmonad itself by modifying ''~/.gnomerc'' to contain<br />
<br />
export WINDOW_MANAGER=/usr/bin/xmonad<br />
<br />
==Configure Xmonad to interoperate with Gnome==<br />
<br />
Put this in ''~/.xmonad/xmonad.hs'':<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Hooks.ManageDocks<br />
import XMonad.Hooks.EwmhDesktops<br />
<br />
main = xmonad $ defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, logHook = ewmhDesktopsLogHook<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
, modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
This should set up Xmonad to make space for Gnome's panel and status bar automatically. <br />
<br />
Having done this, you should now be able to use Gnome with Xmonad, and most things will work. At the time of writing, there are a couple of things that don't fully work: clicking on the taskbar to select a window doesn't focus the window, and clicking on the panel to switch desktops doesn't. Of course you can use the standard Xmonad keys to perform these actions instead. <br />
<br />
Explanations of the various options are given below, along with some other things you might want to tweak.<br />
<br />
[[Image:screen-ohmega-tab-gnome-twopane-thumb.jpg|center]]<br />
<br />
==Tweak Gnome to work better with Xmonad==<br />
<br />
These are a few steps that greatly improves the experience of running Xmonad under Gnome. Note that on some systems the binary <tt>gconftool</tt> is called <tt>gconftool-2</tt>.<br />
<br />
===Disable the Nautilus desktop===<br />
<br />
From the command line execute:<br />
<br />
gconftool --type boolean --set /apps/nautilus/preferences/show_desktop false<br />
<br />
===Changing desktop background===<br />
<br />
If you need to change the workspace background programmatically (i.e. from some extension setting in xmonad's configuration file), you can use the command:<br />
<br />
gconftool --type string --set /desktop/gnome/background/picture_filename "/path/to/your/image.png"<br />
<br />
===Fixing the pointer===<br />
<br />
After switching to Xmonad you might notice that the default pointer isn't the one you chose in your beautiful Gnome theme. The way to address this is to run ''xsetroot'' during session startup. Open the session configuration dialogue (''System -> Preferences -> Sessions''). Add a new startup program, choose any name and comment you want but make the command <br />
<br />
/usr/bin/xsetroot -cursor_name left_ptr<br />
<br />
==Tips on configuring Xmonad==<br />
<br />
Allthe configuration is done in <tt>~/.xmonad/xmonad.hs</tt>.<br />
<br />
===Change the mod key===<br />
<br />
The default ''mod key'' is ''alt'', which conflicts with Gnome keybindings. In order to use be able to use the keyboard to e.g. getting rid of dialogues we rebind it to the left ''logo key'':<br />
<br />
<haskell><br />
main = xmonad $ defaultConfig<br />
{ modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
===Make space for the panel===<br />
<br />
[http://hackage.haskell.org/packages/archive/xmonad-contrib/0.5/doc/html/XMonad-Hooks-ManageDocks.html ManageDocks] makes it possible for Xmonad to work with panels in the way they expect, automatically leaving the appropriate amount of room for them at the edges of the screen. ''ManageDocks'' has been enabled in the example configuration above. By itself, configuration looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.ManageDocks<br />
main = xmonad defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
}<br />
</haskell><br />
<br />
Prior to version 0.7, Xmonad alternatively supported a ''gaps'' option, configured like this:<br />
<br />
<haskell><br />
main = xmonad $ defaultConfig<br />
{ defaultGaps = [(24,24,0,0)]<br />
}<br />
</haskell><br />
<br />
===Extended Window Manager Hints===<br />
<br />
[http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-EwmhDesktops.html EwmhDesktop] makes it possible to let Gnome know about Xmonad windows and workspaces. ''EwmhDesktop'' has been enabled in the example configuration above. By itself, configuration looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.EwmhDesktops<br />
main = xmonad $ defaultConfig<br />
{ logHook = ewmhDesktopsLogHook<br />
}<br />
</haskell><br />
<br />
===Key bindings for switching desktops===<br />
<br />
Gnome lays out the desktops in a row by default, and uses Ctrl+Alt+Left/Right for switching desktops left/right. To get similar behaviour in Xmonad, you need to add some keybindings. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-CycleWS.html XMonad.Actions.CycleWS] has some useful actions for cycling workspaces, and I use these keybindings:<br />
<br />
<haskell><br />
-- moving workspaces<br />
, ((modMask, xK_Left ), prevWS )<br />
, ((modMask, xK_Right ), nextWS )<br />
, ((modMask .|. shiftMask, xK_Left ), shiftToPrev )<br />
, ((modMask .|. shiftMask, xK_Right ), shiftToNext )<br />
</haskell></div>Datagrokhttps://wiki.haskell.org/index.php?title=Xmonad/Using_xmonad_in_Gnome&diff=20334Xmonad/Using xmonad in Gnome2008-03-30T01:04:09Z<p>Datagrok: Clean up and prioritize ManageDocks over gaps</p>
<hr />
<div>{{xmonad}}<br />
[[Category:XMonad]]<br />
<br />
==Introduction==<br />
<br />
[[Image:Screen-nomeata-ewhm.png|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
Xmonad makes an excellent drop-in replacement for Gnome's default window manager (metacity) giving you a slick tiling window manager. This guide will help you set up Gnome to use Xmonad 0.6.<br />
<br />
This is an update to the previous page on [[Xmonad/Using xmonad in Gnome/0.5]], <br />
which in turn was an update to the<br />
[http://xmonad.org/gnome.html original page on the subject].<br />
<br />
==Setting up Gnome to use Xmonad==<br />
<br />
The easiest way is to let Gnome start Xmonad itself by modifying ''~/.gnomerc'' to contain<br />
<br />
export WINDOW_MANAGER=/usr/bin/xmonad<br />
<br />
==Configure Xmonad to interoperate with Gnome==<br />
<br />
Put this in ''~/.xmonad/xmonad.hs'':<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Hooks.ManageDocks<br />
import XMonad.Hooks.EwmhDesktops<br />
<br />
main = xmonad $ defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, logHook = ewmhDesktopsLogHook<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
, modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
This should set up Xmonad to make space for Gnome's panel and status bar automatically. <br />
<br />
Having done this, you should now be able to use Gnome with Xmonad, and most things will work. At the time of writing, there are a couple of things that don't fully work: clicking on the taskbar to select a window doesn't focus the window, and clicking on the panel to switch desktops doesn't. Of course you can use the standard Xmonad keys to perform these actions instead. <br />
<br />
Explanations of the various options are given below, along with some other things you might want to tweak.<br />
<br />
[[Image:screen-ohmega-tab-gnome-twopane-thumb.jpg|center]]<br />
<br />
==Tweak Gnome to work better with Xmonad==<br />
<br />
These are a few steps that greatly improves the experience of running Xmonad under Gnome. Note that on some systems the binary <tt>gconftool</tt> is called <tt>gconftool-2</tt>.<br />
<br />
===Disable the Nautilus desktop===<br />
<br />
From the command line execute:<br />
<br />
gconftool --type boolean --set /apps/nautilus/preferences/show_desktop false<br />
<br />
===Changing desktop background===<br />
<br />
If you need to change the workspace background programmatically (i.e. from some extension setting in xmonad's configuration file), you can use the command:<br />
<br />
gconftool --type string --set /desktop/gnome/background/picture_filename "/path/to/your/image.png"<br />
<br />
===Fixing the pointer===<br />
<br />
After switching to Xmonad you might notice that the default pointer isn't the one you chose in your beautiful Gnome theme. The way to address this is to run ''xsetroot'' during session startup. Open the session configuration dialogue (''System -> Preferences -> Sessions''). Add a new startup program, choose any name and comment you want but make the command <br />
<br />
/usr/bin/xsetroot -cursor_name left_ptr<br />
<br />
==Tips on configuring Xmonad==<br />
<br />
Allthe configuration is done in <tt>~/.xmonad/xmonad.hs</tt>.<br />
<br />
===Change the mod key===<br />
<br />
The default ''mod key'' is ''alt'', which conflicts with Gnome keybindings. In order to use be able to use the keyboard to e.g. getting rid of dialogues we rebind it to the left ''logo key'':<br />
<br />
<haskell><br />
main = xmonad $ defaultConfig {<br />
modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
===Make space for the panel===<br />
<br />
[http://hackage.haskell.org/packages/archive/xmonad-contrib/0.5/doc/html/XMonad-Hooks-ManageDocks.html ManageDocks] makes it possible for Xmonad to work with panels in the way they expect, automatically leaving the appropriate amount of room for them at the edges of the screen. The ManageDocks method has been used in the configuration provided above. By itself, configuring ''ManageDocks'' looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.ManageDocks<br />
main = xmonad defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
}<br />
</haskell><br />
<br />
Prior to version 0.7, Xmonad alternatively supported a ''gaps'' option, configured like this:<br />
<br />
<haskell><br />
main = xmonad $ defaultConfig {<br />
defaultGaps = [(24,24,0,0)]<br />
}<br />
</haskell><br />
<br />
<br />
===Extended Window Manager Hints===<br />
<br />
[http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-EwmhDesktops.html EwmhDesktop] makes it possible to let Gnome know about Xmonad windows and workspaces. EwmhDesktop has been enabled in the example configuration above. By itself, configuring XMonad with EwmhDesktop looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.EwmhDesktops<br />
main = xmonad $ defaultConfig {<br />
logHook = ewmhDesktopsLogHook<br />
}<br />
</haskell><br />
<br />
===Key bindings for switching desktops===<br />
<br />
Gnome lays out the desktops in a row by default, and uses Ctrl+Alt+Left/Right for switching desktops left/right. To get similar behaviour in Xmonad, you need to add some keybindings. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-CycleWS.html XMonad.Actions.CycleWS] has some useful actions for cycling workspaces, and I use these keybindings:<br />
<br />
<haskell><br />
-- moving workspaces<br />
, ((modMask, xK_Left ), prevWS )<br />
, ((modMask, xK_Right ), nextWS )<br />
, ((modMask .|. shiftMask, xK_Left ), shiftToPrev )<br />
, ((modMask .|. shiftMask, xK_Right ), shiftToNext )<br />
</haskell></div>Datagrokhttps://wiki.haskell.org/index.php?title=Xmonad/Using_xmonad_in_Gnome&diff=20333Xmonad/Using xmonad in Gnome2008-03-30T00:27:45Z<p>Datagrok: include the 'alternate mod key' in the main config example</p>
<hr />
<div>{{xmonad}}<br />
[[Category:XMonad]]<br />
<br />
==Introduction==<br />
<br />
[[Image:Screen-nomeata-ewhm.png|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
Xmonad makes an excellent drop-in replacement for Gnome's default window manager (metacity) giving you a slick tiling window manager. This guide will help you set up Gnome to use Xmonad 0.6.<br />
<br />
This is an update to the previous page on [[Xmonad/Using xmonad in Gnome/0.5]], <br />
which in turn was an update to the<br />
[http://xmonad.org/gnome.html original page on the subject].<br />
<br />
==Setting up Gnome to use Xmonad==<br />
<br />
The easiest way is to let Gnome start Xmonad itself by modifying ''~/.gnomerc'' to contain<br />
<br />
export WINDOW_MANAGER=/usr/bin/xmonad<br />
<br />
==Configure Xmonad to interoperate with Gnome==<br />
<br />
Put this in ''~/.xmonad/xmonad.hs'':<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Hooks.ManageDocks<br />
import XMonad.Hooks.EwmhDesktops<br />
<br />
main = xmonad $ defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, logHook = ewmhDesktopsLogHook<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
, modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
This should set up Xmonad to make space for Gnome's panel and status bar automatically. <br />
<br />
Having done this, you should now be able to use Gnome with Xmonad, and most things will work. At the time of writing, there are a couple of things that don't fully work: clicking on the taskbar to select a window doesn't focus the window, and clicking on the panel to switch desktops doesn't. Of course you can use the standard Xmonad keys to perform these actions instead. <br />
<br />
Explanations of the various options are given below, along with some other things you might want to tweak.<br />
<br />
[[Image:screen-ohmega-tab-gnome-twopane-thumb.jpg|center]]<br />
<br />
==Tweak Gnome to work better with Xmonad==<br />
<br />
These are a few steps that greatly improves the experience of running Xmonad under Gnome. Note that on some systems the binary <tt>gconftool</tt> is called <tt>gconftool-2</tt>.<br />
<br />
===Disable the Nautilus desktop===<br />
<br />
From the command line execute:<br />
<br />
gconftool --type boolean --set /apps/nautilus/preferences/show_desktop false<br />
<br />
===Changing desktop background===<br />
<br />
If you need to change the workspace background programmatically (i.e. from some extension setting in xmonad's configuration file), you can use the command:<br />
<br />
gconftool --type string --set /desktop/gnome/background/picture_filename "/path/to/your/image.png"<br />
<br />
===Fixing the pointer===<br />
<br />
After switching to Xmonad you might notice that the default pointer isn't the one you chose in your beautiful Gnome theme. The way to address this is to run ''xsetroot'' during session startup. Open the session configuration dialogue (''System -> Preferences -> Sessions''). Add a new startup program, choose any name and comment you want but make the command <br />
<br />
/usr/bin/xsetroot -cursor_name left_ptr<br />
<br />
==Tips on configuring Xmonad==<br />
<br />
Allthe configuration is done in <tt>~/.xmonad/xmonad.hs</tt>.<br />
<br />
===Change the mod key===<br />
<br />
The default ''mod key'' is ''alt'', which conflicts with Gnome keybindings. In order to use be able to use the keyboard to e.g. getting rid of dialogues we rebind it to the left ''logo key'':<br />
<br />
<haskell><br />
main = xmonad $ defaultConfig {<br />
modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
===Make space for the panel===<br />
<br />
There are two options for creating space for the Gnome panel; the builtin way using ''gaps'' and [http://hackage.haskell.org/packages/archive/xmonad-contrib/0.5/doc/html/XMonad-Hooks-ManageDocks.html ManageDocks]. The ManageDocks method has been used in the configuration provided above.<br />
<br />
Configuring ''gaps'' looks like this:<br />
<br />
<haskell><br />
main = xmonad $ defaultConfig {<br />
defaultGaps = [(24,24,0,0)]<br />
}<br />
</haskell><br />
<br />
Configuring ''ManageDocks'' looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.ManageDocks<br />
main = xmonad defaultConfig {<br />
manageHook = manageDocks<br />
, layoutHook = avoidStruts (tall ||| mirror tall ||| Full)<br />
}<br />
where tall = Tall 1 (3/100) (1/2)<br />
</haskell><br />
<br />
===Extended Window Manager Hints===<br />
<br />
[http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-EwmhDesktops.html EwmhDesktop] makes it possible to let Gnome know about Xmonad windows and workspaces. EwmhDesktop has been enabled in the example configuration above. By itself, configuring XMonad with EwmhDesktop looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.EwmhDesktops<br />
main = xmonad $ defaultConfig {<br />
logHook = ewmhDesktopsLogHook<br />
}<br />
</haskell><br />
<br />
===Key bindings for switching desktops===<br />
<br />
Gnome lays out the desktops in a row by default, and uses Ctrl+Alt+Left/Right for switching desktops left/right. To get similar behaviour in Xmonad, you need to add some keybindings. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-CycleWS.html XMonad.Actions.CycleWS] has some useful actions for cycling workspaces, and I use these keybindings:<br />
<br />
<haskell><br />
-- moving workspaces<br />
, ((modMask, xK_Left ), prevWS )<br />
, ((modMask, xK_Right ), nextWS )<br />
, ((modMask .|. shiftMask, xK_Left ), shiftToPrev )<br />
, ((modMask .|. shiftMask, xK_Right ), shiftToNext )<br />
</haskell></div>Datagrokhttps://wiki.haskell.org/index.php?title=Xmonad/Using_xmonad_in_Gnome&diff=20331Xmonad/Using xmonad in Gnome2008-03-30T00:21:37Z<p>Datagrok: minimize the example configuration to exclude things which aren't specific to getting Gnome to work</p>
<hr />
<div>{{xmonad}}<br />
[[Category:XMonad]]<br />
<br />
==Introduction==<br />
<br />
[[Image:Screen-nomeata-ewhm.png|200px|A screenshot of xmonad cooperating with gnome|center]]<br />
<br />
Xmonad makes an excellent drop-in replacement for Gnome's default window manager (metacity) giving you a slick tiling window manager. This guide will help you set up Gnome to use Xmonad 0.6.<br />
<br />
This is an update to the previous page on [[Xmonad/Using xmonad in Gnome/0.5]], <br />
which in turn was an update to the<br />
[http://xmonad.org/gnome.html original page on the subject].<br />
<br />
==Setting up Gnome to use Xmonad==<br />
<br />
The easiest way is to let Gnome start Xmonad itself by modifying ''~/.gnomerc'' to contain<br />
<br />
export WINDOW_MANAGER=/usr/bin/xmonad<br />
<br />
==Configure Xmonad to interoperate with Gnome==<br />
<br />
Put this in ''~/.xmonad/xmonad.hs'':<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Hooks.ManageDocks<br />
import XMonad.Hooks.EwmhDesktops<br />
<br />
main = xmonad $ defaultConfig<br />
{ manageHook = manageDocks <+> manageHook defaultConfig<br />
, logHook = ewmhDesktopsLogHook<br />
, layoutHook = avoidStruts $ layoutHook defaultConfig<br />
}<br />
</haskell><br />
<br />
This should set up Xmonad to make space for Gnome's panel and status bar automatically. <br />
<br />
Having done this, you should now be able to use Gnome with Xmonad, and most things will work. At the time of writing, there are a couple of things that don't fully work: clicking on the taskbar to select a window doesn't focus the window, and clicking on the panel to switch desktops doesn't. Of course you can use the standard Xmonad keys to perform these actions instead. <br />
<br />
Explanations of the various options are given below, along with some other things you might want to tweak.<br />
<br />
[[Image:screen-ohmega-tab-gnome-twopane-thumb.jpg|center]]<br />
<br />
==Tweak Gnome to work better with Xmonad==<br />
<br />
These are a few steps that greatly improves the experience of running Xmonad under Gnome. Note that on some systems the binary <tt>gconftool</tt> is called <tt>gconftool-2</tt>.<br />
<br />
===Disable the Nautilus desktop===<br />
<br />
From the command line execute:<br />
<br />
gconftool --type boolean --set /apps/nautilus/preferences/show_desktop false<br />
<br />
===Changing desktop background===<br />
<br />
If you need to change the workspace background programmatically (i.e. from some extension setting in xmonad's configuration file), you can use the command:<br />
<br />
gconftool --type string --set /desktop/gnome/background/picture_filename "/path/to/your/image.png"<br />
<br />
===Fixing the pointer===<br />
<br />
After switching to Xmonad you might notice that the default pointer isn't the one you chose in your beautiful Gnome theme. The way to address this is to run ''xsetroot'' during session startup. Open the session configuration dialogue (''System -> Preferences -> Sessions''). Add a new startup program, choose any name and comment you want but make the command <br />
<br />
/usr/bin/xsetroot -cursor_name left_ptr<br />
<br />
==Tips on configuring Xmonad==<br />
<br />
Allthe configuration is done in <tt>~/.xmonad/xmonad.hs</tt>.<br />
<br />
===Change the mod key===<br />
<br />
The default ''mod key'' is ''alt'', which conflicts with Gnome keybindings. In order to use be able to use the keyboard to e.g. getting rid of dialogues we rebind it to the left ''logo key'':<br />
<br />
<haskell><br />
main = xmonad $ defaultConfig {<br />
modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
===Make space for the panel===<br />
<br />
There are two options for creating space for the Gnome panel; the builtin way using ''gaps'' and [http://hackage.haskell.org/packages/archive/xmonad-contrib/0.5/doc/html/XMonad-Hooks-ManageDocks.html ManageDocks]. The ManageDocks method has been used in the configuration provided above.<br />
<br />
Configuring ''gaps'' looks like this:<br />
<br />
<haskell><br />
main = xmonad $ defaultConfig {<br />
defaultGaps = [(24,24,0,0)]<br />
}<br />
</haskell><br />
<br />
Configuring ''ManageDocks'' looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.ManageDocks<br />
main = xmonad defaultConfig {<br />
manageHook = manageDocks<br />
, layoutHook = avoidStruts (tall ||| mirror tall ||| Full)<br />
}<br />
where tall = Tall 1 (3/100) (1/2)<br />
</haskell><br />
<br />
===Extended Window Manager Hints===<br />
<br />
[http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-EwmhDesktops.html EwmhDesktop] makes it possible to let Gnome know about Xmonad windows and workspaces. EwmhDesktop has been enabled in the example configuration above. By itself, configuring XMonad with EwmhDesktop looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.EwmhDesktops<br />
main = xmonad $ defaultConfig {<br />
logHook = ewmhDesktopsLogHook<br />
}<br />
</haskell><br />
<br />
===Key bindings for switching desktops===<br />
<br />
Gnome lays out the desktops in a row by default, and uses Ctrl+Alt+Left/Right for switching desktops left/right. To get similar behaviour in Xmonad, you need to add some keybindings. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-CycleWS.html XMonad.Actions.CycleWS] has some useful actions for cycling workspaces, and I use these keybindings:<br />
<br />
<haskell><br />
-- moving workspaces<br />
, ((modMask, xK_Left ), prevWS )<br />
, ((modMask, xK_Right ), nextWS )<br />
, ((modMask .|. shiftMask, xK_Left ), shiftToPrev )<br />
, ((modMask .|. shiftMask, xK_Right ), shiftToNext )<br />
</haskell></div>Datagrokhttps://wiki.haskell.org/index.php?title=User:Datagrok&diff=20329User:Datagrok2008-03-30T00:02:09Z<p>Datagrok: </p>
<hr />
<div>'''User:Datagrok''' is the user page for [http://datagrok.org Michael F. Lamb]. My personal website is [http://datagrok.org datagrok.org].</div>Datagrokhttps://wiki.haskell.org/index.php?title=Xmonad/Using_xmonad_in_Gnome&diff=20320Xmonad/Using xmonad in Gnome2008-03-29T23:37:07Z<p>Datagrok: simplify summary; update "extra tweaks" to note that some have been applied in summary</p>
<hr />
<div>==Introduction==<br />
<br />
[[Image:Screen-nomeata-ewhm.png|300px|A screenshot of xmonad cooperating with gnome]]<br />
<br />
Xmonad makes an excellent drop-in replacement for Gnome's default window manager (metacity) giving you a slick tiling window manager. This guide will help you set up Gnome to use Xmonad 0.6.<br />
<br />
This is an update to the previous page on [[Xmonad/Using xmonad in Gnome/0.5]], <br />
which in turn was an update to the<br />
[http://xmonad.org/gnome.html original page on the subject].<br />
<br />
==Setting up Gnome to use Xmonad==<br />
<br />
The easiest way is to let Gnome start Xmonad itself by modifying ''~/.gnomerc'' to contain<br />
<br />
export WINDOW_MANAGER=/usr/bin/xmonad<br />
<br />
==Configure Xmonad to interoperate with Gnome==<br />
<br />
Put this in ''~/.xmonad/xmonad.hs'':<br />
<br />
<haskell><br />
import XMonad<br />
import XMonad.Hooks.ManageDocks<br />
import XMonad.Hooks.EwmhDesktops<br />
<br />
main = xmonad $ defaultConfig<br />
{ borderWidth = 2<br />
, manageHook = manageDocks<br />
, workspaces = map show [1 .. 5 :: Int]<br />
, logHook = ewmhDesktopsLogHook<br />
, layoutHook = avoidStruts (tall ||| Mirror tall ||| Full)<br />
}<br />
where tall = Tall 1 (3/100) (1/2)<br />
</haskell><br />
<br />
This should set up Xmonad to make space for Gnome's panel and status bar automatically. <br />
<br />
Having done this, you should now be able to use Gnome with Xmonad, and most things will work. At the time of writing, there are a couple of things that don't fully work: clicking on the taskbar to select a window doesn't focus the window, and clicking on the panel to switch desktops doesn't. Of course you can use the standard Xmonad keys to perform these actions instead. <br />
<br />
Explanations of the various options are given below, along with some other things you might want to tweak.<br />
<br />
==Tweak Gnome to work better with Xmonad==<br />
<br />
These are a few steps that greatly improves the experience of running Xmonad under Gnome. Note that on some systems the binary <tt>gconftool</tt> is called <tt>gconftool-2</tt>.<br />
<br />
===Disable the Nautilus desktop===<br />
<br />
From the command line execute:<br />
<br />
gconftool --type boolean --set /apps/nautilus/preferences/show_desktop false<br />
<br />
===Changing desktop background===<br />
<br />
If you need to change the workspace background programmatically (i.e. from some extension setting in xmonad's configuration file), you can use the command:<br />
<br />
gconftool --type string --set /desktop/gnome/background/picture_filename "/path/to/your/image.png"<br />
<br />
===Fixing the pointer===<br />
<br />
After switching to Xmonad you might notice that the default pointer isn't the one you chose in your beautiful Gnome theme. The way to address this is to run ''xsetroot'' during session startup. Open the session configuration dialogue (''System -> Preferences -> Sessions''). Add a new startup program, choose any name and comment you want but make the command <br />
<br />
/usr/bin/xsetroot -cursor_name left_ptr<br />
<br />
==Tips on configuring Xmonad==<br />
<br />
Allthe configuration is done in <tt>~/.xmonad/xmonad.hs</tt>.<br />
<br />
===Change the mod key===<br />
<br />
The default ''mod key'' is ''alt'', which conflicts with Gnome keybindings. In order to use be able to use the keyboard to e.g. getting rid of dialogues we rebind it to the left ''logo key'':<br />
<br />
<haskell><br />
main = xmonad $ defaultConfig {<br />
modMask = mod4Mask<br />
}<br />
</haskell><br />
<br />
===Make space for the panel===<br />
<br />
There are two options for creating space for the Gnome panel; the builtin way using ''gaps'' and [http://hackage.haskell.org/packages/archive/xmonad-contrib/0.5/doc/html/XMonad-Hooks-ManageDocks.html ManageDocks]. The ManageDocks method has been used in the configuration provided above.<br />
<br />
Configuring ''gaps'' looks like this:<br />
<br />
<haskell><br />
main = xmonad $ defaultConfig {<br />
defaultGaps = [(24,24,0,0)]<br />
}<br />
</haskell><br />
<br />
Configuring ''ManageDocks'' looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.ManageDocks<br />
main = xmonad defaultConfig {<br />
manageHook = manageDocks<br />
, layoutHook = avoidStruts (tall ||| mirror tall ||| Full)<br />
}<br />
where tall = Tall 1 (3/100) (1/2)<br />
</haskell><br />
<br />
===Extended Window Manager Hints===<br />
<br />
[http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-EwmhDesktops.html EwmhDesktop] makes it possible to let Gnome know about Xmonad windows and workspaces. EwmhDesktop has been enabled in the example configuration above. By itself, configuring XMonad with EwmhDesktop looks like this:<br />
<br />
<haskell><br />
import XMonad.Hooks.EwmhDesktops<br />
main = xmonad $ defaultConfig {<br />
logHook = ewmhDesktopsLogHook<br />
}<br />
</haskell><br />
<br />
===Key bindings for switching desktops===<br />
<br />
Gnome lays out the desktops in a row by default, and uses Ctrl+Alt+Left/Right for switching desktops left/right. To get similar behaviour in Xmonad, you need to add some keybindings. The contrib module [http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-CycleWS.html XMonad.Actions.CycleWS] has some useful actions for cycling workspaces, and I use these keybindings:<br />
<br />
<haskell><br />
-- moving workspaces<br />
, ((modMask, xK_Left ), prevWS )<br />
, ((modMask, xK_Right ), nextWS )<br />
, ((modMask .|. shiftMask, xK_Left ), shiftToPrev )<br />
, ((modMask .|. shiftMask, xK_Right ), shiftToNext )<br />
</haskell></div>Datagrok