Archive:Getting Started/Run/Full Session: Difference between revisions

From KDE TechBase
(Removed i18n bar (unused))
(set all necessary environment variables, make sure dbus sees them, and describe how to fix polkit)
Line 1: Line 1:
== Full KDE 4 session ==
= Full KDE 4 session =
 
To run a full KDE 4 desktop environment session, you can either start it from the command line as you normally would, with something like this:
To run a full KDE 4 desktop environment session, you can either start it from the command line as you normally would, with something like this:


  X :1 & export DISPLAY=:1
  X :1 & export DISPLAY=:1
  startkde
  $HOME/startkde-wrapper


{{Note|If the X server refuses the connection saying something like: <tt>Xlib: connection to ":1.0" refused by server</tt>, try <tt>X -ac :1</tt> instead.}}
{{Note|If the X server refuses the connection saying something like: <tt>Xlib: connection to ":1.0" refused by server</tt>, try <tt>X -ac :1</tt> instead.}}


or you can can add it to your login manager. If you are using KDM (or a compatible login manager) this is done by creating a .desktop file in either {{path|`kde-config --prefix`/share/apps/kdm/sessions/}} or in {{path|/usr/share/xsessions/}}. The easiest thing to do is to copy an existing {{path|kde.desktop}} file and name it {{path|kde4.desktop}}. Open this new .desktop file in a text editor and change the <tt>Exec</tt>, <tt>TryExec</tt> and <tt>Name</tt> entries to look something like this:
{{path|startkde-wrapper}} sets some environment variables which are required to make KDE run properly in a nun-/usr environment:
<syntaxhighlight lang="bash">
#!/bin/sh
export KDEDIR="$HOME/kde"
 
AddToPath() {
        eval "export $1=$2\${$1+:\$$1}" # prepend to existing path, if there is one
}
 
AddToPath PATH "$KDEDIR/bin"
AddToPath LD_LIBRARY_PATH "$KDEDIR/lib"
AddToPath QT_PLUGIN_PATH "$KDEDIR/lib/kde4/plugins:$KDEDIR/lib/qt4/plugins"
AddToPath PKG_CONFIG_PATH "$KDEDIR/lib/pkgconfig"
AddToPath CMAKE_PREFIX_PATH "$KDEDIR"
export XDG_DATA_DIRS="$KDEDIR/share:/usr/share"
export XDG_CONFIG_DIRS="$KDEDIR/etc/xdg:/etc/xdg"
export KDEDIRS="$KDEDIR"
exec startkde "$@"
</syntaxhighlight>
 
Replace {{path|$HOME/kde}} in the example above with the prefix you are installing KDE4 into. If you want to, also add "export KDEHOME=$HOME/.kde4" to change the path KDE configuration is stored in.


<syntaxhighlight lang="ini">
== Using the login manager (a) ==
Exec=$HOME/kde/bin/startkde
 
TryExec=$HOME/kde/bin/startkde
Alternatively, you can can add it to your login manager. To make sure that even the daemons started by the X login process use the correct files, create a file called {{path|.xsessionrc}} in your home folder, which sets up the environment:
Name=KDE4
 
<syntaxhighlight lang="bash">
export KDEDIR="$HOME/kde"
 
AddToPath() {
        eval "export $1=$2\${$1+:\$$1}" # prepend to existing path, if there is one
}
 
AddToPath PATH "$KDEDIR/bin"
AddToPath LD_LIBRARY_PATH "$KDEDIR/lib"
AddToPath QT_PLUGIN_PATH "$KDEDIR/lib/kde4/plugins:$KDEDIR/lib/qt4/plugins"
AddToPath PKG_CONFIG_PATH "$KDEDIR/lib/pkgconfig"
AddToPath CMAKE_PREFIX_PATH "$KDEDIR"
export XDG_DATA_DIRS="$KDEDIR/share:/usr/share"
export XDG_CONFIG_DIRS="$KDEDIR/etc/xdg:/etc/xdg"
export KDEDIRS="$KDEDIR"
</syntaxhighlight>
 
