Who Says Penguins Can't Fly?http://blog.hanschen.org
Sat, 28 Feb 2015 04:05:11 +0000enhourly1http://wordpress.com/http://1.gravatar.com/blavatar/3c5596b91b62a09f9977c99bf4a6a40b?s=96&d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.pngWho Says Penguins Can't Fly?http://blog.hanschen.org
Blog moved to http://blog.hanschen.orghttp://blog.hanschen.org/2013/03/30/blog-moved-to-httpblog-hanschen-org/
http://blog.hanschen.org/2013/03/30/blog-moved-to-httpblog-hanschen-org/#commentsSat, 30 Mar 2013 05:47:41 +0000http://blog.hanschen.org/?p=2287]]>Just a heads up: I’m working on a personal website which will use the hanschen.org domain, so I’ve moved this blog to the following new address:

If you’re subscribed to any feeds or have bookmarked pages, please update the links by adding blog. in front of hanschen.org. The old address (hanschen.org) will continue to point to the blog until I’m finished with the new site. I’ll also try my best to keep old links intact.

Please let me know if you find any dead links or other problems (either in the comments section below or in an email, see Contact page).

]]>http://blog.hanschen.org/2013/03/30/blog-moved-to-httpblog-hanschen-org/feed/0MoggerDifferent background color in Vim past 80 columnshttp://blog.hanschen.org/2012/10/24/different-background-color-in-vim-past-80-columns/
http://blog.hanschen.org/2012/10/24/different-background-color-in-vim-past-80-columns/#commentsWed, 24 Oct 2012 12:36:46 +0000http://hanschen.org/?p=2278]]>Or any number of columns, but 80 seems to be the standard for code.

Preface

I’ve tried different ways of highlighting lines past 80 columns but was never satisfied with the results. Since Vim 7.3 there’s a nice colorcolumn option, but it just didn’t look any good:

Vim with :set colorcolumn=80

It’s not just the red color, which can be easily changed, but the whole “highlight a single seemingly random column” didn’t appeal to me. After searching for inspiration on Google, I found this StackOverflow question with the following screenshot of TextMate:

TextMate with “Highlight right margin” option

Well, well, that looks much prettier. Is it possible to get something similar in Vim?

Highlight range of columns

So if we want to highlight the background past 80 columns we would just have to set colorcolumn to all integers from 81 to (81+256-1), since it can highlight a maximum of 256 columns (according to my tests it’s actually 255). Not that hard to do, but there should be a more elegant way to define the range. A Google search proved that my intuition was right; you can add the following in your .vimrc instead:

execute "set colorcolumn=" . join(range(81,335), ',')

If you want to change the colors you can adjust the ColorColumn highlight in your .vimrc or colortheme. Here’s my final result:

Vim with a different background past column 80

A smarter way?

A comment on StackOverflow pointed out that you could highlight the first 80 columns instead and change the background of Normal. I tried to do that, but it clashed with some other highlights, for example my DiffAdd, DiffChange, DiffDelete, and DiffTextctermbg seemed to be overridden. Another limitation I see with this method is that you can’t set a special textcolor for text past 80 columns, if that’s what you fancy. But that’s only as far as I know, and I admit that I know very little when it comes to the inner workings of Vim.

]]>http://blog.hanschen.org/2012/10/24/different-background-color-in-vim-past-80-columns/feed/6MoggerVim colorcolumnTextMateVim highlighted backgroundOpen Application Launcher with Super keyhttp://blog.hanschen.org/2012/10/17/open-application-launcher-with-super-key/
http://blog.hanschen.org/2012/10/17/open-application-launcher-with-super-key/#commentsWed, 17 Oct 2012 15:44:29 +0000http://hanschen.org/?p=2237]]>Many users want the Super key (also commonly called the Windows key and confused with the Meta key) to open the Application Launcher in KDE Plasma Desktop. At the time of writing 145 users have voted for the Brainstorm idea “Super key to load Application Menu” and there are 51 comments. A workaround has been around for a long time which involves remapping the Super key to a regular key, but then you lose the ability to use it for other keyboard shortcuts. Until now, that is. In this post I’ll write about how you can eat the cake and have it too.

Spoiler: If you don’t feel like reading, scroll down to “… called ksuperkey!” to find the solution.

The problem

People from the Windows world are used to opening the so-called Start menu by pressing the Windows key. In Linux the key is called Super and is regarded as a modifier key, similar to Ctrl and Shift. A modifier key, as the name suggests, modifies other keys when held down – for example, a becomes A if you press the A key while holding down Shift.

