Some might be outdated.
Taken from (404 as of today): https://macosxautomation.com/system-prefs-links.html
$ open "x-apple.systempreferences:com.apple.preference.security?General"Some might be outdated.
Taken from (404 as of today): https://macosxautomation.com/system-prefs-links.html
$ open "x-apple.systempreferences:com.apple.preference.security?General"Below are a list of System Preference pane URLs and paths that can be accessed with scripting to assist users with enabling macOS security settings without having to walk them through launching System Preferences, finding panes, and scrolling to settings. Not all panes have an accessible anchor and some are OS specific.
To find the Pane ID of a specific pane, open the System Preferences app and select the desired Preference Pane. With the pane selected, open the ScriptEditor.app and run the following script to copy the current Pane ID to your clipboard and display any available anchors:
tell application "System Preferences"
set CurrentPane to the id of the current pane
set the clipboard to CurrentPanemyMac.domain.comsudo scutil --set HostName <new host name>| 1. Backup com.apple.finder.plist | |
| cp ~/Library/Preferences/com.apple.finder.plist ~/Desktop | |
| 2. Set top-level defaults using the defaults command | |
| Default to list view: | |
| defaults write com.apple.finder FXPreferredViewStyle Nlsv | |
| Default Arrange By flags that don't seem to be effective: | |
| defaults write com.apple.finder FXArrangeGroupViewBy kind | |
| defaults write com.apple.finder FXPreferredGroupBy kind |
Ventura docs for M2 Macs in this comment: https://gist.github.com/henrik242/65d26a7deca30bdb9828e183809690bd?permalink_comment_id=4555340#gistcomment-4555340
Old Monterey docs in this old revision: https://gist.github.com/henrik242/65d26a7deca30bdb9828e183809690bd/32c410e3a1de73539c76fa13ea5486569c4e0c5d
Solution for Sonoma: https://gist.github.com/sghiassy/a3927405cf4ffe81242f4ecb01c382ac
| import Cocoa | |
| import Foundation | |
| // Move around and click automatically at random places in macos, kinda human like in a cheap way. | |
| // Moves the mouse pointer to `moves` random locations on the screen and runs the `action` function at | |
| // each point with the point as argument. | |
| func mouseMoveWithAction(moves: Int, action: (CGPoint) -> Void = defaultAction) { | |
| let screenSize = NSScreen.main?.visibleFrame.size |
| First just enable battery monitoring: | |
| UIDevice.current.isBatteryMonitoringEnabled = true | |
| Then you can create a computed property to return the battery level: | |
| var batteryLevel: Float { | |
| return UIDevice.current.batteryLevel | |
| } | |
| To monitor your device battery level you can add an observer for the UIDeviceBatteryLevelDidChange notification: |
| class HomeRoomPageViewController: UIViewController { | |
| var floor: FloorModel | |
| init(floor: FloorModel) { | |
| self.floor = floor | |
| super.init(nibName: nil, bundle: nil) | |
| .... | |
| } | |
| required init?(coder aDecoder: NSCoder) { |