I am trying to write a bash script that needs some identifier of the current active desktop (I want my emacs-clients to connect to different servers depending on the active desktop). I have searched around and I can't seem to find a command that will get this information. Does such a thing exist?


1 Answer 1


I'm not sure exactly what you mean by "active desktop", but the command "system_profiler" can generate a vast amount of information about your computer. Between it's various settings and text filtering, you should be able to pluck out almost anything need to know.

  • I'm sorry that was unclear. I mean the current Space (I can't tell if they stopped using that term in favor of desktop). I looked through system_profiler but it doesn't seem to have that kind of data.
    – qazmonk
    May 30, 2016 at 17:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .