“Command Not Found” Plasma Runner

July 28, 2010

As promised, an explanation.

This is the “Command Not Found” runner. For those of you who may not be familiar, command-not-found is a magical little command line tool that gets activated when the shell cannot find the binary you wish to launch. It has a database of binaries and package names, and can check to see which package contains the binary you tried to type. If it finds one, it tells you which package to install to get this binary.

But I find that I use KRunner for launching my stuff more often these days. On new installs, I instinctually go to KRunner and try to type in the name of my favorite app.  But then I get nothing; realizing that this is a new install and I have yet to install this piece of software. I mumble, backspace, and type in the name of my favorite package manager. I then type in the name of the application I wanted (again) and mark it for installation.

…but wouldn’t it be nice if I didn’t have to? I don’t anymore, thanks to the Command Not Found runner. I was browsing the KDE brainstorm section of the KDE forums and saw this idea. I thought it was neat and actually feasible, so yesterday I sat down and hacked. By the end of the day, the installer/command not found runner was born!

Here’s how it works: Whenever KRunner cannot find an application via KService, the Command Not Found runner takes what you typed and tells the command-not-found utility to find which package has that program. If command-not-found finds anything, the runner returns a result. Click that result, and it starts qapt-batch, telling it to install that package. You just have to enter your password, and qapt-batch will do all the rest. Neat!

As an added bonus, if the runner detects that the program you are trying to run has a different name than the package it is in, it gives a nice, helpful little subtext that explains that the amarok package contains “amarokpkg”, even though the package isn’t named “amarokpkg”.

A few notes based on the comments my mysterious post last night introduced:

  • This is not meant to replace traditional package management. It is just a little convenience feature that can only ever install things that aren’t installed. It will never do anything more than that package management-wise.
  • Going back to the first point, it is (in general) a good thing that you have to know the exact name of the program to get this to show up. It limits the usecase of this service to those who forgot that they hadn’t installed $app yet, and will have a very small likelihood of showing up for somebody who is not trying to run $app. There would really be no reason to not enable this by default, especially since KRunner is somewhat of a hidden feature in the first place…
  • The KRunner plugin can be turned off.
  • It does not do any package management itself. It leaves the installation to a real batch installer program.
  • If the user does not have the privileges to install packages, it will not show up.

At the moment, it only works on Debian-based systems, since it requires the Debian command-not-found program. Sorry ’bout that. :( I just don’t see a way that this could be done in a cross-distro manner right now… It was simple to code, however, so it shouldn’t be too much trouble to make one for another distro, if you know how their command-not-found works (if they have one, of course)

Going back to the KDE Brainstorm post, it is definitely feasible to add this to Kickoff. It does require a one-line patch, however, so that pretty much limits it to people who want to patch kickoff themselves to get the runner to show results there… It would be neat if we could make certain “categories” of runners, and then have kickoff configured to only show the results of certain categories. At the moment there’s a whitelist that you have to add to before they’ll show.

I’ll try to get packages up in the next few days, but due to my impending vacation I don’t know how successful I’ll be in actually getting around to it. You can grab the source here if you want to. It should just need kdelibs5-dev to build.


Whatever might this be? (Return of the Whatever)

July 28, 2010

Mysteriously introducing new Plasma-based technologies…. it’s what we do. (Click shinies for bigger)

…and I’ll leave you with that.

Oh, and I’m planning the QApt/Muon 1.0 beta release for tomorrow. (Well, technically today, as it is just past midnight. Probably within twelve hours.) But I need some sleep now. I’ll also probably be nice and fill in a bit more about the mysterious contents of this blog post. ;)


How to sexify/improve KDE4 (even further)

May 12, 2008

On its own, the default KDE4 desktop Kubuntu-KDE4 gives you is pretty damn sexy. We can improve on it, though.

1. Improve how GTK applications appear.
This is about the most obvious rough patch of the Kubuntu-KDE4 look-n-feel. One of the most common complaints I hear about KDE4 is how fugly Firefox and other GTK applications look. This is actually a two-pronged problem.

-It is partly a KDE bug.
If you had selected a GTK theme other than the default one, GTK apps should not revert to the ugly default theme. This bug has been recently fixed in KDE /trunk.

-It is partly not a bug at all.
It’s true, GTK applications not having the samw look-and-feel as your normal, Oxygen-lovin’ Qt applications isn’t actually actually a bug. It’s more of the lack of a gtk-qt theming engine. Regualr old Kubuntu has one, and it works quite well.

Solution: Install gtk-qt-engine-kde4
This package is not installed by default. This package will do the same thing as it’s non-kde4 counterpart, gtk-qt-engine, theming your gtk applications with your Qt theme. The KDE4 version of gtk-qt-engine is new software and not without its bugs. Most of them are due to Firefox 3’s new GTK theming capabilities. Firefox 3 (An XUL application) actually “emulates” being having a GTK user interface. Our gtk-qt engine has a few problems dealing with this…

It still looks quite good, anyhow, as you can see from this screenshot.

2. Try a different Plasma widget theme, perhaps?
Even though the ability to change themes via a GUI won’t officially arrive until KDE 4.1 this July, it is still quite possible to change which theme you have. It’s quite simple really.

-First, create the folder ~/.kde4/share/apps/desktoptheme if it doesn’t already exist.
-Download one of the many themes off of KDE-Look. (I made my own theme, for the lulz.)
-Extract the theme to a folder inside
~/.kde4/share/apps/desktoptheme .
-Press Alt+F2, and type in kquitapp plasma. Plasma will go away; don’t worry we can get it back easily!
-Press Alt+F2 again and run Kate, open
~/.kde4/share/config/plasmarc .
-Where it says [Theme], change name=default to name=the name of the theme folder in the desktoptheme directory.
-Save, exit.
-Alt+F2 to bring up Krunner, type “plasma” and hit enter to bring back Plasma.

Plasma should now be sporting a pimpin’ new theme.



3. Get more Plasmoids!
Widgets == sexy. Therefore, more widgets == more sexy. If you haven’t already, install extragear-plasma for more widgets. KDE-Look also has a growing number of 3rd party, non-KDE plasmoids. You can install all of ‘em if you’re comfortable compiling things, but don’t worry if you aren’t comfortable with compiling things. I have made Ubuntu packages for the following plasmoids:

-Coremoid
This is a plasmoid that can monitor and interact with the cpufreq service. You can monitor cpu usage and manage frequency governers with this Plasmoid.

-Email Notify
This is a plasmoid that pings your mail server to let you know how many new messages you have. With this plasmoid there is no need to have your email application open all the time, or even your gmail tab open all the time in your web browser. You can reduce your memory footprint with this plasmoid since you won’t have to have your email client open all the time. As of emailnotify 0.3 Email Notify will behave well in the panel.

-Plasma-Wifi
A neat little plasmoid. It is used to give a visualization to your wifi connection strength.

-Toggle-compositing
This is a very useful plasmoid. It only has one function, and that is to turn on and off KWin desktop effects. With this you can disable effects before running OpenGL applications or games running in Wine without having to go back to System Settings and disabling it from there.

All of these are as easy to install as a regular program.
Add this:

deb http://ppa.launchpad.net/echidnaman/ubuntu hardy main

To your Repository list in Adept. Now plasmoids are as easy to install as regular applications. Package names for the plasmoids in my repository are:

coremoid
emailnotify
plasma-wifi
toggle-compositing

That’s it! I hope that you could use at least one of these suggestions. If I think of any other ways to improve the KDE4 desktop experience I’ll post ‘em here.


Follow

Get every new post delivered to your Inbox.

Join 25 other followers