Between Linux and Anime

Kind of like Schrodinger's Cat

Category: KDE (Page 1 of 4)

Nextcloud Plugin for QuickShare

So after a long hiatus I chose the Plasma QuickShare applet (which is sort of the Plasma5 replacement for the old Pastebin Plasmoid) as my point of re-entry into KDE code work. There was after all a deal of itches there I wanted scratched. It’s been quite a bit of fun figuring out the various interesting frameworks QuickShare is connected to at the backend. Anyways, some days ago I got a rudimentary Nextcloud plugin past review and pushed it, which should mean it’ll soon be coming to a 5.10-powered desktop near you :)

  • Let’s you upload files/text snippets/clipboard data onto your Nextcloud directly from your Plasma Desktop!
  • Uploads to the root folder by default “/”, but it’s possible to specify another folder by typing.
  • Supports all types of files/contents that the QuickShare applet currently supports, though raw clipboard data (like image data) don’t work too well because it doesn’t get the right file extension on server.
  • Automatically appends numbers to the filename to avoid overwriting an identically named file in the target location

It uses the KAccounts framework so you’ll need to create an ‘owncloud’ account in the “Online Accounts” settings module in order to use it (you can click the button on the applet to open the settings module). So far it’s been tested to work with a Nextcloud 11 instance, though it’s mostly WebDAV so it should work for previous versions as well.

Uploaded items should be private by default for now as it does not create shares out of them. This is probably what I’ll look into working on next.

If you’re not familiar with QuickShare, it’s a Plasma Applet that sits on your desktop and lets you share/move a file, or multiple files, or arbitrary clipboard contents, to various places (eg Pastebin, your mobile device via KDE Connect, Imgur, Youtube – and now Nextcloud!). You could either drag and drop the items you want shared onto the applet, or you could copy and paste.

Apart from fixing some crash situations and HiDPI hijinks with the applet, I also improved QuickShare’s keyboard navigation support, so it should be overall more friendly come 5.10. Notably, the keyboard shortcut setting actually does activate the plasmoid now, and the plugin list is now navigable with keyboard arrow keys.

To share a file from Dolphin, say, it is now possible to, with the file selected on Dolphin, ctrl+c, hit QuickShare’s keyboard shortcut binding to show the share plugin list, choose one with the keyboard arrow keys, and select by hitting enter.

Rate this post
An error occurred!

Binding the “Windows Button” to Right-Click – KDE Plasma on Tablet

Or to most anything else really. So this is what I hope will become the first of a series of blogs documenting my adventures getting a regular KDE Plasma (desktop) installation to tango with an x86 touch device – common nowadays in the form of Windows 8 tablets.

On my Machine and OS:
My specific machine is a Lenovo Yoga 11s (Haswell version), so not fully a tablet, but convertible into one by flexing the lower half all the way to the back. I had initially attempted with fair success to set up a Plasma Active-based system (by using experimental OpenSUSE Plasma Active packages), and with the right amount of tinkering that actually worked very well. However I eventually bumped into a few insurmountable hurdles: for example, the inability to set up Chinese and Japanese input since Maliit (the virtual keyboard) was an input method and, to the best of my knowledge, not dynamically switchable with a foreign language input method like ibus. So when inevitable circumstance eventually forced me to set up everything from scratch again, I decided this time to start with a regular KDE Plasma Desktop (on top of OpenSUSE 13.1), and see if I can harness the inherent malleability of Plasma and of Linux itself to achieve an acceptably touch-friendly setup.

Anyway on to the topic at hand. One of the distinguishing features of most x86 tablet computers today is that they, being originally sold as windows machines, sport a physical “windows button” near the screen:

This button on Linux would be bound to “super”, which on most DEs makes it basically useless since “super” by itself doesn’t usually do anything. On the other hand, touch screens on Linux generally simply behave like mice do, where taps are clicks and swipes are click-drags. The right click context menu is invaluable when using a traditional Linux desktop without a keyboard, and yet there is no direct way to right click with a touch screen. So a very useful customization I was able to put on my system is to bind the useless “windows button” to right-click.

