![]() ![]() With Offset, your scripts will have to figure out the last-logged-in user from the output of defaults read /Library/Preferences/ lastUserName If you have only one script to run at logout, you may want to consider using Apple's deprecated LogoutHook instead of using Offset, because the direct linking will give you access to the $1 variable (currently-logged-in user).A login script that runs once per user usually sets up something as a default, which the user can later change. Logout scripts typically clean something up every time a user logs in. I figured anything you wanted to do once you could do with a login-once using Outset instead of a logout-once in Offset. In addition to slightly modifying a few variable names, I significantly pared down Joseph Chilcote's original script, because I couldn't come up with any use cases for a logout-once scenario.Of course, you can also write custom Launch Agents and Launch Daemons for every single script, but the point here is convenience-placing scripts in a few folders to run instead of creating separate launchd's for each script. So Offset, which can be used in conjunction with Outset if you want both scripts for login/boot/on-demand and logout scripts, you can install both Outset and Offset. Greg Neagle suggested using a launch agent that runs at the login screen (meaning the user is logged out), and that appears to be the best (safest) way to go, so that's what this project is using. The only problem is that they don't present an actual alternative to the logout hook, and the logout hook appears to still work as of 10.12 (Sierra). Anecdotally, I haven't noticed any of these issues adversely affecting day-to-day functionality in my workplace, but if there's a tool that can be used by many people in various contexts, it's good to use a method that's a bit more thoroughly tested.Īpple (since 10.4, I believe) has officially deprecated, in Login and Logout Hooks, the use of login and logout hooks in favor of Launch Agents. Chilcote had some concerns about that approach: that it does not respawn if killed prematurely, and that it will run the script's commands without warning the user if the Launch Agent is killed prematurely. There was a bit of debate about what method to use for this, since there is a workaround that uses a Launch Agent that then runs trapped code when the script gets SIGINT, SIGUP, or SIGTERM. He believed the running of logout scripts was outside the scope of his project and also had reservations about the implementation, so he suggested I could make it and call it offset, which is actually a great name, when you start looking at all the dictionary definitions of the word (a counterbalance, an offshoot, an actual outset still). Heavily based on Joseph Chilcote's Outset, which processes packages and scripts at boot and login. These are packaged and deployed into the outset/login-once folder (located in usr/local/) and with all 3 tools deployed during initial setup, it only takes a few moments to get the user’s account configured with some basic user settings.Automatically process packages and scripts at logout (for 10.12 and earlier) or login window (for 10.13 and 10.14). #show Hard Drives, Network Drives, removable media on desktopĭefaults write ShowHardDrivesOnDesktop -bool trueĭefaults write ShowExternalHardDrivesOnDesktop -bool trueĭefaults write ShowRemovableMediaOnDesktop -bool trueĭefaults write ShowMountedServersOnDesktop -bool true # Set folders to be sorted first in Finder viewĭefaults write _FXSortFoldersFirst -bool true ![]() usr/local/bin/desktoppr "/Library/Desktop Pictures/Solid Colors/Space Gray.png"ĭefaults write -bool falseĭefaults write NSGlobalDomain AppleShowAllExtensions -bool true Sleep 5 # add sleep to make sure desktoppr works $ -add '~/Downloads' -view fanĭefaultusersettings.sh has a few basic settings for security, like ensuring the user’s home folder is secured from other users, secure keyboard entry in terminal, and sets some basic user settings requested, like a basic blank desktop background and settings in Finder to show file extensions, folders first in list view, and display drives on the desktop.ĭefaults write SecureKeyboardEntry -int 1 Sleep 2 # we add a delay so that the dock has time to inialize the removal # Delete everything from the dock and replace it with a specific selection of apps. ![]()
0 Comments
Leave a Reply. |