Narfanator
Narfanator

Reputation: 5813

Detecting which workspace you're in from the command line

I'm trying to write myself a little function to help me keep track of what I'm doing, the idea being that in each workspace I have a different task underway, and a different "todo.txt" file for each workspace. I can certainly specify, when I call the command, which workspace I'm in, but I'd really like to automatically detect which and alter the appropriate file.

Is there any way to determine which workspace I'm in from the command line, so I can use it in a bash function?

Upvotes: 1

Views: 1329

Answers (2)

Chand Priyankara
Chand Priyankara

Reputation: 6784

xprop -root -notype _NET_CURRENT_DESKTOP

Upvotes: 3

wajiw
wajiw

Reputation: 12269

If you're using metacity and python you can do something like this:

python -c "import wnck; s=wnck.screen_get_default(); s.force_update(); w=s.get_active_workspace();  w_num=w.get_number(); print(w_num);" 2>/dev/null

Upvotes: 1

Related Questions