This is less trivial than it might initially appear. A major pitfall is that while “super” on Linux by itself generally doesn’t do anything, it is heavily used as a modifier key for many keyboard shortcuts in most setups. So we need to bind “super” to a custom trigger, while at the same time preserving its use as a modifier key so that we don’t affect the keyboard shortcuts. Fortunately, someone has already worked this out for us. KSuperKey was originally written to allow KDE Plasma users to open the Kickoff menu (or the KDE Desktop’s “start menu”) by hitting just the super key a’la windows, but the program is also powerful enough that it could be used to bind the super key to any key combination – while preserving its status as a modifier key.

So as a first step, grab and install KSuperKey, then use it to bind super to a currently unused key-combination. For example, to bind super to Alt + F10, run the following:

ksuperkey -e 'Super_L=Alt_L|F10'

You can add this to a script in ~/.kde4/Autostart/ so that it is run automatically on session startup. Now hitting the windows button should be the same as hitting Alt + F10, so the next step is to map Alt + F10 to right click. But how do we emulate right click in the first place? Turns out it isn’t half hard. Just install xdotool, and create a script called fake-right-click (or anything you want) with the following contents:

xdotool click 3

Give it execute permissions and run it and you should immediately see the right click context menu open next to your mouse pointer! So now all we need to do is bind Alt + F10 to our new script.

You may think this easily achievable using the built in KDE custom shortcuts control module, and indeed this was what I tried first, but it turned out that for some reason or another this wasn’t reliable, and hitting the windows button would sometimes bring up the context menu and sometimes not. A more reliable means by experiment is to use xbindkeys. Using it for our purposes is quite easy: get it installed, then create the file ~/.xbindkeysrc with the following content:

alt + F10

Then simply run xbindkeys. (Again, you can add xbindkeys to a script in ~/.kde4/Autostart/ to have it run on session startup). That’s the last step! Hitting the windows button now should behave exactly like right click, letting you do all kinds of things previously not possible without a keyboard and mouse:

Rate this post
An error occurred!

Applying Kwin Blur to Transparent Konsole/Yakuake Windows

If you use Konsole or Yakuake with transparency you might have noticed that Kwin’s blur effect, that has been around for awhile and that blurs the background of various transparent elements in the UI (eg panels and plasma popups), does not apply to transparent Konsole or Yakuake windows. This has always irked me a tiny bit, but when I discovered that you can blur transparent terminal windows on OSX, that got me itchy enough to do the token research.

The story is a familiar one: it’s not too hard just to GET WORKING, and patches to do it exist, however getting it to work in a sensible way is non-trivial, and so the patches are rejected and the feature itself is pending future structural changes. Basically, it’s not going to happen on it’s own anytime soon.

Fortunately, there are ways to get it working on your own – and they do not involve applying custom patches and rebuilding anything. Turns out there is a terminal command one can run to immediately apply blur on, for example, current active Konsole windows:

xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id `qdbus org.kde.konsole /konsole/MainWindow_1 winId`

And for a currently active Yakuake:


Now to do this automatically so that your yakuake and konsole windows are ALWAYS blurred, you can simply add the following lines to your ~/.bashrc:

Spoilered: Old, not so good code Show

Edit: commenters have posted improved versions of the code, thanks commenters! See improved version below:

Spoilered: Code for non-KF5 and old yakuake Show

Edit2: KF5 Konsole and Yakuake 3 onwards requires updated code, as well as xdotool to be installed so we can fetch yakuake’s win id:

konsolex=$(qdbus | grep konsole | cut -f 2 -d\ )
if [ -n "$konsolex" ]; then
for konsole in `xdotool search --class konsole`; do
if [ `qdbus | grep yakuake` ]; then
xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id `xdotool search --class yakuake`;

Of course, this often results in the command being run redundantly, but that doesn’t appear to bring any tangible ill-effects. It all works well enough for a quick hackaround. And the results are delicious indeed.

Rate this post
An error occurred!

Getting the Maliit/Plasma Active Virtual Keyboard working for Gtk apps in PA3

I’ve had more frustration than I’m comfortable admitting to trying to get this to work – I actually gave up and compiled kvkbd at one point. Now that I have it down though it all looks infuriatingly obvious in hindsight. Anyway..

The problem: if you have the official Plasma Active 3 image installed and running on some device, and at some point or another installed/ran a gtk app on your system, you’ll quickly realize that the Maliit-based virtual keyboard does not trigger in your gtk app. That’s contrary to what was promised from the Maliit move! And in fact Maliit predates Plasma Active and should have perfect gtk support, so what gives? It turns out that Plasma Active only includes the Maliit input context plugin for Qt and not for gtk, and that’s basically the problem. (Presumably they decided to save it since the image does not include anything gtk)

The solution: You basically need to install that gtk input context plugin. What I did was I took the package from the recommended repos for openSUSE linked from the Maliit website (specifically this repo). The commands to run (as root!) are:

# zypper ar maliitosfact
# zypper refresh
# zypper in maliit-inputcontext-gtk2

And then update the gtk immodules before rebooting:

# gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules

Note: Zypper will complain about different maliit versions and prompt you to fix by pulling and replacing packages from the openSUSE repo – DON’T DO IT! Just tell it to break maliit-inputcontext-gtk2 by ignoring some dependencies so you install only one package!

You might also want to disable the openSUSE maliit repo after you’re done so you don’t inadvertently pull stuff from it in future:

zypper mr -d maliitosfact

I’m not 100% sure pulling and replacing those packages will actually cause bad things to happen, but I’ve learnt by being bitten – painfully – multiple times not to risk these things if at all possible :) Anyway, the plugin in fact does work perfectly with the Maliit stuff from Plasma Active despite the zypper warnings:

Plasma Active Maliit Keyboard working on an old Fennec build

Of course, this all only works assuming you’re on an i586/x86 device. It’ll probably be harder to find binary packages for the input plugin on arm for example, but this should hopefully at least point you in the right direction. Perhaps you could just build it from source or something.

I know it’s probably already near the end of PA3’s lifecycle now, but hopefully this will still help some frustrated soul out :)

Rate this post
An error occurred!

Anime and the Nepomuk Metadata Extractor

Here’s a long-procrastinated update on my endeavors re: Nepomuk and Anime, first introduced here. I mentioned then that the way forward would be to create a plugin-based framework so one could fetch anime metadata from different online sources. Well, as it turned out, I found out that Joerg’s Nepomuk Metadata Extractor can already do that, so I scurried over and grabbed the sources and did my subsequent work on top of Joerg’s program. The anime use-case is now in a fairly workable state. Basically, what the program does is it lets you manually or automatically source for meta information (series title, episode number, synopsis etc) from online sources for anime video files you have on your disk, and write all that to file as Nepomuk metadata.

Read More

Rate this post
An error occurred!

Associating Firefox Profiles with KDE Activities

As a heavy user of the Activities feature, I’ve always had two major itches. One was addressed when KDE 4.9 finally brought the ability to set activity window rules. The other was how only some applications had the necessary (XSMP) compliance to work properly with activities and its session restoring – in particular, a lack of compliant web browsers.

Read More

Rate this post
An error occurred!

Nepomuk and Anime, my new pet project

Some time ago I stumbled upon a cool little piece of code that Sebastian Trueg wrote, which sourced an online tv database (the TVDB) for meta information about video files of TV series you had on your disk, figuring out what the series, season and episode was from the filename, and storing that info in the Nepomuk semantic framework. That happened to coincide with some of the ideas I had on how a semantic desktop should work with regards to media consumption, and specifically for watching and dealing with Anime. Anyway I recently cleared myself some hobby-hacking time, rolled up my sleeve, set Trueg’s little program up on my box, and tinkered a little with the filename analyzer. Result of which is that the program now also recognizes common anime rip filename formats, and since the TVDB also contains a pretty comprehensive list of anime, we get the following:

