KDE input problems (KDE applications don’t accept input)

On KDE 5.28.0, which is currently the version of KDE included in Debian Stretch, you may run into the following problem: if you run IBus (to work with an IME like Mozc or Anthy to type Japanese), you might find that you sometimes lose the ability to input text in KDE/Qt applications (like konsole, or the run bar (krunner) when you press Alt+F2). It looks like you can fix this by running:

ibus-daemon -r -x -d

Since you can still type stuff in applications that don’t use Qt, such as Firefox, typing the above command into a text area in Firefox, copying and pasting (right click, paste) that text into krunner, then using your mouse to select “Command line: ibus-daemon -r -x -d”, you should be able to get input to work again. If you do not have any non-Qt applications, you could switch to the console and instead do:

DISPLAY=:0 ibus-daemon -r -x d

However, you may need a second hack to get Japanese input to work again: open xterm (not konsole) and activate your Japanese IME (which should work just fine). This seems to cause Japanese input to work again system-wide.

英語で書いてもあまり役に立たないでしょうから、日本語バージョンも合わせて書きます。

Debian Stretch に入っている KDE 5.28.0 に、(IBus が稼働している環境では)KDE/Qt 系のアプリケーションに、時々、何も入力できなくなる不具合があるようです。IBus のデーモンを再起動すると直るので、以下のコマンドを実行してみてください。

ibus-daemon -r -x -d

キーボードが使えないのに、コマンドを実行するのにはどうすればいいですかというと、Qt を使用しているアプリケーション以外の入力はできるはずなので、例えば Firefox のテキストボックスにコマンドを入力、コピーして、Alt+F2 で開ける実行メニュー (krunner) を開いて、コマンドを右クリックで貼り付けて、マウスで実行するように選択すれば、キーボードをほとんど使わずに実行できます。(ショートカットキーは使えるはずです。)
うまくいかない場合は、コンソールで以下のコマンドを実行すればいけると思います。

DISPLAY=:0 ibus-daemon -r -x -d

ただし、これだけでは日本語入力が直らない(場合があります?)。直らない場合は、xterm (konsole などではなく、xterm)を開いて、一回日本語入力に切り替えて、使えるかどうか試してみてください。(使えるはずです。)
これをやるだけで、他のアプリの日本語入力も直るようです。

The Boring Game

I wrote a game! In 2.5 hours, even. It’s a console (as in Linux terminal) game, and written in Perl (5). I’ll call it “The Boring Game”.

You’re the pilot of a sophisticated airplane that does not crash into mountains, but bores tunnels through them. Flying costs money (because you use up fuel). Operating the boring machine attached to your airplane is extremely energy-intensive, and costs a fortune. Boring horizontally is expensive, but wait till you see how much you have to pay to bore up. However, (completed) tunnels are very useful infrastructure, so you get a nice reward every time you make it through the mountain.

The game’s settings are global constants at the top of the source file:

my $USLEEP = 80000;
my @STATE_CHANGE_PROBABILITY = (0.1, 0.4, 0.1);
my $MAX_ALTITUDE = 120; # (1 == one column). Need a few more columns to display the current funds
my $MOUNTAIN_CHAR = '.';
my $MOUNTAIN_OUTLINE_CHAR = '|';
my $PLAYER_CHAR = '@';
my $UP_CMD = 'k';
my $DOWN_CMD = 'j';
my $QUIT_CMD = 'q';

Here’s a YouTube video of the game in action:

You can get the source code at https://github.com/qiqitori/theboringgame.
To play the game, put boring_game.pl in any directory you want, and issue the following command:

perl boring_game.pl

Beach Cleaning in Matsue, Japan

Ocean trash
Ocean trash

Now that I’m living in Matsue, I often find myself not having much to do. Which means I’m usually sitting at my computer or sitting on my bicycle. One of my first destinations was the sea, which is about 10 km north from where I live.

The spot marked “須々海海岸” on Google Maps is overwhelmingly beautiful and saddening at the same time. While the pictures shared on Google Maps may show you that this is indeed a very beautiful spot, most of these pictures do not show that there is a lot of plastic trash on the beach.

So not having much to do, being somewhat young (28 back then) and being reasonably environmentally minded, I one day decided to see if I could maybe help clean this place up. Unfortunately, my Google queries for beach cleanup activities in Matsue didn’t yield any results, so I just decided to buy a pair of (gardening) gloves and a pack of large trash bags and get some cleaning done.

It turned out to be a great way to pass the time (in late spring, when it isn’t crazy hot and mostly not raining), so I kept coming back, and decided to continue until the tsuyu (rainy season) would kick in.

Ocean garbage collection application form
Ocean garbage collection application form

Just gathering the trash is of course not quite enough. You need to get it to the waste processing facilities. So I just went to the town hall and asked the person at the entrance what to do. I was told to go to the “volunteer” department at the 松江市環境センター (Matsue Environmental Office), where I had to fill out a form (pictured) with the following information: personal information, pick-up address (no house means no address, so this is a bit hard, but the guy at the counter really knew his way around town, and showing him the place on Google StreetView helped a bit too), the number of trash bags, cleanup date, next date in case rains gets in the way. After filling out the form, I got the number of Matsue-branded trash bags that I’d put on the form, at which point I had to explain that I’d actually already started cleaning, unfortunately using regular unlabeled trash bags. That was fine, but he told me to use the right bags next time. The form allows you to tick 自己搬入 (bringing in the trash yourself), but you’d probably have to explain yourself if you want to do that. I opted to have a truck pick up the trash I’d pile up at the side of the road, which usually takes place within one week after your cleanup date.

Some collected ocean trash
Some collected ocean trash

Not knowing much about the  recycling facilities here, I generally sorted the trash by type: plastic bottles (of which there are many, many), plastic bottle labels, plastic bottle caps, styrofoam, hard plastic (probably mostly originating from buoys), soft plastic (think polyester), random other plastic. I had no intention of taking care of tree branches/logs, and was in fact told not to pick those up, as they wouldn’t fit into the plastic bags anyway.

Random thoughts

  • Japanese beaches may have a lot of ugly フナムシ (sea roaches). They will definitely crawl all over your bags, so make sure to close them properly. :p
  • This place doesn’t have a lot of people come by, but the people I did meet were quite eager to talk. Mostly older guys who have come out to do some fishing.
  • Carrying the trash bags from the beach up to the road (which is probably a 20 m altitude difference) was pretty tough, but very, um, good exercise. Combined with the 10 km (very much non-flat) ride on the bicycle… it was pretty intense. :p
  • I’ll probably re-commence my cleaning activities when it gets a bit cooler, perhaps in September. Hoping the place won’t be infested by spiders.
  • One day, I found that someone had helped during my absence \o/

KDE graphics problems (flickering windows)

On a Kaby Lake i7 (i7-7700) with embedded HD Graphics 630 on Debian Testing with KDE 5.28.0, I had a problem where the window manager (kwin_x11) would fail in the following way: everything would be fine for a few hours or a few days even, but then windows would flicker a bit, and usually much later window contents wouldn’t be updated until I focused a different window and then back, and after a while the whole screen froze and only the mouse pointer kept moving.

To fix a system that is still half responsive, open the run dialog (Alt+F2) and execute:

kwin --replace

To fix a system where no windows are updated, switch to the console and do:

DISPLAY=:0 kwin --replace

For a more permanent solution, selecting OpenGL 3.1 in System Settings > Display and Monitor > Compositor worked for me on one system.