Replace {{path|$HOME/kde}} in the example above with the prefix you are installing KDE4 into. Finally, create a file called {{path|$HOME/.xsession}} which actually starts KDE:
 
<syntaxhighlight lang="bash">
exec startkde "$@"
</syntaxhighlight>
 
However, even after following these steps, authentication of configuration changes using polkit (for example, changing the clock or the KDM settings) will not work. Unfortunately, you can not set up several KDE installations properly to allow this - you can change your system configuration so that your self-compiled KDE will be able to use polkit, but then this will stop working in the distribution-provided KDE, or another self-compiled KDE in a different prefix. To do so, create a file called {{path|/etc/dbus-1/system.d/kde-selfcompiled.conf}} with the following content:
 
<syntaxhighlight lang="xml">
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
 
  <includedir>/home/usr/kde/etc/dbus-1/system.d</includedir>
  <servicedir>/home/usr/kde/share/dbus-1/system-services</servicedir>
 
</busconfig>
</syntaxhighlight>
</syntaxhighlight>


Replace {{path|$HOME/kde}} in the example above with the prefix you are installing KDE4 into.
Again, replace  {{path|/home/user/kde}} by your installation prefix. In the login manager, make sure you select the "Standard" session.


After restarting the login manager (<tt>Alt+e</tt> in KDM) this new entry should appear in the sessions menu.
== Using the login manager (b) ==


You might have to edit your startkde scripts,  
The configuration method described above will hard-wire that user to always use your self-compiled KDE, no matter what you select in the login manager (selecting the distro-provided KDE may even result in funny effects). If you are using KDM (or a compatible login manager) and want to be able to select the session type before logging in, create a .desktop file in either {{path|$(kde-config --prefix)/share/apps/kdm/sessions/}} or in {{path|/usr/share/xsessions/}}. The easiest thing to do is to copy an existing {{path|kde.desktop}} file and name it {{path|kde4.desktop}}. Open this new .desktop file in a text editor and change the <tt>Exec</tt>, <tt>TryExec</tt> and <tt>Name</tt> entries to look something like this:
ie: change


this
<syntaxhighlight lang="ini">kdehome=$HOME/.kde</syntaxhighlight>
to this
<syntaxhighlight lang="ini">kdehome=$HOME/.kde4</syntaxhighlight>
or paste this
<syntaxhighlight lang="ini">
<syntaxhighlight lang="ini">
export KDEDIR=`kde4-config --prefix`
Exec=$HOME/startkde-wrapper
export LD_LIBRARY_PATH=$KDEDIR/lib:$LD_LIBRARY_PATH
TryExec=$HOME/startkde-wrapper
export PATH=$KDEDIR/bin/:$PATH
Name=KDE4 (self-compiled)
export KDEHOME=~/.kde4
</syntaxhighlight>
</syntaxhighlight>
on top.


