Posted By

ktrout on 11/03/13


Tagged

number id desktop workspace


Versions (?)

Echo current desktop number


 / Published in: Bash
 

echo's the current workspace id

  1. #!/bin/sh
  2.  
  3. desktops=$(wmctrl -d)
  4. while read id stat rest
  5. do
  6. if test "$stat" = "*"
  7. then
  8. echo $id
  9. exit 0
  10. fi
  11. done <<EOF
  12. $desktops
  13. EOF
  14. echo "Cannot determine current desktop" 1>&2
  15. exit 1

Report this snippet  

You need to login to post a comment.