The difficult art of explaning

Posted by Esben Mose Hansen Sun, 11 Oct 2009 18:04:00 GMT

Sometimes, explaining abstract concepts concisely in an easy-to-understand language is everything but simple. Consider Klipper's config dialog as I recently adjusted it to look

Now, if you already know the difference between selection and primary when talking about the X clipboard, the radio button and the check box are both pretty clear, at least in my opinion. If not, I hope that the verbose what-is text might bridge the confusion, but I am not so sure. So, dear readers, do any of you understand what I'm trying to say? Can some of it be clearer? If you do not understand what I'm going on about, see below, where I'll try to explain at length what selection and primary is all about.

X does not have one clipboard but several clipboards, of which 2 are actually commonly used. They are often named after their XAtoms, "SELECTION" and "PRIMARY". Traditionally, X has supported highlightning an area with the mouse and then middle-clicking to paste this selection elsewhere. This is done via the SELECTION clipboard. Practically speaking, that means that if an area is selected in well-behaved X program XAPP, it will notify X that that XAPP now has the SELECTION. Thus, when the middle mouse button is clicked somewhere, the clicked application can ask X "give me the contents of SELECTION", and X can send the request on to XAPP, which can then send back the answer. Reasonable simple, even if I did leave out all the details about formats. Completely independent of this, X also has a clipboard like known in most other desktop environments, in which the user, usually by a keystroke like ctrl-C or a menu selection makes the application tell X "I now have the PRIMARY", and when the user selects paste somewhere, the content of the PRIMARY is pasted via. the same mechanism as the SELECTION above.

Now, many people find this to be confusing and/or annoying in practice. Keeping track of 2 different clipboards requires the user to remember "Did I just select it or did I copy it to the clipboard? If I selected it, I have to grab my mouse and use the middle button, otherwise I will have to press ctrl-V to paste." Thus, Klipper provide the ability to synchronize the PRIMARY and the SELECTION, ensuring that whatever method the user used to copy to the clipboard(s), all methods works for pasting. For the traditionalists, the option to keep the clipboards separate is also provided.

So what is this "ignore selection" all about? Well, if you use the separate option above, the clipboard history will still be populated from the mouse selection, and Klipper's actions will still be triggered. Some people do not want this: they wish Klipper to keep its endearing hands off SELECTION and only act on PRIMARY. So that is the last option. This will make the clipboard be almost completely like the Windows clipboard, except that you can still accidentally paste the mouse selection by pressing the middle mouse button, which is an X thing through and through.

Again, I'd value people's comments, and I do believe the comment system is actually working now. Otherwise, please direct comments to me by email.

PS: Now at 98 bugs. They seem to come in as quickly as I can fix them.

Posted in  | Tags , ,  | 23 comments | no trackbacks

One Klipper feature to fix many bugs: Introducing more flexibility in actions

Posted by Esben Mose Hansen Sat, 10 Oct 2009 06:56:00 GMT

One very common request for Klipper is "do stuff with the clipboard". E.g.

  1. Search google for something selected.
  2. Count the number of words, lines whatever for the current clipboard
  3. Strip the clipboard of special formatting

Now, as you might know, Klipper has actions. An action is like a filter that looks for patterns in the clipboard. An example pattern could be "bug: followed by a number". If the pattern matches, the action springs into life offering to do one of several commands in a small popup. Each command offers something, like "find the KDE bug with this number" or "find Debian bug with this number" or what have you. Now, a small popup appearing whenever you copy something is annoying for many, and thus you have the option of disabling the automagic popup and instead invoking the scanning manually by pressing ctrl-alt-r (by defeault).

As the attentive reader will note, the first item on the list above is almost satisfied by actions: Simply define a pattern that matches (nearly) everything and have it invoke a command to search google. The snag appears if you like the automagic popup, as even the most avid popup lover would be somewhat frustrated to have the popup appear at every copy! So I have added an option to actions, so that they can be configured to only trigger on a manual invocation by deselecting the "Automatic" checkbox in the configuration dialog.

