0

I work with lots of terminals open on many virtual desktops; each desktop given a meaningful name to make it very easy to multitask.

My problem is that I lose the virtual machine I am running on over the weekends. It is the policy of my system administrator that we will lose our current virtual machine if it is inactive for more than 11 hours; and this means the weekend.

So, every Monday, I have to start from scratch, manually re-opening all my terminals and moving them to the correct desktops to continue where I left off on Friday. I want to write a script to do this for me automatically.

For a given terminal number, e.g. terminal 4, is there a command line expression that will tell me which virtual machine this terminal is open on? For example, it might look something like

getDesktopNumber 4

which might return the number 7, telling me that terminal 4 is open on desktop 7. Is there such a command?

Also, a companion question would be the following: is there a command line expression that I can use, to open up a new terminal and get it to open up on a specified desktop? For instance, this might look something like:

openTerminal 7

which would then open up a new terminal an place it on desktop 7. Is there such a command?

I imagine there is in fact no way to do what I am asking, but that would be a shame because it would make using virtual desktops so much more efficient: if I could automate the process of remembering the terminal/desk layout on Friday, and then automatically reopening these terminals on their correct desktops on Monday morning (when I open a session on a new virtual machine). I would have thought there should be a way to do this, as it is one of the most obvious thing that a user with many terminals and desktops would want to do.

Unfortunately, simply keeping my virtual machine is not an option. It is the policy of my system administrator that we will lose our current virtual machine if it is inactive for more than 11 hours; and this means the weekend.

  • There likely IS a way to do it, but it's not an OS function, it's a gnome function. The whole virtual desktop layout is controlled by the window manager, not by the OS. I imagine that there are API functions to keep track of what's where, but the OS would not have any control, nor likely much information. I haven't worked much with Gnome (or Xwindows at all) for quite a while, but you may get more help from a gnome/Xwindow-centric board than an OS related one. – Fubar May 6 '20 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.