Monday, July 4, 2022

#1 2022-02-07 07:55:57 am

peavine
Member
From:: Prescott, Arizona
Registered: 2018-09-04
Posts: 1370

Rearrange desktop apps/windows

I've written and regularly use several scripts that rearrange apps/windows on the desktop, and the actual rearranging work is done by a handler that uses the System Events' position and bounds properties. The scripts work as I want but tend to be a bit slow.

I ran some timing tests with four open apps, and one script takes about 330 milliseconds. However, with the System Events handler disabled, the timing result is about 8 milliseconds. So, to make the script faster, I have to find an alternative to System Events. Is there some ASObjC method that will do this? Thanks.


2018 Mac mini - macOS Monterey - Script Debugger 8

Offline

 

#2 2022-02-09 12:15:10 am

technomorph
Member
Registered: 2017-12-14
Posts: 254

Re: Rearrange desktop apps/windows

Maybe NSWorkspace ?

https://developer.apple.com/documentati … guage=objc

You ran register for running Applications notifications
From its own Notification Center

That will give you a list of NSRunningApplications.
You might be able to access their NSWindows?

NSRunningApplication inherits from NSApplication
https://developer.apple.com/documentati … guage=objc

Offline

 

#3 2022-02-09 07:16:53 am

peavine
Member
From:: Prescott, Arizona
Registered: 2018-09-04
Posts: 1370

Re: Rearrange desktop apps/windows

Thanks technomorph. I'll take a look at those.


2018 Mac mini - macOS Monterey - Script Debugger 8

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)