I'm still daily driving postmarketOS

It only takes one person to make a difference.

This is part 2 of my series about daily driving Linux Mobile, check out part 1 here.

It’s easy to complain and grumble, and to let yourself be genuinely upset with the state of things, as readers of part 1 will know. But you might be surprised to hear that it’s also really easy to get involved in fixing them!

Sure, some issues are quite tricky, but there is soo much low hanging fruit going around for those with some time to spare.

I want to thank Guido for still managing to engage in some productive discussion about part one of this series, and even going as far as prototyping a patch to improve gestures in Phoc.

Guido is pretty much the only person working on Phosh, Phoc, and other core components of the GTK based mobile UI stack. I dunno about you but I feel like there ought to be more regular contributions to literally the most popular UI for #LinuxMobile devices…


phosh-osk-stub is Guido’s take on a mobile keyboard, it has some nice features like an emoji picker, text completion, and the ability to control the cursor by sliding along the spacebar key. That last feature is also in Android and it’s definitely something I take for grants, so having it here is really nice. However unlike on Android, it’s also possible to move the cursor up and down.

The cursor drag gesture callback looks like this:

note that the coordinate space here is fractional because it’s been divided by the scale factor already. So the X coordinate 457 on the display would be represented as 152.33333333333334 with a scale factor of 3 for example.

static void
on_drag_update (PosOskWidget *self,
                double        off_x,
                double        off_y)

To my great surprise, the coordinates here have NO fractional component. What?!

Well, I’ll leave it up to the GTK developers to figure this out, but I suspect that because the GtkWidget in question uses integer coordinates, the associated GdkDevice does too, and somehow the fractional part goes missing in a cast somewhere.

Sooo what can we do? Well, hacks of course!

Poking around

I first tried fetching the GdkDevice from the gesture and retreiving the pointer coordinates from there, but it also lacked the fractional component. So I went one step further, we can instead retrieve the GdkEvent object that triggered our callback, fetch the coordinates directly from it, and then you get the fractional part back!

We have to do this in a bit of a roundabout way, it looks like this (adjusted for brevity):

static void
_on_drag_get_position (PosOskWidget *self,
                       double       *pos_x,
                       double       *pos_y)
  const GdkEvent *event;
  GdkEventSequence *seq;

  /* Fetch the last event sequence, it contains our event */
  seq = gtk_gesture_get_last_updated_sequence(self->cursor_drag);
  /* Now get the event */
  event = gtk_gesture_get_last_event(self->cursor_drag, seq);

  /* These coords have the fractional part intact! */
  gdk_event_get_coords(event, pos_x, pos_y);

Woo! Mission accomplished. Somehow, I did something I wanted to in GTK :P

You can check out the full MR here, and judge my codestyle ;)

Locking the cursor direction

This one is certainly within the realm of subjective taste, but I find myself quite often moving the cursor up or down by mistake when trying to edit a message. As I almost never use the vertical drag feature (only in the terminal to be honest), so the change is simple: if you start dragging horizontally, you can no longer drag vertically, and vice versa.

It would be great to implement some timer so that if you stop moving for a few hundred milliseconds then it becomes possible to switch direction, however this might be somewhat confusing UX. It might be easier to just shorten the amount of time you have to hold to spacebar to enter drag mode.

Here’s my very fancy MR implementing this change.


We live in a society that normalises crushing our creativity and free will, where we spend a good portion of our lives working for somebody else. And where the devices we use every day are full of annoying UX issues.

But we can do better.

I can plug my phone into my PC, connect to it over SSH, clone the source code for my keyboard and hack on it all just like that. If you’ve ever tried compiling Android from source you’ll know that being able to modify components like this is not something that one can take for granted.

But here we can, and we should.

postmarketOS is built to be tinkered with, and next time you run into a stupid UX issue you should absolutely have a go at fixing it. Even if you don’t succeed, you’ll surely learn something useful. You could open an issue with a more detailed analysis of the bug, improve the postmarketOS wiki by documenting your development process, or even just talk about what you tried in a relevant Matrix room.

Together we can get a lot done, even if we as individuals don’t have a lot of time to throw at these things.