Now imagine that you bind a shortcut to the Super key. Pressing Super would then invoke the shortcut, and you wouldn’t be able to use it as a modifier anymore. For people like me who rely heavily on the Super key – I use it to launch and control applications – we’re suddenly left with one extra key for the price of losing several key combinations. Quite a bad trade-off.

But there has to be a solution! In Windows you can use the Super key as a modifier as well, and from what I’ve read Unity and GNOME Shell also seem to have that functionality.

A solution…

One way to work around the problem is to let the shortcut be invoked when you release, rather than press, the Super key. If you press another key before releasing Super, it’ll act as a modifier key instead of invoking the shortcut.

There’s already an application that does something similar called xcape, which maps Ctrl to Escape if you press and release it on its own (from the README: “If you don’t understand why anybody would want this, I’m guessing that Vim is not your favourite text editor ;)”). Thanks to the nature of free and open-source software it was easier than pie to fork it and adopt it to the needs of KDE users.

… called ksuperkey!

ksuperkey is a very small application that lets you open the application launcher by pressing the left Super key, while still allowing the Super key to act as a modifier key. In other words, it won’t affect any of your current shortcuts.

How to make it work

Install ksuperkey. You can download the source and some distro-specific packages from KDE-apps, but compiling the latest version is also straightforward. First install the dependencies, for example on Ubuntu-based systems:

sudo apt-get install git gcc make libx11-dev libxtst-dev pkg-config

On some systems you’ll also need to install the build-essential package (otherwise you’ll get the following error: stdlib.h: No such file or directory). Then run the following commands in a terminal:

Make sure that the keyboard shortcut for your application launcher is set to Alt+F1 (this is what ksuperkey will send when you press and release the Super key on its alone). Right click on the application launcher icon → Application Launcher Settings → Keyboard Shortcut.

Checking that the shortcut for Application Launcher is set to Alt+F1

Now pressing the Super key should open the application launcher! If you want this behavior every time you log in, you have to set ksuperkey to Autostart, for example in System Settings → Startup and Shutdown → Autostart → Add Program… → small Browse button → Select the ksuperkey application.

Add ksuperkey to Autostart

Tips

It’s safe to move the ksuperkey directory to anywhere you want. If you’ve added it to Autostart in System Settings, don’t forget to update the “Command” field with the right path (or remove the old entry and add a new one).

You can use ksuperkey for any action, for example to open KRunner – just bind Alt+F1 to the action.

If you want to change the keys sent by ksuperkey to something else, e.g. Alt+F2, you can easily modify the source code. Open xcape.c in a text editor (e.g. Kate), go to line 92 and change XK_F1); to the key you want, e.g. XK_F2);. Recompile with make and you’re done.

ksuperkey works fine on other workspaces/window managers as well, although it will probably cause problems if the workspace already uses the Super key as a non-modifier key (Unity, GNOME Shell).

Why isn’t this the default behavior?

I bet a lot of people reading this now wonder, if Windows, Unity, and GNOME Shell can do this, why isn’t it configurable in KDE Plasma Desktop? Surely it’s possible, as demonstrated by ksuperkey and the other workspaces.

I don’t have enough technical knowledge to give a good answer, but here are some things to consider:

Although I haven’t look at the source, I’m pretty sure that the Super key behavior when it’s pressed and released on its own is hard-coded in the other workspaces. KDE Plasma Desktop is very configurable – you can remove the application launcher, or have hundreds of them (although I would doubt your sanity if you do have that many) – so I doubt this is a solution.

Making it possible to bind actions to modifier keys would probably require large changes in how keyboard shortcuts are handled in KDE software. I’m also unsure whether this is desirable since it seems to go against the very basics of how modifier keys should be used.

ksuperkey uses Xlib directly. I don’t know if it’s possible to do something like this using Qt, the GUI toolkit most KDE software is built on.

To summarize, I wouldn’t count on this feature being implemented in the near future (but you never know!). For the time being you’ll have to bear with ksuperkey, which uses a staggering 380 kibibyte of RAM on my system.

]]>http://blog.hanschen.org/2012/10/17/open-application-launcher-with-super-key/feed/57MoggerSuperkeyInstall ksuperkeyApplication Launcher settingsSelect autostart programWelcome our new forums!http://blog.hanschen.org/2012/04/22/welcome-our-new-forums/
http://blog.hanschen.org/2012/04/22/welcome-our-new-forums/#commentsSun, 22 Apr 2012 14:56:50 +0000http://hanschen.org/?p=2214]]>It’s been a while since I wrote about how you can create a community for your users at KDE Community Forums. Today I’m happy to announce that the forum got, not one or two, but six new forums. Isn’t that incredible?

