• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

A command to refresh magic mirror page

Scheduled Pinned Locked Moved General Discussion
1 Posts 1 Posters 662 Views 1 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    joezie
    last edited by May 18, 2020, 2:30 AM

    Hi all! Previously I was working on a course project based on magic mirror, and it’s required that the smart mirror could be refreshed by a command (because I updated the config.js). I searched around the forum but didn’t find any ready-to-run command. Luckily, I finally figured it out, and would like to share with those who might need it in the future!

    Firstly, here’s the one-line solution:

    xdotool windowactivate --sync $(xdotool search --class electron | awk 'FNR == 3 {print}') key ctrl+r
    

    You might already know that we can use keyboard stroke “ctrl+R” to refresh the smart mirror, and the command above is basically emulating this behavior. As for preparation, you need to use apt-get to download xdotool, which is used to send keyboard stroke command to a given window, in our case the smart mirror. Now I would explain this command in steps:

    xdotool search --class electron
    

    This command searches for existing windows whose name includes “electron”. From my observation, I found that this word “electron” appears in the name of our smart mirror window (though I don’t know what electron is).

    awk 'FNR == 3 {print}'
    

    From the previous step, 3 windows were found. In my case, the 3rd one is the smart mirror window that I’m interested in (maybe in your case it’s not, so remember to test it out!). This command selects it out.

    xdotool windowactivate --sync ... key ctrl+r
    

    This command sends the keystroke “ctrl+R” signal to the window we located in the previous steps.

    Hope this would help!

    1 Reply Last reply Reply Quote 0
    • 1 / 1
    1 / 1
    • First post
      1/1
      Last post
    Enjoying MagicMirror? Please consider a donation!
    MagicMirror created by Michael Teeuw.
    Forum managed by Sam, technical setup by Karsten.
    This forum is using NodeBB as its core | Contributors
    Contact | Privacy Policy