April Music

Music I’ve bought in April.

Shockingly few albums this month — I was away for a couple of weeks.

But my demos from my brother’s teenage punk band was released on CD, at least.

Oren Ambarchi / Johan Berthling / Andreas Werliin "II" (Official Music Video)

And the new Oren Ambarchi / Johan Berthling / Andreas Werliin album is swell.

Still House Plants - "M M M"

And the new Still House Plants album seems good, but I haven’t really had much of a chance to listen to it yet.

Onscreen Keyboards and Emacs and Stuff

This is part two of a series of blog posts that I’m sure is going to go on forever: Wherein I Bitch About Wayland And Modern Life In General.

So, last time, I finally bit the bullet and moved my travelling Yoga laptop to Wayland. This time around, I’m trying to get one more piece of the puzzle to work: The onscreen keyboard.

But first of all, I should perhaps explain my use case, because otherwise this will all seem incomprehensible. I mean, even more.

When I’m travelling, I bring a Lenovo Yoga laptop with me, because it’s so handy to watch movies on (in hotels and on planes etc). I guess most people solve this by bringing a tablet of some kind, but I’ve never found anything as convenient as just using one of these laptops. (Your mileage will vary.) Since the physical keyboard isn’t available in the “tent” position like up in the picture there, I’ve implemented a simple touch interface for Emacs (based on libevdev). Which means that I can just touch virtual squares on the screen to do various stuff:

Here’s the same view, but with labels on the squares to remind me where the various functions are.

Similarly, then actually playing the movie (with mpv), I have a whole bunch of convenient functions available by touching various squares…

… here with the grid shown with labels.

And all this works fine in Wayland, too, since it doesn’t really talk to Wayland stuff at all — it just pokes around in the Linux evdev hierarchy to get the events.

So what’s the problem? The problem is that sometimes I really, really need a keyboard, like when searching for things.

Now, all desktop environments have onscreen keyboards (or as some systems call them, “virtual keyboards” or the like). And… that’s the problem!

That is, there is no One True Onscreen Keyboard — instead they’re implemented for each specific desktop system, and the result is that they’re all lacking in features.

In the Good/Bad Olden Days, if people implemented a thing, they’d make sure that it worked for Linux, Macos, Windows, FreeBSD, whatever, and they’d slowly accrue a lot of features and become pretty useful. These days, a thing like this is implemented as a plugin — we’re here seeing the Onboard keyboard for Gnome Shell. But, as is always the case with these things:

Since it’s tied to Gnome Shell and uses internalish Gnome Shell features, it needs to be updated constantly as Gnome Shell changes. (And they usually aren’t.)

But if all these desktops have onscreen keyboards, why does it matter so much which one I’m using here? Because most keyboards don’t have the feature I need, which is to be able to pop up programmatically, and Onboard has:

qdbus org.onboard.Onboard /org/onboard/Onboard/Keyboard \
org.onboard.Onboard.Keyboard.Show

Beautiful, eh? All the other keyboards I’ve explored work “automatically” — that is, you enable the concept of “onscreen keyboards”, and they pop up when you focus on an input field or the like, like the amusingly named Improved OSK keyboard.

(The name is a typical result of these plugin application ecologies:

It’s a fork of something that already has a bad name, “Improved Onscreen Keyboard” — instead of making one app that works well, we get a large number of vague variations.)

So they’re all useless for my use case, which requires that I’m able to pop up a keyboard when I hit the right square on the screen.

And besides, it “pushes” all the windows up to occupy its own region, which is annoying.

Even if an ideal onscreen keyboard does exist, that fits my requirements like Onboard did — I have no faith in that it’ll still exist and be usable next month.

So what to do? Well, I guess I’ll just… implement yet another crappy onscreen keyboard, won’t I? Won’t I just.

My first thought was to use xdotool, but that doesn’t work under Wayland, of course. People are talking about ydotool as a replacement — but it’s not. It basically just lets you send rawish events to the currently focused window, which is … pretty weird. But I mean, you can switch windows by sending the correct key sequences, but that’s incredibly brittle, and I wonder what the use case for ydotool is at all. And:

