Fix opening locked app from Termux on MIUI

Termux has the handy termux-open command, which is aliased as xdg-open. I use it to open markdown notes from Termux on Markor (a markdown editor application), by simply running xdg-open

This stopped working when I set Markor to use MIUI’s “app lock” feature, which forces you to authenticate before opening selected apps. Termux would open Markor normally and the “app lock” screen would ask for my credentials. However, after logging in correctly, I would be brought back to Termux. Manually opening Markor wouldn’t show the file I opened.

I did some tests and the issue didn’t seem to be on Markor’s end. So I went to check on MIUI’s side.

MIUI has additional permissions, besides the ones you find on AOSP. In my experience, they often are the cause for that type of weird behaviour, when you ask an app for something and at some point they completely ignore the request. I’m thinking, for example, about some KeePassDX features, which require you to fix those MIUI permissions to work properly.

I checked that Termux had three MIUI permissions in red:

  • Show on lock screen
  • Display pop-up windows while running in the background
  • Display pop-up window

I authorized all three. Now I’m not sure which one exactly did the trick, but this solved the problem.

So if you use MIUI and happens to have the same situation, long press Termux icon, tap “app info”, “permissions”, and then toggle some or all of those red permissions.

Relevant versions

  • MIUI 12.0.3

See all posts