kde4 Syndicate content Syndicate content

» Access klipper clipboard on CLI under KDE4

Wed, 08/13/2008 - 23:12

Here’s a little script you can save in your path and do things like

  1. # paste current clipboard into file
  2. clipboard > "some_file"
  3. # copy some file into clipboard
  4. cat "some_file" | clipboard

Actually I find it rather useful so I thought I will have to share it.

Since KDE4 D-BUS is used throughout KDE and thus in Klipper as well. IMO they should really rework the output of dbus-send or add some more flags (what about --quiet). Well that’s the reason why the script below is somewhat long. But nothing a little bit of bash+awk magic couldn’t cope with:

  1. #!/bin/bash
  2.  
  3. # check for stdin
  4. # since we don't want to wait endlessly we set a timeout
  5. # a pity `read` only supports seconds and no fractions...
  6. read -t 1 stdin
  7. if [[ "$stdin" != "" ]]; then
  8. # get the rest of stdin
  9. stdin=$stdin$(cat)
  10. # oh, nice - user input! we set that as current
  11. # clipboard content
  12. dbus-send --type=method_call --dest=org.kde.klipper \
  13. /klipper org.kde.klipper.klipper.setClipboardContents \
  14. string:"$stdin"
  15. exit
  16. fi
  17.  
  18. # if we reach this point no user input was given and we
  19. # print out the current contents of the clipboard
  20. # note: I hate the output of dbus, dcop was much easier in that regard!
  21. dbus-send --print-reply --dest=org.kde.klipper /klipper \
  22. org.kde.klipper.klipper.getClipboardContents | awk '
  23. BEGIN { output = ""; }
  24. {
  25. if ( NR > 1 ) {
  26. output = output $0 "\n";
  27. }
  28. }
  29. END {
  30. print substr(output, 12, length(output) - 13);
  31. }'

As usually, save the file (attached below) in your $PATH and make it executable.

PS: Thanks to Martin Vidner for his article on D-BUS btw. - it gave me the proper dbus commands.

» LinuxTag Day One

Wed, 05/28/2008 - 15:29

Like last year I’m again standing at the Kubuntu Community booth at this years LinuxTag. Just now I’ve attended the keynote held by Aaron Seigo, ambassador of the KDE project. It was a very interesting talk which covered topics like Internet-Mobile-Desktop interaction, security, effects, Nokia and more. The most important parts roughly listed are:

  • you’ll one day be able to use the same (KDE) applications everywhere - Marble and Plasma for example already just compile and work on mobile devices
  • the internet will get much more embedded into your everyday applications. Marble with OpenStreetMap & Wikipedia support or Amarok with its storage backends (Lastfm, Jamendo etc. etc.) are good examples in this regard.
  • KDE4 is much more accessible than KDE3 thanks to QAccessible
  • security and privacy is not forgotten! This is free software, don’t forget that. Plasma Applet packages will get GPG signed (just like the DEB packages in Apt). And you have control over what data is send where - no Stasi 2.0 here!
  • Nokia is actively supporting KDE, fear not! And of course never underestimate the power of the Free Qt Foundation.

All in all it was a very good presentation with good questions - very informative! I’m totally going to check out kde4daily now - KDE 4.1 is impressive!

Just on a sidenote: LinuxTag is going well but Kubuntu and Ubuntu did not get any CDs shipped by Canonical which is a shame of course… Nevertheless the social aspect of this fair is awesome again - you get to know so many people and meet some which you’ve talked to over IRC for ages. Yesterday we went to a bar at Hackescher Markt with the KDE and Amarok guys and had a few beers, tomorrow will be the social event, which was absolutely humongous (to use a word Aaron teached me yesterday ;-) ) last year. And on Friday we’ll go to a restaurant with the Trolls (just like last year - thanks for the invitation!) and maybe go into a Karaoke Bar afterwards. Great! And of course on Saturday there is a Ubuntu Grill at the C-Base, organized by Ubuntu Berlin - neat! Last year that was a great finishing to a good fair.

If anybody wants to drop by we are in hall 7.2b, booth 124 (together with Amarok). If you need a free ticket, just send me an email (mail@milianw.de). See you here!