Compiz implements viewports instead of desktops. You can calculate the number of viewports based on the width of the desktop:
$ wmctrl -d 0 * DG: 7680x1200 VP: 0,0 WA: 0,0 1920x1175 Workspace 1
This says that I have four viewports (7680 / 1920 = 4) and I'm currently looking at the first one. (Unfortunately I don't see a way in wmctrl to reliably fetch the width of a viewport becuase the working area will shrink if you have a panel taking space on an edge. You can either use hard numbers or use xdpyinfo to find the pixel dimensions of your screen.)
To switch to the second viewport:
$ wmctrl -o 1920,0
If you're wanting to parse this stuff in bash, here's an example:
$ dimensions=$(xdpyinfo | awk '$1=="dimensions:"') $ screen_width=$ $ info=( $(wmctrl -d | awk '') ) $ desktop_width=$ $ viewports=$(( desktop_width / screen_width )) $ current_vp=$(( $ / screen_width ))