قالب وردپرس درنا توس
Home / IOS Development / Preparing to teach / demo

Preparing to teach / demo



Normally, I use a separate account to present conversations and demos, but I have recently taken up a more common instructional task, and it's too inconvenient to move from my main account. My main account is where all my development tools and code are a few clicks and keystrokes away. The demo is very safe for public presentation, but also very remote from my workflow.

To solve this, I have built a demo setup tool in Swift. I thought I would share some of the features and approaches. Many of these were not trivial to track when it was time and I thought to have them in one place may be useful for some of you to read my blog.

If you have someone else to share, please let me know. [19659004] Wallpaper

I use Background from Apps from Space to cover my regular desktop with a clean and boring background. Set preferences in the app, then use /Applications/Backdrop.app / killall Bakdrop to swap. It covers your wall without having to put it back to your favorite photo every time you enter and release demo mode.

Do not Disturb

Automate DND with AppleScript. I took code from the web and let me turn on and off, do not disturb mode. (Make sure you enable Script Editor in accessibility to run: Settings> Security & Privacy> Availability> Allow the apps below to control your computer.)

I did not make these pencils, or wrote the oscriptions into my code. They are just two scripts in ~ / bin right now. At some point, time will allow, I unite these in a single script or app, but as they work for now, shrug :

See the code on Host.

Desktop Icons

I spend a lot of work on my desktop, which I prefer not to share. It's easy to hide and display the icons on your desktop with a simple default setting:

  default settings type com.apple.finder CreateDesktop false; 

Keyboard Maestro Macros

I quit not just email ( killall Mail true for false to enable.) But I also disable my keyboard keyboard shortcut Maestro, so I do not accidentally reassign it from the muscle memory.

  osascript -e & # 39; tell program "Keyboard Maestro" to setMacroEnable "8E84EF4C-1
3F8-41AB-85EC-44AF70A52909" Free of Assets "

Grab the unique identifiers for difficult shortcuts from the files stored in ~ / Library / Application Support / Keyboard Maestro . Use with and without activating to automate the macros back and forth again.

Safari History

] Nobody wants their personal browser history to appear under Safari demo as part of auto-complete suggestions. (Imagine if you want to type "S" and have all your sloth sites listed as possible add-ons. Or sky pursue things wor

If you are using iCloud bookmarks, you can disable iCloud, remove history and bookmarks from ~ / Library / Safari and restart Safari ( open / Programs / Safari.app ). To enable restart, start p re-iCloud and wait for the data to sync back to Mac.

I automated file recovery (actually moving files to another location) when iCloud is after and after Safari ( killall Safari ). However, I did not automate / deactivate iCloud Safari bookmark sync from the command line. Instead, I used open & # 39; x-apple.systempreferences: com.apple.preference.icloud & # 39; to make me the right place for a single brand.

I hide my favorite list: [[19659012] true true instead of false to restore.

You may want to restrict Autofill and Search Options (Safari). > Settings> AutoFill and Search). I did not because they did not really affect my presentations. I'm doing well with Safari that suggests search engine, especially when searching for technical themes, for me, these features are not incorrect.

System Call

Here is my old code to perform system calls to perform all setup and teardown without using system () . Although easily updated, I have not spent much time improving something that works. If you have better solutions, please let me know:

  extension NSString {
/// Trim output
was trimmed: String {
return self.trimmingCharacters (i: .whitespacesAndNewlines)
}
}

/// Perform a command as a shell script
@discardableResult
func perform (_ command: string) -> [String] {
leave task = process ()
(task.launchPath, task.arguments) = ("/ bin / sh", ["-c", command])

let pipes = pipes ()
task.standardOutput = pipe
task.launch ()

let data = pipe.fileHandleForReading.readDataToEndOfFile ()
task.waitUntilExit ()

if let output = NSString (data: data, encoding: String.Encoding.utf8.rawValue)?. trimmed {
return output.components (separatedBy: " n")
}

// Something went wrong
print (task.terminationStatus); return []
}

Source link