From 9cb9621fec0edbae5837d6a3e84146f3545023e2 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 28 Mar 2007 21:16:35 +0000 Subject: [PATCH] * Start KDE properly. Make sure that some essential packages such as iceauth are in the system path when we're using KDE. svn path=/nixos/trunk/; revision=8472 --- system/options.nix | 28 +++++++----- system/upstart.nix | 2 +- upstart-jobs/xserver.conf | 2 + upstart-jobs/xserver.nix | 96 +++++++++++++++++++++++++++++---------- 4 files changed, 90 insertions(+), 38 deletions(-) diff --git a/system/options.nix b/system/options.nix index 789a00f58a27..cb1b4223901f 100644 --- a/system/options.nix +++ b/system/options.nix @@ -530,30 +530,34 @@ } - { - name = ["services" "xserver" "windowManager"]; - default = "metacity"; - description = " - This option selects the window manager. Available values are - twm (extremely primitive), - metacity, and compiz. - "; - } - - { name = ["services" "xserver" "sessionType"]; default = "gnome"; example = "xterm"; description = " The kind of session to start after login. Current possibilies - are gnome (which starts + are kde (which starts KDE), + gnome (which starts gnome-terminal) and xterm (which starts xterm). "; } + { + name = ["services" "xserver" "windowManager"]; + default = ""; + description = " + This option selects the window manager. Available values are + twm (extremely primitive), + metacity, and compiz. If + left empty, the determines the + window manager, e.g., Metacity for Gnome, and + kwm for KDE. + "; + } + + { name = ["services" "xserver" "sessionStarter"]; example = "${pkgs.xterm}/bin/xterm -ls"; diff --git a/system/upstart.nix b/system/upstart.nix index 09c82fae53fe..d835b794762b 100644 --- a/system/upstart.nix +++ b/system/upstart.nix @@ -134,7 +134,7 @@ import ../upstart-jobs/gather.nix { (import ../upstart-jobs/xserver.nix { inherit config; inherit (pkgs) stdenv writeText lib xterm slim xorg mesa - gnome compiz feh; + gnome compiz feh kdebase kdelibs; fontDirectories = import ./fonts.nix {inherit pkgs;}; }) diff --git a/upstart-jobs/xserver.conf b/upstart-jobs/xserver.conf index 0a655dd5e86a..ed624cf1720a 100644 --- a/upstart-jobs/xserver.conf +++ b/upstart-jobs/xserver.conf @@ -64,6 +64,8 @@ EndSection Section "Device" Identifier "Device[0]" Driver "@videoDriver@" + Option "Clone" "On" + Option "MonitorLayout" "CRT,LFP" EndSection diff --git a/upstart-jobs/xserver.nix b/upstart-jobs/xserver.nix index 1ca2ea1fb85a..a69db80a44c2 100644 --- a/upstart-jobs/xserver.nix +++ b/upstart-jobs/xserver.nix @@ -1,5 +1,6 @@ { stdenv, writeText, lib, xorg, mesa, xterm, slim, gnome , compiz, feh +, kdelibs, kdebase , config @@ -24,7 +25,6 @@ let # Get a bunch of user settings. videoDriver = getCfg "videoDriver"; resolutions = map (res: "\"${toString res.x}x${toString res.y}\"") (getCfg "resolutions"); - windowManager = getCfg "windowManager"; sessionType = getCfg "sessionType"; sessionStarter = getCfg "sessionStarter"; @@ -36,6 +36,14 @@ let abort ("unknown session type "+ sessionType); + windowManager = + let wm = getCfg "windowManager"; in + if wm != "" then wm else + if sessionType == "gnome" then "metacity" else + if sessionType == "kde" then "none" /* started by startkde */ else + "twm"; + + modules = [ xorg.xorgserver xorg.xf86inputkeyboard @@ -75,52 +83,84 @@ let clientScript = writeText "xclient" " + source /etc/profile + exec > $HOME/.Xerrors 2>&1 ### Start a window manager. ${if windowManager == "twm" then " - ${xorg.twm}/bin/twm & + ${xorg.twm}/bin/twm & " else if windowManager == "metacity" then " - # !!! Hack: load the schemas for Metacity. - GCONF_CONFIG_SOURCE=xml::~/.gconf ${gnome.GConf}/bin/gconftool-2 \\ - --makefile-install-rule ${gnome.metacity}/etc/gconf/schemas/*.schemas - ${gnome.metacity}/bin/metacity & + # !!! Hack: load the schemas for Metacity. + GCONF_CONFIG_SOURCE=xml::~/.gconf ${gnome.GConf}/bin/gconftool-2 \\ + --makefile-install-rule ${gnome.metacity}/etc/gconf/schemas/*.schemas + ${gnome.metacity}/bin/metacity & + " + + else if windowManager == "kwm" then " + ${kdebase}/bin/kwin & " else if windowManager == "compiz" then " - # !!! Hack: load the schemas for Compiz. - GCONF_CONFIG_SOURCE=xml::~/.gconf ${gnome.GConf}/bin/gconftool-2 \\ - --makefile-install-rule ${compiz}/etc/gconf/schemas/*.schemas + # !!! Hack: load the schemas for Compiz. + GCONF_CONFIG_SOURCE=xml::~/.gconf ${gnome.GConf}/bin/gconftool-2 \\ + --makefile-install-rule ${compiz}/etc/gconf/schemas/*.schemas - # !!! Hack: turn on most Compiz modules. - ${gnome.GConf}/bin/gconftool-2 -t list --list-type=string \\ - --set /apps/compiz/general/allscreens/options/active_plugins \\ - [gconf,png,decoration,wobbly,fade,minimize,move,resize,cube,switcher,rotate,place,scale,water] + # !!! Hack: turn on most Compiz modules. + ${gnome.GConf}/bin/gconftool-2 -t list --list-type=string \\ + --set /apps/compiz/general/allscreens/options/active_plugins \\ + [gconf,png,decoration,wobbly,fade,minimize,move,resize,cube,switcher,rotate,place,scale,water] - # Start Compiz and the GTK-style window decorator. - ${compiz}/bin/compiz gconf & - ${compiz}/bin/gtk-window-decorator & + # Start Compiz and the GTK-style window decorator. + ${compiz}/bin/compiz gconf & + ${compiz}/bin/gtk-window-decorator & " - else abort ("unknown window manager "+ windowManager)} + else if windowManager == "none" then " + + # The session starter will start the window manager. + + " + + else abort ("unknown window manager " + windowManager)} ### Show a background image. - if test -e $HOME/.background-image; then - ${feh}/bin/feh --bg-scale $HOME/.background-image - fi + # (but not if we're starting a full desktop environment that does it for us) + ${if sessionType != "kde" then " + + if test -e $HOME/.background-image; then + ${feh}/bin/feh --bg-scale $HOME/.background-image + fi + + " else ""} - ### Start a 'session' (right now, this is just a terminal). - # !!! yes, this means that you 'log out' by killing the X server. - while ${sessionCmd}; do - sleep 1 - done + ### Start the session. + ${if sessionType == "kde" then " + + # Start KDE. + export KDEDIRS=${kdebase}:${kdelibs} + export XDG_CONFIG_DIRS=${kdebase}/etc/xdg:${kdelibs}/etc/xdg + export XDG_DATA_DIRS=${kdebase}/share + exec ${kdebase}/bin/startkde + + " else " + + # For all other session types, we currently just start a + # terminal of the kind indicated by sessionCmd. + # !!! yes, this means that you 'log out' by killing the X server. + while ${sessionCmd}; do + sleep 1 + done + + "} + "; # */ <- hack to fix syntax highlighting @@ -170,6 +210,12 @@ rec { gnome.gnometerminal gnome.GConf gnome.gconfeditor + ] + ++ optional (sessionType == "kde") [ + kdelibs + kdebase + xorg.iceauth # absolutely required by dcopserver + xorg.xset # used by startkde, non-essential ];