Planet KDE

What belongs in the aggregator for all KDE-related blogs at http://planetkde.org

Projector fun

It all started when I upgraded to the new Kubuntu 8.10, a.k.a. "Intrepid", which did a bunch of nice things to my laptop - most importantly, it resurrected my beloved suspend-to-RAM that went out of order in Hardy. I couldn't be more grateful for that. Intrepid even made the volume keys work... yay!

Of course, every Kubuntu update has its downsides as well. This time, the Wrath of Shuttleworth manifested as a series of interrelated X.org issues: stuttering videos (which played perfectly fine in Hardy), mouse cursor jumps once I keep the mouse quiet for a few seconds, and a curious lack of autoconfiguration for the VGA output - something that had mysteriously worked since the previous release, so I had not questioned it despite knowing that Xrandr 1.2 was not the most enthusiastically hyped area of KDE development known to mankind.

Not possessing or even requiring a projector or external monitor by myself, I was able to live with this for a month or so. But when I had to borrow a collegue's laptop for a university presentation last Friday - after not getting my own machine to spit out proper signals - the Time of Change had come. (And no, I don't mean a certain KDE release with that codename.) On that day, I was torn between no VGA output at all on the one hand, and resolution mismatch problems on the other hand. Neither did I know how this stuff even works, nor that I could have easily solved all of this with a few simple calls to the xrandr command line utility.

I had to get my VGA output working though, because this Tuesday I would throw a movie night at my place, with a nice projector borrowed from my parents, lighting the White Wall of Moving Pictures. I needed to get rid of both the playback stutter and the projector output uglyness. Step by step, I got to the root of all evil.

First step: Figuring out the bad guy. With Google as my weapon of choice, an Ubuntu forum thread about the playback stutter issue was to be found, strengthening my hopes of not suffering alone. The solution of switching to Fluxbox or GNOME is not one of my favorite plans though, but at least it helped determine that KWin is innocent (by making it work in a Fluxbox session, but not with Compiz in a KDE session). Another thread pointed out the amazing correlation between mouse jumps and video stutter.

So while writing all of this up in a bug report, I remembered a blog entry by nixternal pointing out that the "Detecting RANDR (monitor) changes" kded service (to be found in System Settings) was causing problems for people with external monitors. In a stroke of luck, disabling that service was indeed enough to get rid of both the stutter and the jumps. Terrific.

But I still had to get the connection with my projector to work. So I immersed myself in the skillful use of the xrandr command line utility, and went on a search for the 10-second timer that messed up not only my system but that of countless others as well. Turns out that the "Detecting RANDR (monitor) changes" service is not even a part of KDE proper - it's a semi-private branch of krandr by KWin maintainer Lubos Lunak. The thing that causes my video to stutter, my mouse to jump, but also causes other monitors to flicker or recalibrate: all of that is caused by recurring polling of X, in order to notice when external video outputs are connected. (Certain hardware is not able to notify applications in certain scenarios, so that polling would have been ok if it didn't cause havoc on so many systems.)

Second step: getting it all to work! For my movie night, the combination of disabled kded service and xrandr fuzzing was sufficient to get the film nicely rolling. However, it was a slight disappointment that KDE's own display configuration in System Settings ("Size & Orientation", a.k.a. krandr) failed so ungracefully. When it started up, it automatically switched my laptop screen ("LVDS") to some weird resolution (1360x768, I believe), and not for the Love of God would it enable the projector output ("VGA"). All of this while the seemingly trivial xrandr command line tool achieved those tasks rather nicely.

Needless to say, I wasted another day with diving into the krandr code, and fixing one issue after the other. So the net gain for you, dear reader, will be a System Settings screen configuration tool in KDE 4.2 that Mostly Works (TM). Unthinkable joy shall be your reward for reading this crap all the way down! Congrats for your persistence. Dual-monitor setups? Nope, sorry. But reliable mode switching that doesn't make you go OMG WTF BBQ and doesn't mess up your screens if you merely start it. That is what you'll get.

I also hope that Kubuntu will soon update to the 7-week-old latest revision of that notorious "Detecting RANDR (monitor) changes" service, because that version already (already?) has the 10-second fuck-up timer disabled. I only would have hoped that the merging of unreleased hacks into the default setups of every Kubuntu user out there was not taken so lightly, but hey - I still haven't switched to Fedora or OpenSUSE so it can't be that bad. (...right?)

Third step: getting to know the latest trends. Seems like Plasma in 4.2 will feature a new screen management library called kephal, which is going to replace krandr in the near future. Chances are KDE and Plasma get decent multi-head support soon, but that's not quite my area of expertise - I'm just the occasional janitor, whereas Aike or Aaron have a much better grasp what the future holds for the neverending construction site that is screen management. Personally, I'm looking forward to getting my now-working configuration tool not broken until the next Surge of Technology sweeps through the lands of X.org.

AutoBrace update

Yeah, you might have read about the AutoBrace KTextEditor plugin which I introduced two weeks ago on this blog. You might even have tried it out, but it didn't work for you because it crashed under certain circumstances, it messed up pasted text, it broke undo functionality and it didn't do additional indentation although that would have been useful. You know who to blame for all of these shortcomings! (Right, that would be me.)

But fear not! I found ways to fix all of these, and it now works brilliantly and without a glitch. Unlike last time, I'm now even using the plugin myself. And on top of that, I even created an Oxygen icon (yay!) to display in the "Extensions" listing:

Now this makes you want to use Kate (or KDevelop) with AutoBrace just sooo badly, doesn't it? Heh, I knew it.

Maximum impact, minimum code

Hi Planet KDE!

You might already know me from 2006 or 2007, but currently I'm gone from KDE because of other commitments. So technically you shouldn't hear from me right now; however, my buddy klausi drove me to it.

Surprising high amounts of KDE coders use non-KDE technology like vi or emacs to hack on KDE, and mostly they've got good reasons to do so. The only option to get those people use Kate or KDevelop is to continually improve those. The respective developer teams are doing awesome work in that regard, while my contribution for today is just a small KTextEditor plugin. (Which means you can use it in Kate, KDevelop or whatever KatePart-based editors exist out there.)

The plugin is called AutoBrace and, frankly, an uninspired clone of the best feature that you'll find in Eclipse (apart from the compile-as-you-go automatism and sheer infinite amounts of complexity). Right, it's the automatic insertion of a closing brace ("}") after you ended a line with an opening one ("{"). Kate's standard insertion of parentheses, brackets and braces is simply too obtrusive for me, so even if I tried it several times I always had to disable it again because I can't stand it. So here's how AutoBrace works.

  1. You, the developer, are writing a line of code, and want to open a new block delimited by braces. Looks like this:

  1. If you press Enter and AutoBrace is enabled, it will insert your favorite new brace where it belongs. Looks like this:

It's no big deal in the code - actually, I should be embarrassed to blog about such a minor thing when other people are continuously rocking KDE with stuff like SVG support in KHTML (new), a whole new power management solution for KDE (relatively new), or a window manager that's just terrific (not new, but still awesome).

But I've got no scruples, so here's your blog post anyways. You can get AutoBrace right now for your current Kate, you just need to compile it beforehand. Here is where I put it. See you some other time!

Syndicate content