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

Other projects • Controlling Chromium via a Wayland bash script

$
0
0
Hello everyone,

this is sort of a "part 2" to my previous post troubleshooting the Raspberry Pi kiosk mode tutorial (https://www.raspberrypi.com/tutorials/h ... iosk-mode/).

I have gotten to the section where I can get my webpage(s) of choice to open automatically upon start-up. However, the bash script to make the tabs switch doesn't work. If I plug in a keyboard I can manually switch tabs via CTRL+TAB.

When I run the script from the terminal I get an error message, "Wayland connection failed," on repeat until I close the program. I have a painfully basic understanding of Wayland, all I know is that it is some sort of GUI processor.

Is there some simple way of making this script work?

Code to make Chromium open on start-up:

Code:

chromium = chromium-browser https://exampleA.com https://exampleB.com --kiosk --noerrdialogs --disable-infobars --no-first-run --ozone-platform=wayland --enable-features=OverlayScrollbar --start-maximized
Bash script in question:

Code:

#!/bin/bash# Find Chromium browser process IDchromium_pid=$(pgrep chromium | head -1)# Check if Chromium is runningwhile[[ -z $chromium_pid ]]; do  echo "Chromium browser is not running yet."  sleep 5  chromium_pid=$(pgrep chromium | head -1)doneecho "Chromium browser process ID: $chromium_pid"export XDG_RUNTIME_DIR=/run/user/1000# Loop to send keyboard eventswhile true; do  # Send Ctrl+Tab using `wtype` command  wtype -M ctrl -P Tab  # Send Ctrl+Tab using `wtype` command  wtype -m ctrl -p Tab  sleep 10done

Statistics: Posted by mike_the_red — Mon Feb 05, 2024 10:08 pm — Replies 1 — Views 48



Viewing all articles
Browse latest Browse all 6980

Trending Articles