Easy Librem 5 App Development: Scale the Screen


#1

Hey everyone. I figured some people in the forum might find my latest post interesting, not just from the point of view of how easy it can be to develop simple Librem 5 applications, but also because the application I wrote lets you scale the Librem 5 screen from the default 2x all the way down to native physical resolution.

By scaling to a different size I was able to make normal desktop applications that ran but just didn’t fit on the screen work. Wireshark is the example I use in the article but there are a number of apps that will benefit from this until the upstream developer can get around to making the UI adaptive.


Web pages small screens
#2

Very cool. Just to clarify: this changes screen setting for everything, not just one target program/window - which I imagine isn’t possible to accomplish at the moment (with this at least?). Looking at the git code of wlr-randr, it seems, it can be used to rotate screen too…

Code options to play with
	"usage: wlr-randr [options…]\n"
	"--help\n"
	"--output <name>\n"
	"  --on\n"
	"  --off\n"
	"  --mode|--custom-mode <width>x<height>[@<refresh>Hz]\n"
	"  --pos <x>,<y>\n"
	"  --transform normal|90|180|270|flipped|flipped-90|flipped-180|flipped-270\n"
	"  --scale <factor>\n";

#3

Correct, this changes the whole “desktop” (we should probably rename that to something else).


#4

it’s so good that you guys had the time to spread a few Librem 5 around before the quarantine in China-Wuhan … the rest of us will have to suck it up some more for dogwood and evergreen > https://puri.sm/posts/coronavirus-delays/


#5

Phonetop ?


#6

Given that “desktop” is itself a metaphor - people tend to forget that there was a time when there were actual desks with tops and pieces of paper and pens and other stationery and office items :slight_smile: - perhaps it is OK to continue using “desktop”.

In any case, if and when we have convergence then the Librem 5 kind of replaces your existing desktop / laptop, so again “desktop” could be OK.


#7

We’ll probably never get rid of desktop, but how about the less used “workspace”?
For some reason, I have the urge to find a desktop wallpaper of a desktop. Maybe someday we’ll have a retro theme for L5 that actually makes the “phonetop” look like a desktop of yester-years - files, dossier folders and (floppy)disc and filecabinet icons :wink:

For development: there was ablog post about screen illumination levels - how a bout adding these scaling and rotation controls available there too as a permanent feature. Would be easier to find all screen related stuff there in one place, even if someone prefers also to use this separate app…


#8

Desktop, workspace… The first GUI “desktop” I used was GEOS on my C=64. It took the desktop metaphor very literally. Later, the OS/2 Workplace Shell. Phosh Desktop works for me!


#9

Workspace works fine.
Since palmtop is not really an option, I’d go with. … phone shell. Or phosh :wink:


#10

There has been some work on the team to do one better and automatically detect when an application is trying to use more space than would fit on the screen and scale accordingly. We have a proof-of-concept that’s not yet merged:


#11

imo it should be named

m-phosh and c-phosh (m from mobile and c from convergent)

desktop could stand to pass … MAYBE; but workstation is much more difficult to get rid of …


#12

How does the scaling work?
Is it like scaling a raster or vector image, or something completely different?


#13

My guess would be that the window manager does little to scale the image, but the scaling options simply overrides the DPI exposed to applications so they think the screen is larger than it actually is. Will probably work great for applications built on modern toolkits like GTK and Qt but probably won’t work at all for other applications like games would be my guess.


#14

I don’t understand enough about Wayland to know exactly how it achieves it, however from the application standpoint by default it is presented a resolution that is 1/2 of the actual resolution the phone supports (aka 2x scaling). You can scale it all the way up to 1x scaling, which presents the application with the full 720x1440 resolution.

https://developer.puri.sm/Librem5/Apps/Guides/Design/Constraints.html#constraints

The Librem 5 will have a 720×1440 5.7” screen. Given the resolution, it is going to use a scale of 2, leaving us with 360×720 points in portrait mode and 720×360 points in landscape mode.


#15

Scaling the screen is a very useful application that can prove useful on many occasions: why not install it by default on the Librem5?
Maybe like others, for example a script to add flatpak or the other, by Kyle, on the backup, they are useful applications that could already be found on the mobile phone.
Regards


#16

We are looking to add a feature that would do this automatically so you wouldn’t need the app at all. We are looking into packaging all of my scripts though for people who may want them but don’t want to go to the trouble of getting them from git.


#17

Nice to see a good idea going from concept to benefit everyone. From the new blog post and video it seems that something is already there. Also nice. Makes me all warm and fuzzy inside to see everything coming along (unless it’s something else :face_with_hand_over_mouth:). [edit to add: also kudos for informative graphics, as now there’s visual and data that things are developing for the better]

One thing: I know some USB-peripherials (the USB-port) that I’d like to use on top of the phone - would it be possible to switch the screen 180/upside down somehow (now there seems to be only the 90/side option)?