Archive for the 'KDE' Category

Fixing Double-Click Interval for Java Applications Under Linux

Dec 4, 2011

If you are using any Java applications (such as IntelliJ IDEA or RubyMine) under Linux / KDE you may have wondered why their response to double-clicks is somewhat sluggish or unreliable. As it turns out, Java (Swing) ignores KDE’s setting for the double-click interval, so Java uses a pretty short default (AFAIK ~200 ms).

To fix this, create a file named .Xresources in your home directory and add the following line:

*.multiClickTime: 500

Set its value to whatever interval you prefer (the example is using 500 ms).

Edit: JetBrains support just mailed me that the root cause is a bug in the JDK, reported in 2004 and fixed in Java 7 (doh!): http://bugs.sun.com/view_bug.do?bug_id=5076635

Reducing T420s Power Consumption under KDE/Linux

Oct 6, 2011

If you own a Lenovo ThinkPad T420s (or any recent-generation notebook with a Sandy Bridge CPU) with Intel HD 3000 Graphics, this information may help you to reduce the power consumption under KDE/Linux:

  • Intel HD 3000 Power-Saving: Enable the following Kernel command-line options: i915.i915_enable_rc6=1 i915.i915_enable_fbc=1 i915.lvds_downclock=1

  • Force ASPM: Enable the pcie_aspm=force Kernel command-line option

  • In KDE, go to “System Settings” “Desktop Effects” “Advanced” and set the “Scale method” to “Crisp”.

Overall, this brings my T420s’s power consumption down below 9 W. For best results, use a recent Linux 3.1-rc pre-release.

KDE: Location-based Screen Lock Activation

Jun 5, 2011

Some laptop users may know the following scenario: In situations where others may potentially gain unauthorized access to your machine, e.g., in public places or in the office, you may want to enable a screen lock shortly after the screensaver kicks in so that the time window during which your system is potentially vulnerable to malicious users stays short (of course, it is still recommended to manually lock the screen when you leave your laptop unattended). However, at home, the need to unlock the machine after some inactivity becomes a little annoying, which makes enabling the locking functionality by default a less desirable option.

Now, what if your laptop could automatically detect your working environment and disarm or re-arm the screen lock depending on its physical location? Well, it can: Turns out there are some nice hooks available to run scripts during various network state change events. The ones that will be of interest for us are if-up and if-down. Apart from that we make the assumption that it will be possible to detect the laptop’s “safe” home location by means of it being signed in to a given WiFi network (identified by its SSID).

Before proceeding, let’s make some further assumptions for the sake of simplicity:

  • You are running a recent KDE version (the author uses 4.6.x – older versions may also work, though).
  • The paths mentioned in this guide may be specific to Ubuntu/Debian. Your mileage for other distributions may vary.
  • You have configured a screensaver through the KDE System Settings to automatically kick in after some time of inactivity.

The portion we will be automating is enabling and disabling the automatic screen lock after disengaging the screensaver using KDE’s kwriteconfig command. To do so, create a new script /etc/network/if-up.d/screenlock and populate it with the following content:

#!/bin/bash
     
SSID=
USERNAME=

/sbin/iwconfig wlan0 | /bin/grep -q ${SSID}

if [ $? = 0 ]; then
    logger "Disarming screen lock"
    su -c "/usr/bin/kwriteconfig --file kscreensaverrc \
       --group ScreenSaver --key Lock false" ${USERNAME}
else
    logger "Re-arming screen lock"
    su -c "/usr/bin/kwriteconfig --file kscreensaverrc \
       --group ScreenSaver --key Lock true" ${USERNAME}
fi

exit 0

Make sure not to forget to configure your user and SSID placeholder at the top of the script.

Also, make the script executable:

sudo chmod +x /etc/network/if-up.d/screenlock

So far, the script is only invoked when establishing a network connection. To also invoke it upon disconnecting, we need to create an appropriate symbolic link:

cd /etc/network/if-down.d/ sudo ln -s ../if-up.d/screenlock .

You can test whether the screen lock is working by manually enabling the locking facility in the KDE System Settings -> “Display and Monitor” -> “Screen Saver” -> “Require password after …”. Test whether the lock is effective by letting the screensaver kick in. When dismissing the screensaver you should be prompted for a password. Now, connect to your WLAN. Retry the screensaver test cycle, which should no longer require the entry of a password. Last, disconnect from your WLAN again to observe the lock coming back.

That’s it. Have fun with your new location-aware screen lock configuration. Of course, further uses of the mechanism can be thought of, such as automatic file synchronization. More to follow in a future blog post.

Bug relief

Apr 26, 2011

Just in case you have also been bitten by KDE bug 261323 (chances are good if you are running KDE on a multi-core system with an nVidia graphics card and compositing enabled) and are using Kubuntu (Maverick): You can get updated KDE 4.6.2 packages, which include a fix for this issue by KDE developer Martin Gräßlin, from my PPA:

https://launchpad.net/~thilo.ginkel/+archive/kde-4.6.x

Kubuntu KDE 4.5.0 Glitches

Aug 12, 2010

When it comes to upgrading my Kubuntu environment I am typically an early adopter. This includes backported KDE releases. Naturally, this also means that I am regularly bitten by bugs (which are most common in .0 releases).

Unfortunately, this just happened with KDE 4.5.0 where the systray is completely unusable when hosting icons for non-KDE applications (such as Skype or Google Desktop). As it turned out, a Qt bug is responsible for the mess-up and a fix is already available in the Qt 4.7.x development branch.

To put things short, a fixed Qt version is now available in my PPA until the fix is integrated into the Kubuntu Backports PPA.

Skype under Kubuntu Lucid Lynx

May 31, 2010

As Skype voice recording stopped working for me after upgrading from Karmic to Lucid, I thought I would document what I needed to do to fix it:

Apparently, PulseAudio had my microphone muted although KMixer did not show this. The mute could easily be removed using pavucontrol, though.

Using Valgrind to Profile KDE Plasmoids

Nov 1, 2009

During the past days I prepared my KDE Weather Ion for wetter.com for inclusion in the KDE Trunk. Before entering the review phase, the KDE people are asking for a memory leak analysis of the new code using Valgrind. That’s easier said than done as I could not really find some documentation on how to run a Plasmoid (along with its data sources) through Valgrind…

After a little bit of googling I finally figured out how to do this and would like to use this post to document my findings.

Well, the key to the solution lies in a neat tool called plasmoidviewer, which can be used to run a Plasmoid as a standalone application. From that point on, things get easy: Just run Valgrind on plasmoidviewer along with the desired Plasmoid and you are done, such as in (this example will run the leak check on the Weather Plasmoid):

valgrind --tool=memcheck --leak-check=full plasmoidviewer weather