Soon Dolphin, the default KDE file manager, also got its own Dolphin forum. Before topics about Dolphin would be shattered around in the Other KDE Software and Workspace forums. We realized that the new Dolphin forum didn’t really fit in any of our existing categories, so the System & Utilities category was created.

Marble is the first application from the KDE Educational Project to join the forums, visit the Marble forum to take a look. Don’t forget hat you still can ask questions about the other KDE EDU applications in the Games & Education parent forum.

KDE Workspace Vision is a special kind of forum where users can discuss what they would like to see in their future workspace, see Dario’s post for more information. It differs from Brainstorm as you’re allowed to post and discuss complete visions, while only single concrete ideas are accepted in Brainstorm.

Finally, we have our newest addition, the Konsole forum. Like Dolphin, topics about Konsole used to be posted to different places in the forum. Now most of them have been moved to their new home.

Meanwhile, the KWin developers implemented a feature in KWin to get useful information for users to post when asking for support. It’s really great to see developers care about helping their users. Martin also proposed a GSoC idea about supporting users directly from the desktop (with a plasmoid), using forum.kde.org. Unfortunately it’s too late to apply, but who knows, maybe someone already did? If it’s not taken and you’re interested in given it a try, you should definitely contact Martin or one of the forum admins (forum-admin@kde.org).

To close up – if you’re a user of any of those applications, the forums provide an easy way to connect with the community and receive expert help from other users and developers. If you’re a developer and want your own forum for your application, you’re just a few click away!

]]>http://blog.hanschen.org/2012/04/22/welcome-our-new-forums/feed/0MoggerKDE ForumsKDE Community Forums – Create a community for your usershttp://blog.hanschen.org/2012/02/26/kde-community-forums-create-a-community-for-your-users/
http://blog.hanschen.org/2012/02/26/kde-community-forums-create-a-community-for-your-users/#commentsSun, 26 Feb 2012 16:54:46 +0000http://hanschen.org/?p=2134]]>It’s always nice to see KDE developers join forum.kde.org, and especially nice when they request a new forum for their application or project. Lately we’ve had two newcomers, Gwenview and Accessibility – the forum team wishes you a warm welcome! Kontact & PIM has also been split from Office & Productivity due to popular demand.

In this post I’ll talk about why you, a developer or contributor, should consider to create a forum at the KDE Community Forums for your KDE application or project.

Some of the advantages of forum.kde.org

Most users seem to prefer forums over mailing lists. Let’s just leave it at that and not get into a debate why one or the other is better. Instead, the focus will be on the KDE Community Forums and why you should get a forum there instead of, say, starting your own:

Everything KDE-related in one place, users don’t need to register at multiple forums.

We have a very dedicated team consisting of friendly and knowledgeable persons who maintain the forums, help users, moderate posts, make sure the board version is up-to-date and much more.

Spam is a real problem for many forums. We have a sophisticated system to deal with spambots, even those who try to disguise themselves as normal users, and an active team that cleans the forum from spam regularly.

It’s easy to reach the forum team in case you have any problems or questions (or if you just want to talk to us ;)).

To summarize, joining forum.kde.org means less job for you and more benefits for your users.

Successful forums

KDE Community Forums already has several forums where developers are actively participating in the discussions and helping users. Some examples that come to mind include Eigen, KMyMoney, KWin, Skrooge and Tellico. There are two forums I want to mention in particular.

Krita

The Krita forum is a perfect example of an active community. I believe the Krita developers are a big part of the success – they regularly visit the forum, askforuserfeedback, let artists contribute in the form of e.g splash screens and are just responsive and friendly in general.

There was one feature the Krita guys wanted that the forum didn’t provide out-of-box, a gallery for users to share their artwork. Sure enough, a phpBB mod was soon written by our awesome staff to display thumbnails for topics.

I highly recommend that you take a look, there are a lot of impressive work in the gallery, all created with Krita.

If you have any special requests for your forum, don’t hesitate to discuss it with the forum team. We can’t promise anything but it’s possible that something can be done.

Amarok

Amarok had an active forum a long time before the official KDE Community Forums was launched. However, the Amarok developers saw the benefits of having everything unified under one roof and decided to migrate their forum to forum.kde.org. This was no easy task, all users had to be moved to the new forum (with possible name collisions) along with the posts. The difference in forum software didn’t exactly help.

But still, it could be done. Our competent staff wrote a conversion script that moved user information, posts etc. from one database to the other and the result can be seen at the current Amarok forum.

So if you already have a forum and want to migrate to forum.kde.org, ask one of the forum administrators.

How to request a new forum

