Linux Fu: Easy Widgets

Here’s a scenario. You have a microcontroller that reads a number of items — temperatures, pressures, whatever — and you want to have a display for your Linux desktop that sits on the panel and shows you the status. If you click on it, you get expanded status and can even issue some commands. Most desktops support the notion of widgets, but developing them is a real pain, right? And even if you develop one for KDE, what about the people using Gnome?

Turns out there is an easy answer and it was apparently inspired by, of all things, a tool from the Mac world. That tool was called BitBar (now XBar). That program places a widget on your menu bar that can display anything you want. You can write any kind of program you like — shell script, C, whatever. The output printed from the program controls what appears on the widget using a simple markup-like language.

That’s fine for the Mac, but what about Linux? If you use Gnome, there is a very similar project called Argos. It is largely compatible with XBar, although there are a few things that it adds that are specific to it. If you use KDE (like I do) then you’ll want Kargos, which is more or less a port of Argos and adds a few things of its own.

Good News, Bad News

The good news is that, in theory, you could write a script that would run under all three systems. The bad news is that each has its own differences and quirks. Obviously, too, if you use a complied program that could pose a problem on the Mac unless you recompile.

Continue reading “Linux Fu: Easy Widgets”

Hackaday Links Column Banner

Hackaday Links: October 24, 2021

It seems that the engineers of NASA’s Lucy spacecraft have some ‘splaining to do. The $981M asteroid-seeking mission launched without a hitch, but when the two solar panels unfolded, one of them failed to latch into place. Lucy’s two large solar arrays combine to an impressive 51 square meters. Both are critical to this 12-year mission as it will travel farther from the Sun than any previous spacecraft, and be gone for longer. The problem is that Lucy is on an escape route, and so they can’t just sidle up to her with a repair craft. Even so, NASA and Lockheed are “pretty optimistic” that they can fix the problem somehow. On the bright side, both solar arrays are providing power and charging batteries inside the cockpit.

It’s kind of hard to believe, but KDE is turning 25 this year! Well, the actual anniversary date (October 14th) has already passed, but the festivities continue through the 25th when KDE founder Matthias Ettrich delivers a fireside chat at 17:00 UTC. Registration begins here.

EnergyStar, purveyors of appliance efficiency ratings and big yellow stickers, will no longer recommend gas-powered water heaters, furnaces, and clothes dryers on their yearly Most Efficient list. They will continue to give them ratings, however. This move was prompted by several environmentalist groups who pointed out that continuing to recommend gas appliances would not put America on track to reach Biden’s 2050 net-zero carbon emissions goal, since they produce greenhouse gases. We totally understand the shift away from gas, but not so much the nitty gritty of this move, which the article presents as exclusive of any appliance that doesn’t run on 100% clean energy. You can’t prove that a user’s electricity is renewable. For example, this consumer is well aware that the energy company in her town still burns coal for the most part. Anyway, here’s the memo. And a PDF warning.

Sure, you can trawl eBay for space rocks, but how do you know for sure that you’re getting a real meteorite? You could play the 1 in 100 billion or so odds that one will just fall in your lap. Just a few weeks ago, a meteorite crashed through a British Columbia woman’s ceiling and landed between two decorative pillows on her bed, narrowly missing her sleeping head. Ruth Hamilton awoke to the sound of an explosion, unaware of what happened until she saw the drywall dust on her face and looked back at the bed. The 2.8 pound rock was the size of a large man’s fist and was one of two meteorites to hit Golden, BC that evening. The other one landed safely in a field.

Hackaday alum Jeremy Cook wrote in to give us a heads up that his newest build, the JC Pro Macro 2, is currently available through Kickstarter. It’s exactly what it sounds like — a Pro Micro-powered macro pad. But this version is packed with extra keyswitches, blinkenlights, and most importantly for the Hackaday universe, broken out GPIO pins. Do what you will with the eight switches, rotary encoder, and optional OLED screen, and do it with Arduino or QMK. Jeremy is offering a variety of reward levels, from bare boards with SMT LEDs soldered on to complete kits, or fully assembled and ready to go.

Linux Fu: Raspberry Pi Desktop Headless

It seems to me there are two camps when it comes to the Raspberry Pi. Some people use them as little PCs or even laptops with a keyboard and screen connected. But many of us use them as cheap Linux servers. I’m in the latter camp. I have probably had an HDMI plug in a Pi only two or three times if you don’t count my media streaming boxes. You can even set them up headless as long as you have an Ethernet cable or are willing to edit the SD card before you boot the machine for the first time.

However, with the Raspberry Pi 4, I wanted to get to a desktop without fishing up a spare monitor. I’ll show you two ways to get a full graphical KDE desktop running with nothing more than a network connection.

The same principle applies to most other desktop environments, but I am using KDE and Ubuntu on the Pi, even though something lighter would probably perform better. But before we get there, let’s talk about how X11 has had a big identity crisis over the years.

The Plan

There are many ways to remotely access X programs, many of which are rarely used today. However, for this purpose, we are going to use SSH tunneling along with some special tricks to get the entire desktop running. It is easy to just run a single X program over SSH, and you’ve probably done that often. If so, you can skip to the next section.

Continue reading “Linux Fu: Raspberry Pi Desktop Headless”

$99 Pinebook Gets KDE Neon Port

If you’re the kind of person who likes small and cheap Linux devices, you’re definitely alive in the perfect moment in history. It seems as if every few months we’ve got another tiny Linux board competing for our pocket change, all desperate to try to dethrone the Raspberry Pi which has already set the price bar exceptionally high (or low, as the case may be). We’ve even started to see these Linux boards work their way into appropriately cheap laptops, though so far none have really made that great of an impression.

But thanks to the efforts of Blue Systems and Pine64, the situation might be improving: they’ve worked together on a build of KDE Neon for the $99 Pinebook. The fact that they’ve gotten Plasma, KDE’s modern desktop environment, running on the rather mediocre hardware at all is an accomplishment by itself. But they’ve also set out tailor the entire system for the Pinebook, from the kernel and graphics drivers all the way up to Qt and Plasma tweaks.

In a blog post announcing the release candidate of the OS, Neon developer [Jonathan Riddell] says that these top-to-bottom improvements show that you can turn a super cheap Linux laptop into a practical computer if you’re willing to really get in there and optimize it. He also says the project has been something of a two-way street, in that improvements made for the Pinebook build have also been applied to upstream development.

The last time we looked at the Pinebook, we came away cautiously optimistic. It wasn’t great, but it was about as good as you could possibly expect given the price. If more developers are willing to go out on a limb and start optimizing their software for the device, it might become a very promising platform for low-cost mobile hacking.

Linux Fu: X Command

Text-based Linux and Unix systems are easy to manipulate. The way the Unix I/O system works you can always fake keyboard input to another program and intercept its output. The whole system is made to work that way. Graphical X11 programs are another matter, though. Is there a way to control X11 programs like you control text programs? The answer to that question depends on exactly what you want to do, but the general answer is yes.

As usual for Linux and Unix, though, there are many ways to get to that answer. If you really want fine-grained control over programs, some programs offer control via a special mechanism known as D-Bus. This allows programs to expose data and methods that other programs can use. In a perfect world your target program will use D-Bus but that is now always the case. So today we’ll look more for control of arbitrary programs.

There are several programs that can control X windows in some way or another. There’s a tool called xdo that you don’t hear much about. More common is xdotool and I’ll show you an example of that. Also, wmctrl can perform some similar functions. There’s also autokey which is a subset of the popular Windows program AutoHotKey.

Continue reading “Linux Fu: X Command”