So, if been looking to programatically switch tabs of a browser in kiosk mode. This is a quick way to do exactly that.

So first you have to install xdotool. I did this on a Ubuntu machine using apt:

$ sudo apt install xdotool

Then put the following in a file and make that executable (chmod +x yourscript.sh):

#!/bin/bash

BROWSER="Brave"
direction=$1

action="Ctrl+Tab"
if [[ "${direction}" == "left" ]]; then
  action="Ctrl+Shift+Tab"
fi

xdotool windowactivate --sync $(xdotool search --name ${BROWSER} | tail -n 1) && xdotool key ${action}

Execute it with an argument “left” or “right” (right = default). On execution it will locate your browser (“Brave”), then it emulates a shortcut to go to the next or previous tab.

The goals is to fire this script once a button has been pressed on a Kiosk such that the user can choose which tab to show.