{{Note|You should have path to 'qdbus' program (usually it is $QTDIR/bin) in your $PATH to login successfully. If it is not there, you'll get an error message "Could not start DBus. Check your installation."}}
Using the {{path|startkde-wrapper}} from the top of this page.
 
After restarting the login manager (<tt>Alt+e</tt> in KDM) this new entry should appear in the sessions menu. However, since the new environment variables will not effect dbus in this setup, there might be some issues.
 
 


[[Category:KDE4]]
[[Category:KDE4]]

Revision as of 22:28, 22 February 2012

Full KDE 4 session

To run a full KDE 4 desktop environment session, you can either start it from the command line as you normally would, with something like this:

X :1 & export DISPLAY=:1
$HOME/startkde-wrapper
Note
If the X server refuses the connection saying something like: Xlib: connection to ":1.0" refused by server, try X -ac :1 instead.


startkde-wrapper sets some environment variables which are required to make KDE run properly in a nun-/usr environment:

#!/bin/sh
export KDEDIR="$HOME/kde"

AddToPath() {
        eval "export $1=$2\${$1+:\$$1}" # prepend to existing path, if there is one
}

AddToPath PATH "$KDEDIR/bin"
AddToPath LD_LIBRARY_PATH "$KDEDIR/lib"
AddToPath QT_PLUGIN_PATH "$KDEDIR/lib/kde4/plugins:$KDEDIR/lib/qt4/plugins"
AddToPath PKG_CONFIG_PATH "$KDEDIR/lib/pkgconfig"
AddToPath CMAKE_PREFIX_PATH "$KDEDIR"
export XDG_DATA_DIRS="$KDEDIR/share:/usr/share"
export XDG_CONFIG_DIRS="$KDEDIR/etc/xdg:/etc/xdg"
export KDEDIRS="$KDEDIR"
exec startkde "$@"

Replace $HOME/kde in the example above with the prefix you are installing KDE4 into. If you want to, also add "export KDEHOME=$HOME/.kde4" to change the path KDE configuration is stored in.

Using the login manager (a)

Alternatively, you can can add it to your login manager. To make sure that even the daemons started by the X login process use the correct files, create a file called .xsessionrc in your home folder, which sets up the environment:

export KDEDIR="$HOME/kde"

AddToPath() {
        eval "export $1=$2\${$1+:\$$1}" # prepend to existing path, if there is one
}

AddToPath PATH "$KDEDIR/bin"
AddToPath LD_LIBRARY_PATH "$KDEDIR/lib"
AddToPath QT_PLUGIN_PATH "$KDEDIR/lib/kde4/plugins:$KDEDIR/lib/qt4/plugins"
AddToPath PKG_CONFIG_PATH "$KDEDIR/lib/pkgconfig"
AddToPath CMAKE_PREFIX_PATH "$KDEDIR"
export XDG_DATA_DIRS="$KDEDIR/share:/usr/share"
export XDG_CONFIG_DIRS="$KDEDIR/etc/xdg:/etc/xdg"
export KDEDIRS="$KDEDIR"

Replace $HOME/kde in the example above with the prefix you are installing KDE4 into. Finally, create a file called $HOME/.xsession which actually starts KDE:

exec startkde "$@"

However, even after following these steps, authentication of configuration changes using polkit (for example, changing the clock or the KDM settings) will not work. Unfortunately, you can not set up several KDE installations properly to allow this - you can change your system configuration so that your self-compiled KDE will be able to use polkit, but then this will stop working in the distribution-provided KDE, or another self-compiled KDE in a different prefix. To do so, create a file called /etc/dbus-1/system.d/kde-selfcompiled.conf with the following content:

<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>

  <includedir>/home/usr/kde/etc/dbus-1/system.d</includedir>
  <servicedir>/home/usr/kde/share/dbus-1/system-services</servicedir>

</busconfig>

Again, replace /home/user/kde by your installation prefix. In the login manager, make sure you select the "Standard" session.

Using the login manager (b)

The configuration method described above will hard-wire that user to always use your self-compiled KDE, no matter what you select in the login manager (selecting the distro-provided KDE may even result in funny effects). If you are using KDM (or a compatible login manager) and want to be able to select the session type before logging in, create a .desktop file in either $(kde-config --prefix)/share/apps/kdm/sessions/ or in /usr/share/xsessions/. The easiest thing to do is to copy an existing kde.desktop file and name it kde4.desktop. Open this new .desktop file in a text editor and change the Exec, TryExec and Name entries to look something like this:

Exec=$HOME/startkde-wrapper
TryExec=$HOME/startkde-wrapper
Name=KDE4 (self-compiled)

Using the startkde-wrapper from the top of this page.

After restarting the login manager (Alt+e in KDM) this new entry should appear in the sessions menu. However, since the new environment variables will not effect dbus in this setup, there might be some issues.