Uhm… ok…

So my solution is very specific to my problem: Since I’m using Emacs to get the events, I’m also using Emacs to dispatch the events. That is, if the user hits the q square and we’re in “emacs” mode, we let Emacs handle the q event. If we’re in “mpv” mode, Emacs parses the ~/.config/mpv/input.conf file and sees which command the key maps to, and sends that over to mpv. For instance, for m we have:

(movie-send-mpv-command '((command . ["cycle" "mute"])))

Emacs is already communicating with mpv, of course, so this is pretty easy to add.

But I’m beginning to understand why all these onscreen keyboards are so tightly bound to specific desktop systems: Because the Wayland people haven’t been interested in providing any good protocols for automation and tinkering. (Extensions to the Wayland protocol have been proposed, and finally implemented by some compositors, or course, but not Gnome. But perhaps this will work in a general way in just another decade on Wayland.)

Anyway, let’s see what this looks like now, after tinkering with this for a couple hours…

So here’s the laptop normally…

And with my onscreen keyboard. Hey, that’s not so awful…

So what about when mpv is running? Yeah, that’s fine. I mean, it’s not as if I’m going to type a lot on this — it’s just as an escape hatch when there’s something that’s not available in the normal touch grid.

And I have to find a way to make mpv ignore the touches here, because it pops up some annoying stuff on the screen (title and some controls), but that should hopefully be simple enough.

Oops — Gnome Shell died? Again? That’s the third time that has happened when mpv is closing: Something mpv is doing makes Gnome Shell die. Oh, it’s a known issue, but nobody seems to know why Gnome crashes?

Tra, la, la. Being on Wayland is like being back on X in 1993 — random things you do can take down the entire laptop.

This is surely the Year of Linux on the Laptop!

Comics Daze

Wow, I’ve gotten a lot of comics lately, and I’ve been busy with other things, so I haven’t had time to read them. So it’s time for another Day Of Doing Nothing Except Reading Comics. And for music today — albums from 1996 only. Because.

Oval: 94diskont

12:27: Warnebi by Wiebke Boldvan (Fieldmouse Press)

This is excellent — it’s a pretty quiet book without much drama, and it feels very true and accurate.

And it’s never obvious where it’s going, so it’s pretty exciting. Nine thumbs up.

(The translation is sometimes a bit clumsy, though.)

12:43: Voyage d’hiver by Anne Brouillard (& esperluète éditions)

This is one of those er “accordion books”? Or whatever they are called.

I.e., it’s one long painting, really, but it’s kinda sorta slightly narrative, I think: We start with these people getting on a train…

… and then I think the rest might be what they’re viewing from the train? And it ends with them arriving at a new train station.

Lovely artwork and a fun concept. And the indicia says “quatrième edition”, so it’s a big hit.

12:53: Poor Helpless Comics! by Ed Subitzky (New York Review Comics)

This looks very cool… Design by Mark Newgarden.

It’s got interviews and stuff.

Oh, wow — these are very intricate (but amusing) works. Hm… OK, I think I’m gonna bounce — this looks like something I’d rather read some late night while drinking tea, so I’m shifting it over to the magazine holder next to my reading chair. But here on my comics couch, I’m instead continuing with:

Spring Heel Jack: 68 Million Shades

13:02: Girl Juice by Benji Nate (Drawn & Quarterly)

Oops, I’ve already read this.

13:06: Holy Fools & Funny Gods by Izar Lunaček (Uncivilized Books)

I buy everything that Uncivilized release by reflex, but this doesn’t really look like my kind of thing? I mean, it’s about religion?

So this is a comics version of a scientifictic (that’s a word) book Lunaček has published.

But the language here is often very awkward. “Those that see laughter as deriding the funny”? Uhm? Lunaček is Slovenian, but there is no translator listed, so perhaps he wrote this in English himself? There’s a guy credited with “language check” and a “translation editor”…

And… I’m sure this there are people that will find this interesting, but I read about a third and then ditched it. Sorry!

13:43: Galago #162 edited by Anders Annikas (Galago)

Sweden’s oldest running comics anthology has gone to a quarterly schedule (bad news) but has doubled its size (good news), so let’s have a look at the latest new-format issue.

As usual, there’s a theme for the anthology, and this time around it’s “music”.

So in addition to the comics, we also get a few articles, like this one about album covers done by comics artists.

But it’s mostly comics.

Heh heh.

It’s a solid anthology — varied in style, but somewhat unified by the theme.

Morcheeba: Who Can You Trust?

Hm, perhaps 1996 wasn’t the best year for music…

14:12: Mini Kuš (Kuš)

Five more minis I bought from here.

Tiina Lehikoinen does a very unsettling thing about a boy with a horse head.

Emelie Östergren’s book is very ambiguous.

Michael Jordan goes on a strange odyssey.

Anna Vaivare’s book is lovely and affecting.

Jyrki Heikkinen’s book is strangely unnerving (and looks great).

Five great little books!

DJ Krush: Only the Strong Survive

14:25: Return to Eden by Paco Roca (Fantagraphics)

This starts off with 20-ish black pages. Very portentous!

As usual with Roca, this book looks like it’s excavating more of his family’s history.

This is mostly about Antonia, which I’m guessing is either Roca’s aunt or mother? Probably mother, I’m thinking.

The bits about the family are interesting and sometimes gripping, but when Roca goes into Spain’s Fascist history, the book sort of collapses, I think? And this is something I’d be interested in, but the tone here is just… off.

And, yes, it must be about Roca’s mother, because we’re told that she has a son named Paco.

Anyway, it’s a good book, really — the ending is incredibly moving.

The Black Dog: Music for Adverts (and short films)

15:28: Smoke Signal edited by Gabe Fowler (Desert Island)

Most of the recent issues of Smoke Signal have been focused on illustration more than comics, I think? Not that there’s anything wrong with that, but it’s fun to get comics in this huge format.

Here’s Kade McClements on the dangers of small press comics publishing. Hm… is this a roman à clef kind of thing? A midwestern small press publisher (financed by selling both his kidneys) that pays in copies of comics only? I’m sure that’s not a reference to anything!

All the artists here get two pages each, which in most anthologies would have meant a pretty choppy reading experience. But since these pieces are (almost all, I think?) made with this format in mind, you get bigger stories than you’d have thought (Molly Dwyer here).

It’s just an insanely good anthology (Angela Fanche here). I’m not sure whether it’s available via mail order? Doesn’t look like it… So I guess you all have to make a pilgrimage to the Desert Island shop to pick up a copy.

16:07: Tank Tankuro by Gajo Sakamoto (Presspop)

This is fancee — it’s a very serious-looking hardback that comes in a sturdy slipcase. Hm… Oh, the slipcase is by Chris Ware. Duh!

These are comics from 1934 (I guess from the cover), and I guess I can see why the publisher went with a Ware cover instead of a cover by the featured artist. And if I want to be snide (and I always do), I could also say something about how wise it is to have the book in a tight slipcase, wrapped in plastic, so that nobody can see the insides.

Thanks for that footnote, translator! I’m sure nobody knew that.

I mean, it’s not that it’s bad… it’s pretty inventive? And for 1934, it must have been quite something.

But whenever things seem to be getting interesting (is he doing anti war agitation here?)…

… we just get One More Absurd Thing.

You know what this reminds me of? Very early Tintin — for instance Tintin au pays des Soviets from 1929: Hergé hadn’t figured out how to actually tell a story (and struggled with that for most of the next decade), so he’d just add one mad-cap humour/action scene after another until he had enough pages to call it a day. I’m assuming that Gajo Sakamoto likewise turned into a big deal later? (There’s a big essay at the end of the book, but who’s got time to read stuff like that? I’ve got comics to read!)

Paul Schütze: New Maps of Hell

16:37: A Simple Truth by Kavin Sacco (SLG Graphics)

SLG? Is that a new name for Slave Labor Graphics or something? Haven’t heard about them in decades.

The storytelling in this is really abrupt — it’s about a couple that miscarriages and then adopts a child.

But it’s hard to know how to read this book — the start of it is so filled with dread and random bad things that happen that I thought it was going to be one of those books where one gruesome thing after another was going to continue to happen, and I was waiting for the other shoe to fall when things start going better. And then it doesn’t — it’s instead… er… autobio? I mean, the dedication seems to point to it being autobio, but I don’t think it can be?

Anyway, it’s confusing on several levels.

16:56: Masters of the Nefarious by Pierre la Police (New York Review Comics)

Wow, this book is wonderful — it’s the funniest thing I’ve read in yonks. It’s like Tales Designed to Thrizzle by Michael Kupperman — it’s totally absurd.

Here’s the plot:

See? Best plot ever. And the wonderful thing about this book is that everything really kinda ties together — it’s not just one absurd thing after another, but a book that feels like a proper epic (even if it’s too short).

And he does while doing one laugh out loud silly thing after another.

A wonderful book.

Bundy K. Brown, Doug Scharin, James Warden: Directions In Music

17:18: The N* Word of God by Mark Doox (Fantagraphics)

Hey! This isn’t comics! *shakes fist in the general direction of Fantagraphics* And the artwork is, like, Photoshop collages with some additional drawing? It’s not really my thing — it’s kinda Juxtapoz-ish.

So what we’re getting here is a sort of alternate take on creation myths from the Bible and stuff, which, again, isn’t my thing at all.

But it’s pretty amusing in places.

It’s a slightly lazy book, though — when we get towards the middle of the book, there’s sometimes dozens of pages of text without any illustrations whatsoever.

Beth Orton: Trailer Park

*gasp* He’s right! I never thought of that! My god! I mean, Saint Sambo!

Sarcasm aside, it’s a more entertaining book that I thought it would be when I first opened it.

18:34: Uptight #5 by Jordan Crane (Fantagraphics)

The Mystery Mail sometimes has some really mysterious books — like this ten year old issue of Uptight.

The longest thing in the book is a chapter of Keeping II, which was collected and released to great acclaim a couple years ago.

But there’s a lot more stuff in here — a mysterious short story about a woman in a hotel room.

A mysterious longer sci fi story about some space miners.

And a shorter, but still mysterious, story about a guy floating at sea.

It’s a pretty amazing issue.

18:48: Undead by Pakito Bolino (Desert Island)

Actually, I’m not sure who the creator is here…

Another collagey book…

It’s fun, but I found it pretty disturbing by how much of this is sourced from low resolution JPEGs — there’s so much artefacting going on here that I found myself looking more at the artefacts than the collages.

Manic Street Preachers: Everything Must Go

18:59: The End

OK, that was a weird selection of books, and I think I should stop reading comics now because I’m getting annoyed, and I’m expecting whatever I’m going to read next to suck, which is the wrong attitude to have.

Might also have something to do with the music — I didn’t remember 1996 as being this uninspiring musically?

The Simplest Thing In The World: Modifing Keymaps in Wayland

To remap the PrtSc key to the Hyper modifier key under Wayland with Gnome Shell on Ubuntu/Debian on the 28th of April 2024 (around noon) with a us keyboard mapping (I’m hedging my bets here), put the following in the ~/.config/xkb/symbol/us file:

partial alphanumeric_keys modifier_keys
xkb_symbols "hyper" {
    name[Group1]= "Hyper (US)";
    include "us(basic)"
    key <PRSC> { [ Hyper_L ] };
    modifier_map Mod3 { <PRSC> };
};

And then log out and back in again.

That’s it. That’s definitely all I had to say. Or perhaps…

Yes, it’s bitching and moaning time again, but I feel like I’m entitled — because I’ve been struggling with this for (and I’m not exaggerating) years. That is, I’ve taken stabs at making this work going back at least a decade. In total, I’ve probably spent more than a dozen hours pulling my hair and swearing at the computer. So:

In the Olden Days Of Yore, the first thing that happened when you used a computer for the first time was getting really annoyed with the keyboard because nothing was ever exactly like you wanted. (Especially with the national varieties of different keyboards from different companies — the horror!) I remember back at the university in the 90s, people had all kinds of fancy and amusing layouts, making it impossible for anybody to use anybody elses keyboards — keyboard encryption as a security feature, eh? And these shenanigans were possible because it was trivial to modify keyboard definitions. If you wanted to have a Hyper key on PrtSc (if that key did indeed exist back then; probably not on most keyboards), you put this in ~/.Xmodmap and went on with your life:

keycode 107 = Hyper_L
add Mod3 = Hyper_L

This still works to this day, three decades later — sort of. Any changes to the HID device hierarchy these days and the OS is likely to blank the setting and then you have to xmodmap it “manually”. And this only works if you’re still running X, of course, which is getting to be more and more difficult.

I got a new Lenovo Yoga X1 Gen 8, which is a nice laptop — I like a Yoga while travelling, because you can flip it around and watch movies on it without having the keyboard in front of you.

See? It’s nice.

And it has a built-in WWAN/5G modem, so I can use the laptop when there’s no WIFI and without tethering and stuff.

But the modem didn’t work in Debian/stable, so I installed Ubuntu. The modem works fine there, but:

I opened the Settings app, and there were all these horizontal stripes and glitches and stuff? I mean… what? This is a totally normal laptop with built-in normal Intel graphics:

00:02.0 VGA compatible controller: Intel Corporation Raptor Lake-P [Iris Xe Graphics] (rev 04)

And still, just opening the Settings apps displays oodles of glitches in the default configuration? So they’ve obviously stopped even testing in Xorg — everything is moving to Wayland anyway, right?

And then I tried watching a video with mpv! My god!

Googling showed a lot of people having problems in this area, and the solutions were along the lines of:

i915.enable_dc=0
intel_idle.max_cstate=2

And other boot parameters, none of which had any effect for me. So after trying that for a few hours, the writing’s on the wall, even if I’ve resisted for years: I have to switch to Wayland before I get so old that there’s no chance of me ever figuring out any computer stuff ever again: I have to finally make The Configuration For The Future.

So how do you do something as trivial as assigning Hyper_L to the PrtSc key? As the keyboard(5) man page says:

The specification of the keyboard layout in the keyboard file is based on the XKB options XkbModel, XkbLayout, XkbVariant and XkbOptions. Un- fortunately, there is little documentation how to use them.

The keyboard definition in an Ubuntu/Debian machine is in /etc/default/keyboard:

cat /etc/default/keyboard
# KEYBOARD CONFIGURATION FILE

# Consult the keyboard(5) manual page.

XKBMODEL="pc105"
XKBLAYOUT="us"
XKBVARIANT=""
XKBOPTIONS=""

BACKSPACE="guess"

OK. And Wayland is using the xkb stuff? Confusing, but OK. So I google how to redefine things in this system, and… there’s a million people as confused as I am. Because surely things can’t be as bad as this, fifteen years on since Wayland was created?

The story told on a thousand web sites is that to alter the keyboard layout, you “just” alter the layout definition file, which is in /usr/share/X11/xkb/symbols. (In my case, it’s /usr/share/X11/xkb/symbols/us, since I’m using a US layout.) But this is absurd! That’s a file that’s updated when the OS updates, so either your changes will be overwritten, or updating won’t touch the file at all, so you won’t get updates from the OS. (Which can be important — keyboards rarely change, but they do evolve slowly over time, and you want a solution you can use for decades, right?)

There’s official-looking pages like this that tries to tell you how to add new layout files:

OK, ignoring the empty “writing a symbol file” entry, they suggest creating a new file /usr/share/X11/xkb/symbols/test, which is nice, because it won’t be overwritten by the OS… but then you have to register that file in two other files, /usr/share/X11/xkb/rules/xorg.lst and /usr/share/X11/xkb/rules/xorg.xml, which will be overwritten by the OS! This shit is infuriating!

But I did take a stab at it — created the new file and changed /etc/default/keyboard to point to it… and it had absolutely no effect in Gnome Shell, because it doesn’t really rely on it? Only slightly? (Did I mention that none of this is really documented well?)

xkb has specific options for swapping around certain modifiers:

setxkbmap -option caps:hyper

So you can presumably put that into XKBOPTIONS in /etc/default/keyboard if you wanted to map Caps Lock to Hyper… but these options only exist for certain combinations of keys! How insane is that? I mean, it’s nice that the XKB developers thought it would be handy to swap certain keys around, but it’s absurd that they thought they could enumerate them all? Instead of making a handy general utility that allowed people to do whatever they wanted, they hard-coded a few possibilities and called it a day.

But some suggest you do something like this:

cd /usr/share/X11/xkb/symbols
mv us us-real
cp hyper us

And then you have

/usr/share/X11/xkb/symbols

be just:

xkb_symbols "basic" {
    name[Group1]= "Hyper (US)";
    include "us-real"
    key <PRSC> { [ Hyper_L ] };
    modifier_map Mod3 { <PRSC> };
};

And this works, and it has the advantage of you being able to actually make sense of whatever changes you’ve made to the layout. But still, it has the problem of not being updated when the OS updates (or conversely, being overwritten). (And in any case, keeping personal configuration under /usr is a horrible long term solution, anyway — you want your config to follow you around as you upgrade laptops, and that ideally means just copying your home directory.)

So many people are trying to make sense of this system — like this guy, who has been through my entire journey, and amusingly enough, he’s also trying to rebind PrtSc to Hyper!

This sounds excellent! Just what I need! This should be the official documentation for when you google “how do I rebind a key”, right? Except that it doesn’t work — at least not under Gnome Shell (the default in Ubuntu), which just seems to ignore the XKB_DEFAULT_LAYOUT variable. I’m guessing the “before starting my compositor” means that he runs Sway or something…

*sigh*

And one more deeply infuriating thing about this whole mess: Whenever you’re testing something, you can never know whether logging out and then in again, or a full reboot is necessary, because it’s never clear whether the changes are applied on login, or by the OS (probably in systemd somewhere nasty) when booting up. What used to be a priority in Unix — being able to try things out iteratively and interactively (with informative error messages when you screw something up) has been replaced by mysterious systems that nobody can tell exactly how interact. So while Wayland uses the XKB files, you can’t use setxkbmap to try out the changes you’re making.

(Instead, if you make a syntax error and log out/in again, the OS will just display the White Screen of Death saying that something’s wrong (but not what, of course.). ssh to the rescue.)

And people are desperately trying to make things work:

I didn’t find any well-working solutions in 2024, so I’ve made one. Search for the “Shyriiwook” extension in the GNOME Shell Extensions store.

I applaud their efforts, but surely this shouldn’t have to be necessary!

But there are other ways to remap key in Linux, surely? OK, let’s take a look at a guide. It lists four different applications that work under Wayland: keyd, kbct, kmonad and interception. These keyboard remapper things all rely on daemons that talk to the evdev layer in the Linux kernel, and should work no matter whether you use Wayland or X.

keyd looks nice, and is available on Ubuntu by default. But:

It doesn’t support a Hyper key.

kbct, kmonad and interception aren’t in Ubuntu, and I didn’t test them, because most guides on the Googles seem to suggest that the generically named input-remapper (which was previously called key-remapper) is the bee’s knees. And it’s in Ubuntu! But when I started it, it didn’t look anything like what people were talking about, and doesn’t match the documentation. Were there several of these?

No, it just turns out that there’s a new version out, and it looks totally different, and has a different configuration hierarchy:

Thanks, thanks. So I downloaded that from Github, managed to get it installed and the daemon running, and

# input-remapper-control --symbol-names | grep -i hyper
#

It doesn’t support remapping a key to Hyper.

*sigh*

This excellent page is what finally pointed me in the right direction. The recipe given there doesn’t work for me, and as he says:

Now, I fully agree that this is cumbersome, clunky and feels outdated.

But after testing a number of variations on this theme, I ended up with the solution I posted above. Which works. Today.

Who knows what these Gnome/Wayland people will come up with tomorrow. It would be nice if it were something that, you know, works, but I’m not really holding my breath.

So now that the first hurdle is out of the way, I just have to fix all the other things that don’t quite work under Wayland. I mean, it’s only fifteen years old; one can’t expect everything to work yet…