You can find all information on our new community.kde.org page, I’m just repeating it here for your convenience.

If you want a forum for your application or project, there are only three conditions it has to meet:

The application or project should be related to KDE

There should be enough interest to fill the forum

At least one person involved with the application or project must be willing to moderate the forum

Note that your application doesn’t have to be part of the KDE Software Compilation.

Explanation

Keyboard accelerators are letters with an underscore that you see on buttons, labels etc. This feature is very useful for people who prefer to use the keyboard. For example, instead of using your mouse, you can click on OK by pressing Alt+O.

The downside is that it makes applications appear more cluttered. But not anymore. Starting from 4.8 (or did I just not notice this awesome feature until now?), you can configure Oxygen, the default style for KDE applications, to hide keyboard accelerators until you hold down the Alt key, or make them disappear completely.

Netrunner (http://www.netrunner-os.com) aims to become one of the leading KDE-centric Linux distributions, and to achieve this we need your help! Thanks to the financial support of Blue Systems we have the opportunity to hire one developer experienced in KDE/Qt/C++ programming to improve some areas of KDE software. You’ll be able to work full-time on various KDE-projects, such as

Improving Kmenu, the panel and other parts of Plasma Desktop

Fixing various bugs

Improving/adding functionality

The improvements will be pushed upstream to make them available for all KDE users.

We guarantee monthly payment depending on your skills and experience with regards to KDE.

If you are interested in taking the offer, please send me an email with your CV to:

This is a story about how I got what I wanted through toil, sweat and tears (thankfully no blood was spilled; the sweat and tears part might also be slightly exaggerated). All thanks to the nature of Free and Open Source Software.

Like many other times, it all started with a harmless thought: “So many things to do, I think I need a ToDo list”. Before I would keep track of things to do in a Notes widget on my desktop (screenshot), but this felt a bit primitive. It was time to get something better, although still simple, as I only needed the most basic features:

A clear list of tasks that need to be done and when they must be accomplished

Easy way of adding new tasks and marking tasks as completed

Possibility to create tasks that are repeated (e.g. a task that needs to be done once every day)

Basic priority settings

with the last point being a “nice to have” rather than “must”. With this in mind, I set out on my journey to find a suitable ToDo widget for my desktop.

… And returned empty-handed. Despite the many widgets that are shipped by default, the even larger amount of widgets on KDE-apps (not to mention the vast amount of Dashboard/Web/SuperKaramba/Google Gadget widgets), I couldn’t find one that fulfilled my requirements – a ToDo list that looks good on the desktop and supports the features listed above. Was that too much to ask for?

One of the top candidates was Remember The Milk, a plasmoid written by Andrew Stromme, which is included in kdeplasma-addons and thus often installed by default. I created an account on the Remember The Milk site and played around with the widget for a bit. It supported all the features I asked for and much more – great! The way of adding new tasks was also very nice. For example, I can write “Clean room tomorrow”, and it understands that I want the task “Clean room” scheduled for tomorrow (actually, it’s much smarter than that). However, I’m a person who likes minimalism, the KISS principle and clean desktops, and unfortunately Remember The Milk made my desktop feel too cluttered for my tastes (a problem shared by many widgets, by the way).

Remember The Milk plasmoid on my desktop

That could’ve been the end of story, but there’s a reason for the alternative title of this post. For more than a decade I’ve been enjoying Free and Open Source Software (FOSS) as a user. I liked the freedom that the KDE workspaces and applications offered, the freedom to use them and make them work as I wanted, but over time I’ve come to more and more appreciate the philosophy behind FOSS and the great communities around many FOSS projects such as KDE.

I’ve been in a developer’s shoes a few times, but all I’ve done is small changes. Today I put on those shoes again and got to experience what freedom means from a programmer’s perspective.

The Remember The Milk plasmoid is licensed under a FOSS license which, as you probably already know, means that anyone can view and edit the source code. Using the nice web interface at projects.kde.org, I could easily locate the relevant repository and find the Git command to clone it. The first thing I wanted to do was to declutter the widget by removing things I didn’t need. The label that displays the text at the top was the first to go, closely followed by the tab bar and filter bar. Since I didn’t want to spend too much time on this, it was done in a very quick and dirty way – I haven’t removed the code for filtering the tasks even though the filter bar is gone, for example. This method didn’t require much understanding of the code, and anyone with a little C++ knowledge could have easily done it. But yes, it’s not a very elegant solution.

Before compiling the source to see my modifications I had to edit CMakeLists.txt. The file contains instructions to CMake on how to make the project, and I didn’t want to overwrite my current Remember The Milk plasmoid. If you ever find yourself in the same situation, I highly recommend you to take a look at how other widgets (e.g. from KDE-apps.org) do it, as well as checking the Techbase page. It’s not that hard to figure it out after seeing some examples.

The next thing to do was to improve the appearance. This seemed harder, as I’m not used to working with QPainter et al. But the code was written in such as a way that it was easy to find the things I wanted to change, and with some help from API references (especially for Qt and Plasma), I got a result that I was happy with.

Remember The Milk after modifications

There was still one thing that I wasn’t satisfied with, however. To mark a task as complete, you had to enter edit mode by clicking on the task, check the Complete checkbox, and finally click on Update Task. I wanted an easier and faster way. Driven by my recent success, I felt that it was worth to give it a try.

My first idea was to add a button next to each task, but this seemed to require quite much work. Instead I went for an easier solution – middle click on tasks to mark them as complete. It was surprisingly easy to implement since I could copy the code for updating tasks. The hard part was to figure out how to detect which mouse button was clicked, which was easily solved with a Google search. The only problem is that with my current implementation, I had to change the action from “clicked” to “pressed”, meaning that I broke drag and drop in the process. But to me, the new feature is more important.

What really hit me during all this was how much control I had over my workspace – it truly is my workspace. If I can’t configure something to work as I want, I’m always free to modify the source code. Of course, I’ve known that this was possible ever since I was introduced to FOSS, but it’s different to experience it first-hand. Even I can do it.

And so can you! If you’re interested in contributing code to KDE, I have three suggestions:

If you feel unsure, pick something that doesn’t seem too hard to achieve, for example doing small fixes like what I’ve done with Remember The Milk (although in my case, it’s not supposed to be an improvement; it’s rather an adaption to what I personally want)

Most importantly, work on something that you want. Is there a small bug that you find slightly annoying? Try to fix it! A simple application that you miss? You can create it!

I call this new plasmoid Remember The Milk Simple because I’ve stripped out some features, and the intention of the widget is to provide a simple ToDo list for the desktop. I guess you could call it a fork of the original Remember The Milk plasmoid. Before anyone asks, I want to clarify that I’m not intending to release the widget as it is now. The reason is simple – I consider this a hack, and a very ugly one at that. If there is interest I might work a bit more on it but I doubt I’ll find the time.

“But what about all this FOSS stuff you just babbled about”, you might wonder. Fair enough. If you really want this widget or are interested in contributing, e.g. by cleaning up the code, you can check out (or rather, clone) the Git repo for this project:

To use it you’ll also need the Remember The Milk dataengine which is included in kdeplasma-addons.

That’s the end of my story, I hope it’ll inspire some to roll up their sleeves and start hacking. In the end I got (what I consider) a nice-looking ToDo list on my desktop, which will be an excellent complement to a widget I created called Procrastinate No More. Now I just need to actually start working on some tasks instead of hacking on widgets that remind me to do it.

Update October 15, 2012: Updated link to new repository on GitHub.

]]>http://blog.hanschen.org/2011/09/05/the-journey-to-a-simple-todo-widget/feed/11MoggerRemember The Milk plasmoidRemember The Milk SimpleShare your Knowledgehttp://blog.hanschen.org/2011/06/06/share-your-knowledge/
http://blog.hanschen.org/2011/06/06/share-your-knowledge/#commentsMon, 06 Jun 2011 20:22:30 +0000http://hanschen.org/?p=2056]]>As Anne already blogged about, I suggested during the WebWorld sprint that we try to strengthen the UserBase Wiki image. I made two proposals:

Whenever UserBase is mentioned the first time in a new context, call it “UserBase Wiki” or “KDE UserBase Wiki” if the context doesn’t make it clear that it’s KDE-related. The reason for this is that many people have mentioned that they didn’t know what a “userbase” was, and that they weren’t aware that UserBase actually is a wiki anyone can edit.

Give UserBase its own unique logo.

I had made a rough logo based on the idea “Connect the pieces” and intended to simply replace the KDE icon in the sidebar, but Claus and Anne saw another mockup I had made (for a completely different purpose) and thought it would look good with some text as well. Brilliant idea, strangely enough I hadn’t even thought about it – isn’t it wonderful to work with other people? During the sprint we set on “Share your Knowledge” and asked our logo creator Eugene to make a logo for us. Here’s the result:

Of course you should just head over to UserBase directly and see it in action. If you still see the old KDE logo you might have to refresh your cache, Shift + F5 in most browsers.

Finally, a reminder:

UserBase is a wiki for KDE users, made by KDE users. Registration is no longer necessary to contribute. Share your Knowledge »