Beryl

From ArchWiki
Revision as of 16:55, 25 September 2006 by WillySilly (Talk | contribs) (GNOME Desktop)

Jump to: navigation, search

Tango-document-new.pngThis article is a stub.Tango-document-new.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Beryl#)

Beryl is a window and composition manager. It has been created as a fork of compiz. Beryl is currently only available via svn, although a first release is expected soon.

Installing Beryl

Beryl is only available through SVN right now. PKGBUILDs for the components can be found in AUR:

To build these packages, use versionpkg, it will check out the latest svn release automatically.

There are also binary packages available from the brain0 repo at

[brain0]
Server = http://www-users.rwth-aachen.de/thomas.baechler/arch/brain0/os/i686

Install these using the command

# pacman -S beryl-svn

This will install all necessary packages.

Preparing Xorg for hardware accelerated effects

Using nvidia drivers

You need the latest nvidia beta drivers. Get them from the nvidia-beta repo:

[nvidia-beta]
Server = http://box.decemplex.net/~thomas/nvidia-beta/

The PKGBUILDs can be found here. Put this repo to the top of pacman.conf (above all other repos) and then run pacman -Su. If you use the kernel26 package, you also need to enable the testing repository, as the nvidia package is built for version 2.6.18-ARCH. If you don't want this, rebuild the driver for the 2.6.17-ARCH kernel, using the PKGBUILD.

Make sure you install nvidia-utils AND one of nvidia, nvidia-beyond, nvidia-suspend2 from this repo.

Then edit the /etc/X11/xorg.conf file:

Section "Module"
  [...]
  Load "glx"
  [...]
EndSection

[...]

Section "Device"
  Driver "nvidia"
  [...]
  Option "AddARGBGLXVisuals"
EndSection

[...]

Section "Extensions"
  Option "Composite" "Enable"
EndSection

Using open source drivers and AIGLX

AIGLX currently works with the open source Intel and Radeon drivers. Add the following to your /etc/X11/xorg.conf file to enable AIGLX:

Section "Module"
  [...]
  Load "glx"
  Load "dri"
EndSection

[...]

Section "Device"
   [...]
   Option "XAANoOffscreenPixmaps" "true"
   Option "DRI" "true"
EndSection

[...]

Section "ServerLayout"
   [...]
   Option "AIGLX" "true"
EndSection

[...]

Section "Extensions"
   Option "Composite" "true"
EndSection

If your xorg driver doesn't support AIGLX, then the effects won't work.

Using XGL

TODO

Starting Beryl

XFCE Desktop

The startxfce4 script and the xfce4-session tool don't seem to work with beryl yet, as it seems to lack proper X Session Management support. To use xfce with beryl, you have to modify your $HOME/.xsession and/or $HOME/.xinitrc script. xinitrc is used by startx, xsession is used by gdm and kdm if you select the Custom session.

NOTE: The default .xsession script only launches the .xinitrc script, so most people will have to edit .xinitrc.

Your script has to start dbus and all beryl and xfce components. Here is an example:

. /etc/profile
. $HOME/.bashrc

is_running() {
  for pid in $(pidof "$1"); do
    if kill -0 $pid 2>/dev/null; then
      return 0
    fi
  done
  return 1
}
xrdb $HOME/.Xresources

# start a dbus session bus, if it is not already running
if ! is_running dbus-daemon; then
  dbus-launch --sh-syntax > $HOME/.dbus-env
fi
source $HOME/.dbus-env

# start beryl and beryl-manager
beryl-start
beryl-manager &
# start necessary xfce components
xfce-mcs-manager
xftaskbar4 & # REMOVE THIS LINE IF YOU USE XFCE-SVN
xfcalendar & # REMOVE THIS LINE IF YOU USE XFCE-SVN
xfdesktop & 
xfce4-panel & wmpid=$!

# start any other needed programs here

wait $wmpid

KDE Desktop

TODO

GNOME Desktop

The simplest way is to add beryl-start to the applications that start with your session. You can do this by going to:

[Desktop] -> [Preferences] -> [Sessions] -> [Startup Programs]

Adding beryl-manager to the list might be a good idea too so you can switch back to Metacity if need be.

No Desktop, Beryl as window manager only

This is an example ~/.xinitrc to create a "lightweight" Beryl environment. It is rather unconfortable unless you add a panel and maybe other management applications.

if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
    eval `dbus-launch --sh-syntax --exit-with-session`
fi

emerald &
beryl-manager &

# Start other applications here
# 
# Example: set wallpaper + open a terminal
#
# feh --bg-scale ~/Wallpapers/wallpaper.jpg &
# urxvt -depth 32 -fg grey80 -bg rgba:0000/0000/0000/dddd &

# Remove '--indirect-rendering --strict-binding' from the following line if you are not using AIGLX
exec /usr/bin/beryl --indirect-rendering --strict-binding dbus settings

Configuring Beryl

beryl (WM and compositor): Just run "beryl-settings"

emerald (window decorator): run "emerald-theme-manager"


You can migrate compiz-quinn's settings to beryl by copying ~/.compiz/csm_settings to ~/.beryl/settings

Troubleshooting

Poor performance under heavy CPU load with nvidia drivers (sched_yield fix)

nvidia has a known problem to *wait* for all busy programs, the result is extreme slowness when any application is using the cpu. This is a hack that seems to fix the issue (copied from Xgl code):

Create a file called sched.c:

int sched_yield() {return 0;}

Compile it with the following command:

$ gcc -rdynamic -shared -fPIC -o sched.so sched.c 

Then copy it the sched.so file to /usr/local/lib, and preload it for X/Xorg using one of the methods below:

Using the sched_yield fix with kdm and gdm

If you are using kdm or gdm, create a script called /usr/local/bin/X_sched_fix:

#!/bin/sh
LD_PRELOAD=/usr/local/lib/sched.so exec /usr/bin/X $*

Make it executable with the command

# chmod 755 /usr/local/bin/X_sched_fix

kdm

For kdm, exit the file /opt/kde/share/config/kdm/kdmrc, find the line

ServerCmd=/usr/bin/X -br

and change it to

ServerCmd=/usr/local/bin/X_sched_fix -br

gdm

For gdm, edit /opt/gnome/share/gdm/defaults.conf and change all occurences of /usr/bin/X to /usr/local/bin/X_sched_fix:

# sed 's|/usr/bin/X'|/usr/local/bin/X_sched_fix|g'

FIXME: Does this even work? I haven't tested it

slim

For slim edit "/etc/slim.conf", find the line

default_xserver         /usr/bin/X

and change it to

default_xserver         /usr/local/bin/X_sched_fix

Using the sched_yield fix with startx

Instead of using startx, create a script /usr/local/bin/mystartx:

#!/bin/bash
if [ -e /tmp/.X0-lock ]; then
  echo "/tmp/.X0-lock" already exists
else
  su -c "LD_PRELOAD=/usr/local/lib/sched.so X :0 &"
  DISPLAY=:0 ~/.xinitrc
fi

The script will ask root password before starting X. It's required because LD_PRELOAD doesn't work with setuid (X switches to root if you start from user) for security reasons.