After upgraded to 14.10, gnome-settings-daemon cannot be loaded properly /usr/share/gnome-session/sessions/xmonad.session. is there anyone has the same problem?
5 Answers
Here's a more detailed solution based on Jianingy answer. It fixes a few issues I was having after upgrading to Ubuntu 14.10. The issues it's fixing include:
- Multimedia keys not working
- Display settings in Gnome-control-center not working
You need to add DesktopName=Unity to /usr/share/gnome-session/sessions/xmonad.session.
[GNOME Session]
Name=Xmonad/GNOME
RequiredComponents=gnome-settings-daemon;gnome-panel;xmonad
DesktopName=Unity
Also, regarding dbus-send changes in Ubuntu 14.10, you have to use --print-reply=literal instead of --print-reply=string. I have added that to my xmonad.hs and I define main as main = xmonad $ gnomeConfig2.
import XMonad.Config.Desktop
import XMonad.Util.Run (safeSpawn)
import qualified Data.Map as M
import System.Environment (getEnvironment)
data RescreenToggleState = RescreenToggleState Bool deriving Typeable
instance ExtensionClass RescreenToggleState where
initialValue = RescreenToggleState True
gnomeConfig2 = desktopConfig
{ terminal = "gnome-terminal"
, keys = gnomeKeys <+> keys desktopConfig
, startupHook = gnomeRegister2 >> startupHook desktopConfig }
gnomeKeys (XConfig {modMask = modm}) = M.fromList $
[ ((modm, xK_p), gnomeRun)
, ((modm .|. shiftMask, xK_q), spawn "gnome-session-save --kill") ]
-- | Register xmonad with gnome. 'dbus-send' must be in the $PATH with which
-- xmonad is started.
--
-- This action reduces a delay on startup only only if you have configured
-- gnome-session>=2.26: to start xmonad with a command as such:
--
-- > gconftool-2 -s /desktop/gnome/session/required_components/windowmanager xmonad --type string
gnomeRegister2 :: MonadIO m => m ()
gnomeRegister2 = io $ do
x <- lookup "DESKTOP_AUTOSTART_ID" `fmap` getEnvironment
whenJust x $ \sessionId -> safeSpawn "dbus-send"
["--session"
,"--print-reply=literal"
,"--dest=org.gnome.SessionManager"
,"/org/gnome/SessionManager"
,"org.gnome.SessionManager.RegisterClient"
,"string:xmonad"
,"string:"++sessionId]
- 36,890
- 56
- 97
- 151
- 266
OK, I found a solution.
First of all, Starting from 14.10. Many unity and gnome application configurations ( those *.desktop in /usr/share/applications and /etc/xdg/autostart ) start to include a "OnlyShowIn=Unity". Therefore we have to add a desktopname=unity to /usr/share/gnome-session/sessions/xmonad.session in order to let those applications run.
Second, cmd 'dbus-send --print-reply=string' now have to be 'dbus-send --print-reply=literal'. therefore, old xmonad gnomeConfig cannot register xmonad as a wm. we have to change the dbus-send command from =string to =literal.
- 63
- 4
- https://gist.github.com/bewest/46b849da04684f0ce401
- http://blog.ezyang.com/2014/12/ubuntu-utopic-upgrade-xmonad/comment-page-1/
The --print-reply=string syntax causes an error.
The name of the application that needs to be "registered" is not xmonad, but xmonad.desktop.
I wound up creating a ~/.xmonad/hooks file with the following command in it:
dbus-send --session --print-reply --dest=org.gnome.SessionManager /org/gnome/SessionManager org.gnome.SessionManager.RegisterClient string:xmonad.desktop string:$DESKTOP_AUTO_START_ID
I also found the previous fix, setting DesktopName=Unity causes the gnome-control-center to be used properly.
- 141
- 4
Here is a very simple way to workaround the "xmonad fails to register" problem (addressed in other answers by using xmonad hooks or writing gnomeRegister2): in the xmonad.desktop file, replace Exec=xmonad with Exec=sh -c "xmonad &". This results in a very fast startup -- I got the idea here -- but it might break other things.
The DesktopName=Unity part is still essential.
UPDATE (16 November 2015)
I regularly fight XMonad + Gnome when I upgrade Ubuntu. My config files are available on GitHub, in case anyone would like to see how I've most recently gotten XMonad and Gnome to play nice together.
As of 16 November 2015, the important files are
~/.xsession: https://github.com/ntc2/conf/blob/master/dot.xsession- Gnome
*.desktopfiles: https://github.com/ntc2/conf/tree/master/dot.local/share/applications (I maintain my XMonad + Gnome config in my home dir, without having to edit any system*.desktopfiles; see my conf install script for where these files go). - Gnome
*.sessionfile: https://github.com/ntc2/conf/blob/master/dot.config/gnome-session/sessions/local-xmonad-session.session
For Ubuntu 15.04 and 15.10, the most important, and hardest to discover change was to add export XDG_CURRENT_DESKTOP=Unity to my ~/.xsession:
# Without setting this explicitly, it gets te value "Gnome", which
# makes `unity-settings-daemon` fail to start and we get
# `gnome-settings-daemon` instead. Not sure what this variable does,
# but I got the hint here:
# https://bugzilla.gnome.org/show_bug.cgi?id=729575.
#
# Setting to values other than "Unity" -- e.g. "default", which `env`
# tells me is the value of related variables, or "GNOME-Flashback",
# which is the `DesktopName` I might suspect here -- I get weird
# behavior, e.g. none of the dock items appear in the Gnome panel.
export XDG_CURRENT_DESKTOP=Unity
Also, to get graphical notifications on e.g. volume key presses and screen brightness adjustment, I needed to install the notify-osd package.
I mentioned it briefly in the gist, but I found in the XMonad docs, that the startup hook is executed automatically given, this config:
, startupHook = execScriptHook "startup"
This causes the shell script to be run automatically, which I found easier than monkeypatching the haskell hook.
http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-Script.html
XMonad.Hooks.Script
Script Hook Interface
Provides a simple interface for running a ~/.xmonad/hooks script with the name of a hook.
Synopsis
Usage
This module allows you to run a centrally located script with the text name of a hook. The script is assumed to be located at ~/.xmonad/hooks.
For example, if you wanted to run the hook startup in your script every time your startup hook ran, you could modify your xmonad config as such:
main = xmonad $ defaultConfig {
...
startupHook = execScriptHook "startup"
...
}
Now, every time the startup hook runs, the command ~/.xmonad/hooks startup will also.
- 141
- 4