Pretty sweet :) In fact, the way Trueg wrote it, you don’t even need to go through the context menu when you add a new file, Nepomuk/Strigi automatically attempts to fetch the metadata when it indexes your new file. So what is the point of this? Point number one of course is that it’s pretty cool! Point number two is that all these metadata are stored in Nepomuk, which in turn makes these data available to any other program running on the desktop that recognizes and queries it. What kind of programs would want to do so? In short, plenty. Some ideas off the top of my head would include a media player that knows what episode of what series it is playing, and can automatically offer to play the next episode, or list the other episodes of the series that you have. Or a series browser (plasmoid?) that let’s you browse your videos by series instead of by folder. Your imagination is the limit. I would myself like to try to make some of those happen, but that’ll be getting too far ahead for the time being.

This program in it’s current state has a glaring problem in the context of anime: the TVDB web api (through which the program searches for the series info) does not support aliases, and so you need to be searching for the precise name of the series as stored on TVDB or you’ll turn up blank. And with anime, series names can vary pretty wildly. For example, querying “Dantalian no Shoka” doesn’t work because the series is stored in TVDB as “The Mystic Archives of Dantalian”. It’s an annoyingly serious shortcoming – half of my files don’t work thanks to this.

So fixing this will be what I’ll work on next. TVDB says they’ll support aliases in their new site, but there’s no release date of that in sight. A simple solution would be to query a different site, like MAL, which appears to have a decent API. In fact, new web sources and APIs should be pluggable, so that’ll be task number one, separating the web-sourcing part into a plugin infrastructure.

I do have some vague plans on the future of this thing, but let’s not count our chickens too much. We’ll get there when we get there. In the meantime if you want to play, you can clone my git repo and grab the source code:

git clone git:// nepomukoracle-code

In order to build this you’ll also need Trueg’s libTVDb and Shared Desktop Ontologies 0.9.0 and onwards – look for that one in your repos.

Rate this post
An error occurred!

Fixing your slow/laggy dolphin WITHOUT killing nepomuk

Try this before pulling the plug on Nepomuk!

As stalwart as I am a fan of the dolphin file manager and the nepomuk technologies it integrates, I was recently forced to admit that the thing was really slowing down, close to the point of unbearability, on my system. I assumed that the most direct solution was to disable nepomuk, but I like nepomuk. As it turned out though, fortunately, the solution didn’t involve toggling nepomuk stuff at all.

Try it: simply remove/hide your trash and DVD/CD ROM folder from the places panel.

The difference is bafflingly, inexplicably fantastic, my dolphin’s on steroids now. So, friends, if your dolphin ain’t playin nice with ya, try this out first before you pull the plug on nepomuk.

Source: This magnificent man’s post.

Rate this post
An error occurred!

I’m just gonna leave this here

Yes, that is Plasma Active, and yes I am the fresh owner of that tablet. Don’t ask about the hole in my pocket. It’s a Viewsonic Viewpad 10 that came with Android and Windows 7. Well, it runs Android and Plasma Active (on OpenSUSE) now ;)

Also I just enrolled for this AI class. Coolbeans.

A little swamped right now, and as is often the case during times when I am swamped, lots of interesting things are going on and I’m itching to write stuff. Time however, is scarce :( We’ll see what happens.

(Linux + Touch = <3 <3 <3)

Rate this post
An error occurred!

Dealing with “cmake/modules/FindKDE4Internal.cmake not found”

Not the most intuitive error message ever:

CMake Error at /usr/share/cmake/Modules/FindKDE4.cmake:98 (MESSAGE):
ERROR: cmake/modules/FindKDE4Internal.cmake not found

and the exact problem wasn’t immediately obvious to me, even after having dabbled in CMake-ing and KDE-ing for some time. Anyway, problem is simple – you’re missing some KDE development stuff. For me (OpenSUSE) I had to install the kdebase-workspaces-devel package. Look for something similar in your repositories and install it, and you should be good.

Rate this post
An error occurred!

Page 1 of 4

Powered by WordPress & Theme by Anders Norén