@joezie Thank you very much for this. On my Raspberry PI 5, I did this to get it to work:
apt install xdotool
nano refreshMagicMirror.sh
#!/bin/bash
# refreshMagicMirror.sh
export DISPLAY=:0
xdotool windowactivate --sync $(xdotool search --name magicmirror) key ctrl+r
chmod og+x refreshMagicMirror.sh
To use this script:
. refreshMagicMirror.sh
or
/home/<username-here>/refreshMagicMirror.sh
assuming the script is in your user account’s home directory.
Without setting the DISPLAY=:0 manually, xdotool wasn’t able to figure out which display to run on. By using the --name magicmirror instead of the --class search, it was able to find the one window named magicmirror so no need to awk out the third line entry of the --class results.
I hope this helps someone as much as your post helped me solve this. I like refreshing the screen remotely way more than restarting the service!