Using KWin with Xfce

xfce_logo-150x150I’ve been a long-time Xfce user as I’ve bounced around any manner of window manager and desktop environment since the turn of the century. I always found 3D effects like viewing all window spaces, and exposé-type features to be useful to productivity and the eyes.

Compiz is also not really actively developed anymore so I wanted to stick with something more progressive (yes, Xfce is actively developed) Below you’ll see how to use KWin as your desktop compositor/manager alongside the rock solid, lightening-fast Xfce desktop.

This process is easy, takes only a few dozen KDE/QT packages and is not too invasive to the simplistic, lightening-fast Xfce experience we all know and love.  This is aimed towards a Fedora Linux installation but the approach some work for any distribution that ships KDE and Xfce.

I’m told that Ubuntu users can use the Kubuntu plasma-desktop PPA to get the right packages installed below.

Install KWin
(older distributions, F21 and below)

dnf install kwin-gles-libs kwin-gles kde-style-skulpture

Fedora 22+ or newer Distributions with Plasma 5:  Do this instead

dnf install qt5-qtscript qt5-qtsvg qt5-qtbase-gui libxkbcommon-x11 \
qt5-qtdeclarative kwin kwin-libs kf5-kwindowsystem kde-cli-tools

Edit Xfce Session to use KWin

cp /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml \
$HOME/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml
sed -i 's/xfwm4/kwin'/ $HOME/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml

Logout/In to X11 or Reboot.

To access window decorations, plugins, effects and other settings right click on any application title bar and go to more actions -> window manager settings

NOTE: Make a session and startup entry in Xfce to launch kwin –replace if the xfce4-session.xml setting above doesn’t start everything automatically.

xfce_start_session_kwin

Go to Session and Startup –> Application Autostart and click Add.  The command for the startup used above is:

kwin --replace ; killall xfce4-panel ; xfce4-panel & ; killall -9 xfdesktop ; xfdesktop & ; kwin --replace

NOTE: Non-KDE terminals like xfce4-terminal, urxvt, etc. may look funny on the borders when full screen in kwin, to fix this: right click on the window border –> more actions –>special application settings –> size and position

kwin-fix-fullscreen-term1

CHECK obey geometry restrictions, select force, check NO

kwin-fix-fullscreen-term2

NOTE: If you run into graphics weirdness you can non-disruptively “reset” everything via the following command (use the alt + f2 keys in Xfce for a quick run dialog):

kwin --replace

You can do the same via ssh remotely:

DISPLAY=:0 kwin --replace

I also use the plank dock and a very minimal, hidden Xfce panel for my setup
Panel settings: Automatically hide the panel: Intelligently
Plank settings: Behaviour: Hide Dock, On, Dodge maximized window
You might also find the font visual improvement guide useful afterwards.

plank_kwin_xfce_simple

Set Focus Prevention Settings
For things like Whisker Menu (plugin ships with XFCE 4.12 now) you’ll want the following settings so that your focus isn’t stolen via KWin.  Right click on any window –> More Actions –> Window Manager settings and then go to Focus.  From there set focus stealing prevention to none.

kwin-focus-fix

Window Decorations and Theme
You now have access to all the KDE window decorations or you can obtain more through the Window Manager settings interface.  I’m using the Dark-Translucent window decoration but try them all and see what you like best.

Install and Hotkey Whisker Menu
Whisker menu is an improved application menu for Xfce, it supports typing partial program names or metadata and quickly accessing programs and settings.  Many Xfce programs feature a –popup flag or separate binary which is very useful.

dnf install xfce4-whiskermenu-plugin -y

Go to Keyboard Settings –> Application Shortcuts and click New.
Enter xfce-popup-whiskermenu as the command and choose your hotkey, I use meta + o.

whisker_menu_hotkey

Now you can quickly open whisker menu and type commands like you would with a Windows Start Menu.  You should have also set the focus prevention settings above prior to this in KWin settings.

whisker_menu_popup-hotkey

Switch Users Option
Whiskermenu many have the Switch Users action greyed out.

whiskermenu-commands

To enable switch users functionality within Whisker menu change the command for Switch Users to dm-tool switch-to-greeter.

Switch Users and Screen Lock

There’s currently a bug (feature?) around lightdm user switching that it doesn’t lock your desktop prior to running it so it’s best to call xcreensaver-command -lock beforehand.  Let’s make a script for that.

(run as root)

cat > /usr/bin/lock-xfce << EOF
#!/usr/bin/bash
xscreensaver-command -lock ; dm-tool switch-to-greeter
EOF
chmod 755 /usr/bin/lock-xfce

You can now use the new script lock-xfce for both your lockscreen and to better secure multi-user session support within Lightdm.  Some people also complain that xscreensaver is ugly so this spruces things up a bit.

whisker-edit-script-crop

Customizing Lightdm
Lightdm supports themes and customization, install the following package to dig deeper and experiment with different looks.

dnf install lightdm-gtk-greeter-settings -y

lightdm-greeter

My Laptop Screenshot
When all is said and done, this is generally what my desktop looks like.  Plank keeps running applications and windows nicely segregated/collapsed within their own plank dock entries without the need for taskbar clutter.  Common applications like xfce4-terminal, Thunar (file browser) Firefox, and Whisker Menu are all hotkeyed.

desktop-kwin-1