.

The two remaining items on the list just need one more thing: The output of a command should go back on the clipboard. For this purpose, I made it so any command's output can either be Ignored (old, default), Add'ed to the clipboard history or Replace the original. That way, the user can set up an action to run something through wc -c to get the character count right onto the clipboard. Neat!

During the course of fixing this, I also fixed an unfortunate interaction. Sometime back, the bright idea was born that clipboard snippets could be run through KDE's magic system of handling URL's. In that way, if e.g. a file on the harddisk was copied to the clipboard, Klipper could offer to open the file in an appropriate program. Neat! Unfortunately, a bug was introduced so that this only worked if at least one normal action was present. And then all the default actions were removed because they were "old and unneeded". Apparently, a lot of distributions, including the pecked-on Kubuntu, actually caught this and continues to install the old file full of actions, but a few (like SuSE I think) did not and thus revealed the bug. Much confusion ensured, until a user noticed that adding a dummy action fixed the problem. Ah well, it is fixed now. I would also like to resurrect some actions, perhaps disabled, so the user has a few examples to go by.

Next up: Making klipper work with Eclipse. Which calls for me to install that exotic IDE. Wouldn't it just be easier if everyone switched to KDevelop instead ;)? Which is by the way really awsome these days, beta or no.

Posted in  | Tags , ,  | 3 comments | no trackbacks

Designing a small crossword with KrossWordPuzzle

Posted by Esben Mose Hansen Tue, 06 Oct 2009 19:39:00 GMT

I took up the Mr. Pülz's challenge of designing a crossword with in-cell clues in KrossWordPuzzle. This turned out to be a challenge for me, but fortunately I had help from some great resources. One was OneAcross which is a great crossword dictionary. I don't hold with using them to solve crosswords, but for designing them it was really helpful. The other great resources were, of course, Wikipedia and it's sister Wiktionary. Thank you all three, I could not have done it without you.

Speaking of help, the 0.8.2. version is much nicer to work with than the 0.8.1, so if you are going to design puzzles, go with that. For one thing, it is now possible to have one-letter solutions (yay! essential in that style). I also had a brush with a bug fixed in 0.8.2, namely the crash when working at the very edge of the crossword. It was the last clue... and then it crashed. Eeek! Fortunately, the error recovery was smooth. Whew!

One thing that did not pan out so great was that only one clue/cell is supported. If you solve my puzzle, you'll note that there is a few places where one horizontal and one vertical clue in one cell would be in order. Actually, you often see 3 clues in one cell. I also really missed being able to edit the clue and the length of the solution. Please, please, could we have this?

Finally, without any more begging or bitching: TheEsben 1st crossword puzzle. A small 8x8 beauty. Please tell me if you solve it :) And no cheating, naughty you!

Posted in  | Tags ,  | no comments | no trackbacks

ubuntu-package for KrosswordPuzzle

Posted by Esben Mose Hansen Mon, 05 Oct 2009 19:09:00 GMT

I decided to do an Ubuntu package for KrossWordPuzzle 8.3, which is a neat crossword puzzle player. It is able to download a large number automatically from various newspapers, making getting started on solving very quick and pain free. While Swedish-style grids are supported, none of the downloadable ones are of this type, the more’s the pity. Still, it is loads of fun even if doing crosswords in your 2nd language is kind of hard.

I do not claim to be the perfect packager, but the the package should work fine for the current Ubuntu release 9.04 aka Jaunty. Please tell me about any bugs in the comments. Download krosswordpuzzle_0.8.3-1_i386.deb, and enjoy. I might also cook up a Debian package if anyone asks for it, as it should be simple enough. It will require unstable/sid, though, as I don’t believe testing/squeeze carries the necessary KDE packages.

Enjoy!

Edit – again

I made a version for 08.3 here: krosswordpuzzle_0.8.3-1_i386.deb

Posted in  | Tags , ,  | no comments | no trackbacks