Restore open windows at logon?

Please post suggestions for improvement of Cinnamon here
https://github.com/linuxmint/Cinnamon
Post Reply
User avatar
lsemmens
Level 5
Level 5
Posts: 975
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

Restore open windows at logon?

Post by lsemmens » Sat Jul 21, 2018 6:58 am

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.
Kernel: 4.15.0-36-generic x86_64 bits: 64
Desktop: Cinnamon 3.8.9
Distro: Linux Mint 19 Tara

Laptop T4500 Dualcore 4Gb RAM
Server AMD Phenom 9650 - GEForce 9400GT 6Gb RAM
+ three other Linux Mint machines
Out of my mind - please leave a message

gm10
Level 10
Level 10
Posts: 3456
Joined: Thu Jun 21, 2018 5:11 pm

Re: Restore open windows at logon?

Post by gm10 » Sat Jul 21, 2018 8:17 am

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.
Last edited by gm10 on Sun Jul 22, 2018 6:53 am, edited 1 time in total.

User avatar
lsemmens
Level 5
Level 5
Posts: 975
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

Re: Restore open windows at logon?

Post by lsemmens » Sun Jul 22, 2018 6:22 am

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.
Kernel: 4.15.0-36-generic x86_64 bits: 64
Desktop: Cinnamon 3.8.9
Distro: Linux Mint 19 Tara

Laptop T4500 Dualcore 4Gb RAM
Server AMD Phenom 9650 - GEForce 9400GT 6Gb RAM
+ three other Linux Mint machines
Out of my mind - please leave a message

gm10
Level 10
Level 10
Posts: 3456
Joined: Thu Jun 21, 2018 5:11 pm

Re: Restore open windows at logon?

Post by gm10 » Sun Jul 22, 2018 7:00 am

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.

Post Reply

Return to “Cinnamon”