Search code examples
node.jsreactjselectrondesktop-application

How to open exteranal application on top of desktop using electron


I have page in my electron application where I display open application which I can recorder apps page

These apps I get using DescktopCapturer.getSources() method and get there screen's ids and icons to display.

I want to show them on top of desktop after selecting one of them, for example I select Chrome and I need to open chrome using electron, how I can do this? thanks!)


Solution

  • I found answer on my question.

    tell application "System Events" to tell process "${appName}"
       set frontmost to true
        windows where title contains "${name}"
        if result is not {} then perform action "AXRaise" of item 1 of result
    end tell
    

    If u dont't need to filter by title u can just do

    tell application "System Events" to tell process "${appName}"
           set frontmost to true
           perform action "AXRaise" of item 1 of result
      end tell