A headless setup is when your Raspberry Pi is turned on without a monitor.
The display is not needed usually, especially if your access is only via SSH. The issue would be if you connect via VNC Viewer, the display will look like this.
The icons are too big but the screen is too small.
What’s happening here is that Raspberry Pi will use a very small screen resolution when it is not connected to a monitor. So when you connect via VNC Viewer, VNC will get the same small screen resolution.
To solve this, we need to change the default headless screen resolution of the Raspberry Pi. You can follow the instructions below to set this.
Changing the default screen resolution of a headless Raspberry Pi
Changing the Raspberry Pi Headless Resolution via Terminal
Open the terminal or SSH into the Raspberry Pi.
Then open raspi-config by running the command below.
Move the selector by pressing up, down, left, right keys in your keyboard.
Go to Display Options then press Enter.
Go to VNC Resolution then press Enter.
Then select the resolution that you want to have, then press Enter.
It will then confirm that the resolution is set to your desired resolution.
It will then go back to the main menu of
raspi-config. Select Finish, then press Enter.
It will then ask if you want to reboot now, select Yes and press Enter.
Once the Raspberry Pi finishes rebooting, you will now be able to use VNC with your desired screen resolution even if the Raspberry Pi is not connected to a monitor.
Changing the Headless Resolution via Raspberry Pi Configuration
Click on the Applications Menu (Raspberry Pi icon on the upper-right corner), then hover over Preferences then click Raspberry Pi Configuration.
Click on the Display tab.
Click the dropdown of Headless Resolution, and select your desired screen resolution for Raspberry Pi to use when there is no monitor attached.
Then click OK.
The system will ask you if you want to reboot the Raspberry Pi. Click Yes to reboot and for changes to take effect.
Once the Raspberry Pi has finished rebooting, when you VNC to the headless Raspberry Pi it will have your target resolution.
We hope that this helps you change the default resolution of your headless Raspberry Pi when connecting via VNC Viewer.