How do I find the current virtual terminal
- by camh
I am working around a problem in Ubuntu 10.04 where after resume, the mouse cursor disappears.
This can be "fixed" by running chvt 1; chvt 7 in a script in /etc/pm/sleep.d, such that those commands run on thaw and resume.
However, the X console is not always vt #7, so chvt 7 is wrong in those cases.
What I would like to do is find out the current vt in the fix-up script and make sure I change back to that vt.
How can I find the current vt? (tty(1) just reports "not a tty")