Is there any amd64-capable VM ISO for testing mobile GNOME apps, which will pretend that it has touchscreen instead of keyboard + mouse?
Purism does offer some qemu images for their mobile is:
https://developer.puri.sm/Librem5/Development_Environment/Boards/qemu.html#linux-environments
Additionally, Postmarket OS offers the option to run on qemu:
https://wiki.postmarketos.org/wiki/Category:QEMU
However, I dont know of a solution regarding emulating touchscreen on mouse and keyboard though. Because properly emulating it would require some thought. I mean, emulating single-touch is easy, bit what about multi-touch, pan gestures, etc…?
What youre looking for here is a software which emulates a touchscreen input device, using libinput or similar.
In my case, as ‘emulate’ I mean that Gdk.Seat.get_capabilities()
will return Gdk.SeatCapabilities.TOUCH
capability. I need to know if app is launched on mobile platform.
Thanks for the answer anyway!
FWIW this is not a reliable way to test if the app is launched on a mobile platform. A notebook with a touchscreen or a kiosk display might also have the touch capability.
Maybe a better way to detect, is to receive the width/height of the application?
But user can resize the application to ‘mobile’ size on desktop either, so this isn’t a reliable way to detect mobile platform
Hmm, what are you actually trying to solve? (sounds a bit like https://xyproblem.info/)
for seat in Gdk.Display.get_default().list_seats():
if seat.get_capabilities() & Gdk.SeatCapabilities.TOUCH:
long_gesture_controller = Gtk.GestureLongPress.new()
self.add_controller(long_gesture_controller)
long_gesture_controller.connect("pressed", self.toggle_buttons)
else:
event_controller_motion = Gtk.EventControllerMotion.new()
self.add_controller(event_controller_motion)
event_controller_motion.connect("enter", self.toggle_buttons)
event_controller_motion.connect("leave", self.toggle_buttons)
break
...
def toggle_buttons(self, *_args) -> None:
"""Sets if buttons should be visible or not"""
self.buttons_revealer.set_reveal_child(
not self.buttons_revealer.get_reveal_child()
)
Actually, I’m trying to make an algorithm for showing buttons only if the user hovers the widget. But on mobile, you cannot hover the widget with the cursor, you only have a finger. So I decided to set up different ways for mobile and desktop to show these buttons (hover for desktop and long press for mobile)
P.S. And since I don’t have a Linux mobile device, I need to know a way to test this solution.
Well, after doing a quick search, I have seen that there is at least one project that seems to emulate a touchscreen. However, it seems to be a custom kernel module and also probably not maintained, so I’m not posting the link here.
You could also check if libinput
allows for device emulation.
Or you can ask the community for help. There are some people here with touchscreen devices, and if you provide a dev Flatpak, they could try it for you, if you can provide clear instruction on what needs to be verified.
I do provide Flatpak dev build. Should I ask people to test my app on mobile here on Discourse or maybe on Flatpak Matrix room?
I’d say here on discourse is fine.
Be sure to provide clear instruction on what needs to be verified though, so that testers don’t need to guess.
Okay, got you. Thanks a lot!