KWin the Conqueror
I recently noticed that although I have already talked about using KDE4's KWin in KDE3 or any other window manager in KDE instead of KWin, there is one thing missing in the mix: Using KWin without the KDE desktop.
Yes, perfectly possible. KWin is actually a KDE application like any other (well, more or less) and so just like other KDE applications it can run in GNOME, Xfce or even standalone, as long as the KDE libraries are available. And while some people may wonder about the sense of this, some apparently see it.
So, let's have a look at how to use KWin in GNOME, Xfce or standalone. As the title suggests, there will be some resistance, but that can be overcome ;).
KWin standalone: Let's start with the simplest case. And also probably the least likely. It is possible to use KWin alone without any desktop, just like it is possible to use for example WindowMaker or FVWM. However, unlike those, KWin is not very suited for this task, as it is a pure window manager. Meaning, it provides only window management features and not additional elements of the desktop like the taskbar, desktop background or application launching. So while such usage is possible, I don't expect many people would try it, without additional tools to provide other desktop functionality. If you try it, it's simple - just launch KWin, that's it.
KWin in Xfce: In Xfce KWin must replace Xfwm4, the default window manager. This is done by running 'kwin --replace' (e.g. using the Alt+F2 dialog). After this, you will have Xfce with KWin running, in order to get the same setup the next time, you also need to save the session - start logout and in the logout dialog make sure to check the option for saving the session. Now, the next time you start Xfce, it will launch KWin as it window manager ... except that, it won't (IMPORTANT!). Current stable Xfce versions have a bug that will make its session manager crash during startup with KWin. This problem is supposed to be fixed with the 4.6 beta versions, but if you have 4.4, you will need a workaround before you first start Xfce this way:
You should run a script with these contents before Xfce is started. I'm not sure what exactly is the Xfce equivalent of KDE's $KDEDIR/env/*.sh , but if you use Xfce, you should know better anyway. If you don't know, adding these commands to .profile in your $HOME should do too.
KWin in GNOME: This one will be ever a bit more complicated. It appears that there is no UI way of replacing Metacity in GNOME and that choosing a different window manager is done using $WINDOW_MANAGER. So you can for example add 'export WINDOW_MANAGER=kwin' to your $HOME/.profile file. Next time you start GNOME, it will use KWin instead of Metacity. However you will probably soon find out that for whatever reason Metacity is not only GNOME's window manager but also shortcut manager - Alt+F1 for opening the desktop menu of Alt+F2 for the run dialog will not work anymore. There appears to be no simple way to trigger those from command-line, but at least OpenBox people have already run into this problem, so why not reuse their solution with thanks? After you install OpenBox (openSUSE users can get it from the X11:/windowmanagers repository), there will be also tool gnome-panel-control. Now you need to bind Alt+F1 to command 'gnome-panel-control --main-menu' and Alt+F2 to 'gnome-panel-control --run-dialog'. Bad luck with GNOME's tool for custom shortcuts I guess, given what is written above, so you can try with XBindKeys - please refer to its documentation for how to configure the shortcuts and how to make it autostart in GNOME.
That's it. In all three cases, if you need to configure KWin, run 'systemsettings' and find the relevant option there. Since KWin is usually seen as a component of KDE, you will need to have a look in several places. Shortcuts are together with other global KDE shortcuts in 'Keyboard&Mouse', functional settings are in 'Window Behavior', desktop settings are in 'Desktop' and the looks are in 'Appearance'. You can access most of KWin's settings also by right-clicking any titlebar to get KWin's popup menu.
Something more I think I should mention: I've normally used KDE4's KWin in KDE3 session (as in, for normal real work, not just testing) and I couldn't notice any performance impact because of this mix (perception, I don't normally use my computer with a stopwatch in one hand :) ). The overhead of running KDE4's KWin in KDE3 should be about the same like when running it in Xfce or in GNOME. After all, you can do 'zypper install kde4-kwin' or an equivalent and try it yourself.
Actually, I use standalone KWin (3.x) regularly. For example, for giving presentations with a video projector, I switch to a terminal, start a new X and just start kwin and OO Impress/Okular. For me, it's the surest and fastest way to get video output. And if I need to do more than that, I just start a konsole in it to launch more applications (I do the same sometimes when I need a quick KDE session and don't feel like waiting for my complete session to restore).
I tried this once and it worked great, been using it ever since.
I actually use this whenever I need to run on a bare xserver for more than a few minutes. My old standby used to be launching fluxbox from my xterm, but now I just throw kwin into the mix. Either a series of xterms or a konsole session provides whatever I need.
I mostly do this for the occasional dev/testing stuff and not for actual day-to-day, that said, I do use this fairly often.
Thanks for ensuring that it works probably, I find it extremely useful.
for the xfce workaround
instead of the "if ... then ... fi" part, I think you can just call sed :)
sed -i.sav 's/_RestartCommand=$/_restartCommand=false/' "$f" 2>/dev/null