Custom sandbox resolution

Moderators: kirk, jamesbond, p310don, JakeSFR, step, Forum moderators

Post Reply
je55eah
Posts: 183
Joined: Mon Jul 26, 2021 5:27 pm
Has thanked: 30 times
Been thanked: 5 times

Custom sandbox resolution

Post by je55eah »

After examining the code in the sandbox script I discovered that we can declare custome screen resolutions for xephyr.

This worke out pretty good for me.

Code: Select all

export WINDOW_SIZE=1280x740
rw-sandbox-lxc.sh /mnt/sda1/savefile.img

After the system loads it is necessary to use zarfy or something to select that resolution, but the result nearly fills my screen, which is preferable to 1024x600 which was the default and the only option otherwise provided that fit within my screen.

There is probably a script which is executed by the init system and could thus be used to set the WINDOW_SIZE variable at boot.
A thought about the naming of the variable is that it might be better to call it SANDBOX_WINDOW_SIZE and leave WINDOW_SIZE available for scripts that relate to the host system. If I was getting into this deeper I might try to build the variable automatically by reading the window size and subtracting the height of the taskbar from it.

je55eah
Posts: 183
Joined: Mon Jul 26, 2021 5:27 pm
Has thanked: 30 times
Been thanked: 5 times

Re: Custom sandbox resolution

Post by je55eah »

Why doesn't this work if I run two sandboxes at the same time?

jamesbond
Posts: 718
Joined: Tue Aug 11, 2020 3:02 pm
Location: The Pale Blue Dot
Has thanked: 124 times
Been thanked: 402 times

Re: Custom sandbox resolution

Post by jamesbond »

Most likely because both sandboxes gets identical IP address. Unless you explicitly set the LXC_IP environment variable, the IP address inside the sandbox is randomly generated. It is not impossible for the two sandboxes to get the same IP address this way.

To make sure you get a different IP addresses for different sandboxes, specify a different LXC_IP for each sandbox.
If you use "nat", you can specify any IP address you want.
If you use "proxyarp", the first three octets of your LXC must be identical to your host IP.

je55eah
Posts: 183
Joined: Mon Jul 26, 2021 5:27 pm
Has thanked: 30 times
Been thanked: 5 times

Re: Custom sandbox resolution

Post by je55eah »

Thanks. That's handy, but I'm noticing that it should only conflict 1/255 of the time or so. I suspect it may be something else because I tried it a bunch of times before I found a workaround that I am about to share. To be more specific, the custom resolution doesn't appear when I open a second sandbox while the first is running. I did find out that if I poweroff the first then start the second it does get the custom resolution. Afterwards I can start them both simultaneously and they both get the custom resolution.

One oddity remains. As mentioned earlier, the resolution solution doesn't stick, so I must open the control panel every time I boot the sandbox to pick it. That's still true on one sandbox, but on one of my sandboxes it does remember and it boots right to the desired resolution. It would be great if they all did that.

je55eah
Posts: 183
Joined: Mon Jul 26, 2021 5:27 pm
Has thanked: 30 times
Been thanked: 5 times

Re: Custom sandbox resolution

Post by je55eah »

followup:

I tested it with a declared ip of 10.0.0.1 but the second sandbox, which requires me to set the resolution after loading does not list the custom resolution if it is opened while the first sandbox is running. The IP had no impact.

I can open the second sanbox with a custom resolution first, then set the resolution, then open the first sandbox which remembers the resolution with a custom resolution second to get two sandboxes running with a custom resolution.

Post Reply

Return to “FatDog”