Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 6309

General discussion • Custom Resolution Issue in Raspberry Pi 4 Bookworm OS

$
0
0
I wanted to configure Raspberry Pi 4 with Bookworm 32bit Desktop OS in Kiosk Mode to display a Website such that I can VNC from iPad with Custom Resolution set at Pi end for the same.
Below are the conditions for this project:
1. Pi should be running in Kiosk Mode

Code:

cat kiosk.sh #!/bin/bashexport DISPLAY=:0xset s off xset -dpmsxset s noblanksleep 5/home/pi/script/set-resolution.sh/usr/bin/unclutter -idle 0.5 -root &/usr/bin/chromium-browser --noerrdialogs --disable-infobars --kiosk "http://www.xyz.com" &
2. Custom Resolution 2160 x 1620 needs to be setup

Code:

cat /home/pi/script/set-resolution.sh#!/bin/bash# Set display variable if needed (for kiosk mode)export DISPLAY=:0# Add custom resolutionxrandr --newmode "2160x1620_60.00"  297.66  2160 2320 2560 2960  1620 1621 1624 1676  -HSync +Vsync# Attach it to your output (e.g., HDMI-1 or HDMI-0)xrandr --addmode HDMI-1 "2160x1620_60.00"## Apply itxrandr --output HDMI-1 --mode "2160x1620_60.00"
3. Whenever no active VNC connections found Pi should logout from that website and restart Kiosk mode.
To fulfil this requirement I have created Systemd Service script as mentioned below:

Code:

cd /usr/local/bin/cat vnc-kiosk-monitor.sh #!/bin/bash -xvCHROMIUM="chromium-browser"while true; do    if ! ss -tn sport = :5900 | grep -q ESTAB; then        echo "[INFO] No VNC clients connected. Logging out and restarting Chromium..."        # Clear session data        rm -rf /home/pi/.config/chromium/Default/Session* \               /home/pi/.config/chromium/Default/Cookies \               /home/pi/.config/chromium/Default/Cachesudo rm -rf /tmp/*        # Kill Chromium        sudo pkill -f "$CHROMIUM"        sleep 5        # Restart kiosk        /home/pi/scripts/kiosk.sh     fi        sleep 5    done

Code:

cat /etc/systemd/system/vnc-kiosk-monitor.service [Unit]Description=Monitor VNC and Reset Chromium KioskAfter=network-online.targetWants=network-online.target[Service]Type=simpleUser=piExecStart=/bin/bash /usr/local/bin/vnc-kiosk-monitor.shRestart=always[Install]WantedBy=graphical.target
The issue is this configuration is working in one RPi but not in other Pi giving blank screen. On disabling custom resolution, blank screen issue resolves but my project requirement is not fulfilling.

Please help me to troubleshoot this issue.

Pi is running in X11.

Statistics: Posted by Linux_01 — Tue Apr 29, 2025 5:09 am



Viewing all articles
Browse latest Browse all 6309

Trending Articles