xfce_kwin_5

Issues with HDMI External Display
Like all software, KWin isn’t perfect and does have bugs.  Occasionally I’ve had problems with exporting my Lenovo x240 display to large TV/monitors via HDMI.  In cases like this, or if KWin is slow I will sometimes temporarily revert back to xfwm4 via hitting control + f2 (Xfce run dialog) and running the following:

xfwm4 --replace

You can revert back to using KWin at any time by running the reverse:

kwin --replace

No Desktop Background
If your desktop background doesn’t load for some reason try reloading xfdesktop with alt+f2 run dialog or terminal.

killall -9 xfdesktop ; xfdesktop &

Issues with Intel Chipsets

There are some known issues with some Intel chipsets that can be circumvented by switching to UXA acceleration instead of the newer SNA.  This is a bug in the Intel driver that is triggered by some features of KWin/Plasma and not KWin.  To work around this you can do the following, but only do this if you have issues:

cat >  /etc/X11/xorg.conf.d/20-intel.conf << EOF
Section "Device"
    Identifier  "Intel Graphics"
    Driver      "intel"
    Option      "AccelMethod"  "uxa"
EndSection
EOF

Now, restart X11 or reboot.  Note that most of these issues are fixed with Linux kernel 4.2.6 and above so you probably don’t need this unless you are on an older distribution/release.

Further Customization

Lastly, there is an enormous amount of useful desktop effects similiar to what’s offered by Compiz within KWin.  You can access these via right clicking on any open window and selecting more actions -> window manager settings.

kwin-desktop-effects

I won’t go through them all here, but one very useful effect (found under screen edges) displays all open windows easily by dragging your mouse to a pre-defined screen corner as seen below.

I also hotkey this to f11 for quick access, your mileage may vary.

kwin-expose

About Will Foster

hobo devop/sysadmin/SRE
This entry was posted in open source, sysadmin and tagged , , , . Bookmark the permalink.

11 Responses to Using KWin with Xfce

  1. Leka says:

    Kwin can be installed in Debian, but the KDE control module doesn’t start. (Right click on any window –> More Actions –> Window Manager settings and then go to Focus doesn’t work.) What apps would be missing?

    Like

    • Will Foster says:

      Hi Leka,

      That seems to come from:

      /usr/bin/kcmshell5 --icon preferences-system-windows kwindecoration kwinactions kwinfocus kwinmoving kwinadvanced kwinrules kwincompositing kwineffects kwintabbox kwinscreenedges kwinscripts

      On my Fedora system that traces back to:

      kde-cli-tools-5.5.4-1.fc22.x86_64 : Tools based on KDE Frameworks 5 to better interact with the system

      See if pulling that in will make the settings appear, if not I’ve got a lot of kf5-* packages installed and can list all of those if need be.

      Like

      • Leka says:

        Thanks. kde-cli-tools was not installed. The module works now. I can’t still download any extra decoration yet. I get this “Loading of providers from file: http://download.kde.org/ocs/providers.xml failed” Can you download decorations?

        Like

      • Will Foster says:

        Glad that fixed it. With the decorations download it works fine for me. Some people report this was an issue with proxy settings in Konqueror, or it might be related to your user. I’m not sure – everyone that’s used this guide has not run into this problem. If you find out for certain please let me know and I’ll update the blog post in case someone hits it.

        Like

  2. Felix Nguyen says:

    I tried installing Kwin on my Ubuntu Studio, but the packages are nowhere to be found, I guess I don’t have the required PPAs.
    Had no luck searching for them either.
    Can you guide me on this? It’s kinda disappointing not to have KWin on my Xfce.

    Like

  3. thanatoszx says:

    Tried to install this on my Ubuntu Studio with no luck, the packages are nowhere to be found, maybe Ubuntu Studio lacks the required PPAs?
    If you happen to know those PPAs, please let me know.

    Like

    • Will Foster says:

      Hi Thanatosx, I’m not keen on Ubuntu but it might just be easier to install the KDE desktop packages from the main repositories, that should pull in KWIN. I’m posting what I think might work, and erring on the side of caution. It looks like the kwin packages are listed here but try this:

      apt-get install kubuntu-desktop software-properties-kde kwin-x11

      Liked by 1 person

      • thanatoszx says:

        Tks for replying, but those packages were somewhat outdated so it broke my desktop.
        But funny, installing plasma-desktop from Kubuntu’s ppa solved it perfectly, running KWin now!
        Thanks for your guide anyway, got me out of screen-tearing xfwm4.

        Like

      • Will Foster says:

        Hey, good to know (sorry your desktop broke). I’m glad you’ve got it sorted now, I added a blurb about this in the main post.

        Like

  4. Thanks Will! The bit about using an external lock screen script to facilitate the session user switch was handy! I decided not to use xscreensaver given how old and crufty it is, but of course folks that don’t care about their DE looking horrible can continue using it.

    Like

    • Will Foster says:

      While xscreensaver is a bit ugly, how often do you really look at it though? I’d imagine only when you type in your password. You could surely use something more aesthetic like gnome-screensaver, but it’s been said it is less secure

      I’ll stick with xscreensaver personally as it does one thing really well and I really dig the BSOD screensaver.

      Like

Have a Squat, Leave a Reply ..

This site uses Akismet to reduce spam. Learn how your comment data is processed.