Sharing Stickies between Accounts

wstewart

Registered
Anyone have an idea how to set up Stickies so you can see the same file across multiple Accounts (on the same machine)?

I asked this question on MacOSXHints.com and it was suggested that I move the .StickiesDatabase file to ~/Users/Shared/ and place an alias back in ~/Library/.StickiesDatabase for each account. It was also mentioned that I might have to change the permissions to read/write for group access.

I tried the above, but I must either not have all the steps correct (particularly the permissions), or it simply doesn't work. Now, on launch of Stickies, I get nothing (no Stickies appear).

I also see that there is a .plist for the Stickies database. Is this part of the equation? Do I need to put it in ~/Users/Shared/ and an alias back to ~/Library/?

If you have any ideas (or better instructions), I'd appreciate the help. I really like Stickies; but, I need to share them between multiple users of the same machine.

Thanks... Bill ;)
 
I think I came up with a solution, but it requires an amount of hacking around in the terminal. I'm assuming that we're talking about sharing these stickies between two accounts on the same computer (although if you were really tricky you could modify the scripts to do this over multiple machines).

1) First, you'll need to create a script that you will run when a user logs out. In the terminal use sudo mkdir to create the directory /usr/local/bin if it does not already exist. In this directory type:
sudo pico -w logoutscript
then in the file you're creating write the following script:
#!/bin/sh
rsync -uaW /Users/user1/Library/StickiesDatabase /Users/user2/Library/StickiesDatabase

rsync -uaW /Users/user2/Library/StickiesDatabase /Users/user1/Library/StickiesDatabase

/usr/sbin/chown user1.staff /Users/user1/Library/StickiesDatabase

/usr/sbin/chown user2.staff /Users/user2/Library/StickiesDatabase

(If you have more than 2 users this gets uglier, but is still doable. In theory you could write a script to do all this, but I'm FAR too lazy for that. If you had 3 users you'd have to run rsync -uaW /Users/user1... twice, and copy it into user2 and user3's Libraries. Then user2 has two rsyncs to copy into 1 and 3, etc. You'd also then use chown to set the ownership of this file to the correct user 3 times.)

hit ^X to exit and type Y to indicate you want to save this wonderful new file, then enter.

If you're not familiar with rsync, the short version is that it's one of my favorite things about unix. With the -u tag it compares which file is most recent and updates the files to refelct this. It won't overwrite a newer file with an older one IOW.

2) Now we need to make this script executable. Type sudo chmod 700 logoutscript

3) Now we need to tell OSX to run this script anytime a user logs out. To do this type sudo pico -w /etc/ttys. Now look for a line that starts console "/System/Library/CoreServices/loginwindow.app/Contents/MacOS... and change it to read:
console "/System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow -LogoutHook /usr/local/bin/logoutscript" vt100 on secure
window=/System/Library/CoreServices/WindowServer onoption="/usr/libexec/getty std.960

This should all be on one line. There's a space before and after -LogoutHook if that's not apparent. Hit ^X followed by Y then enter to exit and save. Restart el computero.

That should do it (unless I'm a moron and forgot something). The script will run when you logout and rsync will copy the newest version of StickiesDatabase to each user's Library, and then reset the owner to the appropriate party.

All of this is necessary because for whatever reason Stickies reads symbolic links but ignores them when it comes time to writing data and if you have them it will just overwrite new data.

Hope that does it for you. Let me know if something goes awry. (And I disavow any responsibility if you frag your machine, but I'll try and help you fix it :) )
 
or instead of rsync-ing the files you could just set the permissions to group write then move the file from the shared folder to the users on login then back to shared on logout. Only one person has access to the file at a time after all.

You might want to copy the file just incase the script fails to run on logout (power failure for instance - i would say crash but a powercut would be much more likley!)
 
That wouldn't work. The script that is run at logout is run as root. Therefore there is no way for it to know what user set it off. It can't say, "Ah, user2 logged out, causing me to run, thus I shall copy StickiesDatabase from user2's Library to the Shared directory." It does the same thing at every logout from every user. Therefore rsync provides the intelligence, the user who exited most recently has the newest copy of StickiesDatabase and that's the one that will overwrite everyone else's copy.

I've always thought it would be easiest to have a .logout for each user or something similar. Too bad that's not an option.
 
Back
Top