6

I recently got a laptop with a touchscreen, and I'm running Ubuntu 19.10. The on-screen keyboard comes up when I focus a textbox with the touchscreen, and I usually don't want it to. However, this laptop (a Lenovo Yoga) can be folded back to turn into a tablet, and in those cases I do want the OSK's auto-show behavior.

I'd like to write a script to toggle the auto-show behavior on and off. The Block Caribou GNOME extension comes up a lot in these discussions, but it doesn't fit my use-case because it's not something I can turn on and off from a script (and even if I could it's a bit rube-goldbergy).

Is there some sort of command I can run to toggle the auto-show behavior? Note that I don't want a command that shows/hides the OSK, I want to enable/disable the auto-show behavior.

Jack M
  • 1,658
  • This is still a problem in 22.04. I would like no OSK when in laptop mode and OSK-on-demand in tablet mode. Currently the only options I can find are on-demand or never and don't care what mode the laptop is in. – StrongFish Aug 29 '22 at 15:08

1 Answers1

1

Well, you can look into the source code of block caribou to see how it actually blocks it and block in the same way from your script :) https://github.com/keringar/cariboublocker

I think the easiest one-line solution would be to try to disable/enable the block caribou extension from your script.

$ gnome-extensions list
$ gnome-extensions enable cariboublocker@git.keringar.xyz
$ gnome-extensions disable cariboublocker@git.keringar.xyz

edit: I actually really like your idea of running commands when switching between tablet and desktop mode and I felt someone should have implemented that already. I found https://github.com/alesguzik/linux_detect_tablet_mode that might help in running those commands.

lost
  • 44
  • Please try your solution and verify that it works :-) – sudodus Nov 10 '19 at 11:06
  • 1
    yeah that was lazy of me. Verified my solution. Thanks for bringing this up! – lost Nov 10 '19 at 11:12
  • 2
    I actually had already checked that - the way Block Caribou seems to work is by spoofing GNOME's "check if last interaction was with the touchscreen" to always report false, which means it's not really just a command that I can run once and then undo with another command. I wanted to avoid enabling/disabling the whole extension because it seemed a bit convoluted, but leave your answer up because it's still a reasonable idea. – Jack M Nov 10 '19 at 11:14