Guest User

Untitled

a guest
Jan 17th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. function enable_darkmode() {
  2. set_darkmode "$1" "no"
  3. }
  4.  
  5. function disable_darkmode() {
  6. set_darkmode "$1" "yes"
  7. }
  8.  
  9. function set_darkmode() {
  10. app="$1"
  11.  
  12. identifier="$(osascript -e "id of app \"${app}\"")"
  13.  
  14. if [[ "${identifier}" == "" ]]; then
  15. echo "Unknown app: ${app}" >&2
  16. exit 1
  17. fi
  18.  
  19. osascript -e "tell application \"${app}\" to quit"
  20. defaults write "${identifier}" NSRequiresAquaSystemAppearance -bool "$2"
  21. osascript -e "tell application \"${app}\" to activate"
  22. }
Add Comment
Please, Sign In to add comment