Impress Show Runner Trivial on Linux

Update 11 April 2020: Using the xdotool method, the QtShowRunner works well on Linux, so there is a portable version for Windows and Linux. Get the latest at the github repo. I’m still investigating “Deployment” for Windows and Linux. Now, previously…

I have beat my head against the wall trying to fix the QtShowRunner program that works on Windows to work on Linux. None of the methods have worked.

  • Kernel uinput API calls never worked.
  • Using the X11 XSendEvent to send either Mouse clicks or Key events didn’t work.

Finally I found a command called xdotool which does many X things including sending mouse clicks and key presses. Here’s a shell script that uses the xdotool to launch soffice impress to show a slideshow and then terminates the show and then exits the script.

Screenshot from 2020-04-09 20-11-31.png

The script launches the show with the ending & to detach it. Then loops looking for the process using pgrep and if it’s still around, uses xdotool to click the mouse and waits for  5 seconds. When the process finishes the show, and the click ends the show, then pgrep fails and the script exits. Trivial.

Here’s the output of a run.

Screenshot from 2020-04-09 20-12-22.png

Looks like soffice tossed an error along the way, but who cares, it worked just fine.

I’m not sure how I’ll incorporate this into my QtShowRunner program. But one way to do that is to just create these short scripts on the fly and feed them to the shell program to execute to run each show. Here’s an example of how to run a series of shows in an infinite loop.

Here’s an example script of how to run some slideshows in an infinite loop.

# wait for the show named soffice to finish
# keep clicking the mouse until it ends.
function waitforshow {
sleep 5
echo "Clicking the mouse and waiting for show to end. Ctrl/C to Exit"
while pgrep soffice > /dev/null 2>&1
echo "Click"
xdotool click 1
sleep 5
echo "show has completed"
# Launch a slideshow by passing it a filepath to the impress file
# wait on the show to finish and then return.
function launch {
soffice –impress –show $1 &
# Loop forever showing these slideshows
while :
echo "Start Impress on a show and let it go"
launch ShowTestOne.odp
launch ShowTestTwo.odp
launch ShowTestThree.odp
echo "Loop back to start all the shows again"
# never get here

view raw
hosted with ❤ by GitHub

Tomorrow is another day, but we have a solution.