项目作者: hechen

项目描述 :
Swwwwich your switcher.
高级语言: Swift
项目地址: git://github.com/hechen/Swwwitch.git
创建时间: 2019-03-30T06:31:07Z
项目社区:https://github.com/hechen/Swwwitch

开源协议:

下载


Swwwitch

Build Status Swift Version

Just a switch tutorial.

Interface-c300

That switch your system theme needs your authorization. Just click OK.

System Event-c300

Under the hood

  1. Switch your system theme using AppleScript
  2. Hide / Show your desktop icons using NSTask(aka Process)
  3. MenuBar only when your Cocoa Application is agent.
  4. Start at login using serviceManagement (embed a helper login app to wake main application up.)

System Appearance Switch

  1. tell application "System Events"
  2. tell appearance preferences
  3. set dark mode to not dark mode
  4. end tell
  5. end tell

You can just using ScriptEditor to run this AppleScript to switch the dark theme and light one.

``` AppleScript to Run
applescript://com.apple.scripteditor?action=new&name=Change%20Theme&script=tell%20application%20%22System%20Events%22%0D%09tell%20appearance%20preferences%0D%09%09set%20dark%20mode%20to%20not%20dark%20mode%0D%09end%20tell%0Dend%20tell

  1. ### Hide / Show Desktop Icons
  2. ```Shell
  3. defaults write com.apple.finder CreateDesktop false
  4. killall Finder

Input the two lines in your terminal, icons just hidden.

If you want recover your icons, just change false to true.

hide Desktop Icons

show Desktop Icons

Caffeinate

  1. # enable caffeinate forever.
  2. # never return.
  3. caffeinate
  4. # disable caffeinate
  5. killall caffeinate

Checkout all command lines macOS Support