Determine if on PC, TV, tablet, mobile phone, or even car display?


I have been playing with Gnome Mobile on PostMarketOS on my PinePhone. Been thinking about writing an application. I was just wondering if there is a way to programmically figure out what device you are on, as the UI will need to work differently depending on if there is a mouse/keyboard, touch screen, or a remote.


You want to check the chassis type reported by hostnamed. Example:

$ gdbus call --system --dest org.freedesktop.hostname1 --object-path /org/freedesktop/hostname1 --method org.freedesktop.DBus.Properties.Get org.freedesktop.hostname1 Chassis

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.