Page 1 of 1

Restore open windows at logon?

Posted: Sat Jul 21, 2018 6:58 am
by lsemmens
Is there a method in Mint that will allow me to restore open NEMO windows at Logon like the restore File Manager in Windoze? I'm trying to setup a machine for my wife where, depending upon where she is (i.e. home or hospital) I can display a set of ICONS appropriate to her circumstance. My intent is to have a Nemo window on one workspace with a group of launchers appropriate to home - e.g. network folders, internet locations and so on, and another in a seperate workspace that only accesses stuff on the computer. She is not particularly computer savvy and does not really comprehend the difference between network shares, internet sites and local folders. For my own convenience I'll have a third workspace that points to my stuff. Ideally I'd love to have a set of icons on the desktop, but they are reflected on every workspace which is not my intent.

So my plan is to have Nemo in "Workspace 1" open to the "home" folder
Nemo in "Workspace 2" open to the "hospital" folder
and Nemo in "Workspace 3" open to "My" folder.
Is it possible? I could set up separate accounts for each circumstance but that,then adds a login screen which I am hoping to avoid.

Re: Restore open windows at logon?

Posted: Sat Jul 21, 2018 8:17 am
by gm10
lsemmens wrote:
Sat Jul 21, 2018 6:58 am
Ideally I'd love to have a set of icons on the desktop, but they are reflected on every workspace which is not my intent.
Something like that is easily scripted though. Initial setup, copy & paste into a terminal in full:

Code: Select all

mkdir ~/Desktop/.workspaces
wmctrl -s 0
echo 0 > ~/Desktop/.workspaces/current_workspace
cat >> ~/Desktop/.workspaces/switchWorkspace.sh <<'EOB'
#!/bin/bash
if [ "$(ls ~/Desktop)" ]; then mv ~/Desktop/* -t ~/Desktop/.workspaces/$(<~/Desktop/.workspaces/current_workspace)/; fi
wmctrl -s $1
echo $1 > ~/Desktop/.workspaces/current_workspace
if [ "$(ls ~/Desktop/.workspaces/$1)" ]; then mv ~/Desktop/.workspaces/$1/* -t ~/Desktop/; fi
EOB
chmod u+x ~/Desktop/.workspaces/switchWorkspace.sh
mkdir ~/Desktop/.workspaces/0
mkdir ~/Desktop/.workspaces/1
mkdir ~/Desktop/.workspaces/2
mkdir ~/Desktop/.workspaces/3
If you've got more than 4 workspaces create directories for them as well as in the last line above.

Now you can easily switch to the second workspace like this:

Code: Select all

~/Desktop/.workspaces/switchWorkspace.sh 1
Change the number at the end to go to another workspace (your 4 workspaces are numbered 0-3). You'd probably want to bind these to keyboard shortcuts. Any changes you make to the desktop's contents will persist within that workspace only.

Re: Restore open windows at logon?

Posted: Sun Jul 22, 2018 6:22 am
by lsemmens
That looks interesting, when I have an hour or so, I shall analyse that so I can understand what is happening. It looks like it might achieve my intent. Thank you.

Re: Restore open windows at logon?

Posted: Sun Jul 22, 2018 7:00 am
by gm10
Sure, let me know if you've got any questions. It's fairly simple, basically just moving the files on your desktop around. ;)

Also I had just quickly hacked this together, so there's no error checking, but as long as you don't mess with the files and folders it creates it should work. Note that seeing it again I just now made a small fix to the created script. It should work either way but if you had already run it I suggest you rm -r ~/Desktop/.workspaces and run it again just in case.