File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed
Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -21,4 +21,5 @@ console.timeEnd("setBounds");
2121console . log ( "[info]: Visible Windows List" ) ;
2222windowManager . getWindows ( ) . forEach ( window => {
2323 console . log ( 'Title: ' + window . getTitle ( ) , '\n' , 'Path: ' + window . path ) ;
24+ window . bringToTop ( ) ;
2425} ) ;
Original file line number Diff line number Diff line change @@ -162,10 +162,14 @@ AXUIElementRef getAXWindow(int pid, int handle) {
162162Napi::Boolean bringWindowToTop (const Napi::CallbackInfo &info) {
163163 Napi::Env env{info.Env ()};
164164
165- auto pid = info[0 ].As <Napi::Number>().Int32Value ();
165+ auto handle = info[0 ].As <Napi::Number>().Int32Value ();
166+ auto pid = info[1 ].As <Napi::Number>().Int32Value ();
167+
166168 auto app = AXUIElementCreateApplication (pid);
169+ auto win = m[handle];
167170
168171 AXUIElementSetAttributeValue (app, kAXFrontmostAttribute , kCFBooleanTrue );
172+ AXUIElementSetAttributeValue (win, kAXMainAttribute , kCFBooleanTrue );
169173
170174 return Napi::Boolean::New (env, true );
171175}
Original file line number Diff line number Diff line change @@ -128,7 +128,11 @@ export class Window {
128128
129129 bringToTop ( ) {
130130 if ( ! addon ) return ;
131- addon . bringWindowToTop ( platform ( ) === "darwin" ? this . processId : this . id ) ;
131+ if ( process . platform === 'darwin' ) {
132+ addon . bringWindowToTop ( this . id , this . processId ) ;
133+ } else {
134+ addon . bringWindowToTop ( this . id ) ;
135+ }
132136 }
133137
134138 redraw ( ) {
You can’t perform that action at this time.
0 commit comments