Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

osx - script to get current desktop number

Is there a way to get current desktop/space number on osx programatically?

I've found this questions but it seems to be a little bit outdated: OSX Lion AppleScript : How to get current space # from mission control?

I've also found this: http://www.hammerspoon.org/docs/hs.spaces.watcher.html but unfortunately it does not work.

like image 448
trzeciakp Avatar asked Dec 06 '25 03:12

trzeciakp


1 Answers

Since recent OS version, it is no longer possible to access via script to spaces. the only thing I found is how to get, via Applescript the name/path of desktop picture on current space :

tell application "Finder" to set A to (desktop picture) as string

Except that, since Yosemite (at least !) Applescript dictionary no longer contain space scriptable elements.

like image 118
pbell Avatar answered Dec 07 '25 18:12

pbell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!