Last active
July 26, 2021 13:16
-
-
Save chrisgrande/d3be9102e805acb8380a8b40c7c8421d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/mxcc/mxcc-python3 | |
import os | |
from docklib import Dock | |
from AppKit import NSBundle, NSRunningApplication | |
from pathlib import Path | |
import sys | |
import time | |
import pwd | |
uname = sys.argv[3] | |
uid = pwd.getpwnam(uname)[2] | |
os.setuid(uid) | |
# app to check if running | |
app_name = 'Dock' | |
app_bundle_id = 'com.apple.dock' | |
# check if Dock is running - if not - wait | |
while not NSRunningApplication.runningApplicationsWithBundleIdentifier_(app_bundle_id): | |
print('Waiting for %s!' % app_name) | |
time.sleep(5) | |
home_folder = Path.home() | |
dock_version = "edu.mxcc.dock.version.1.6" | |
touch_path = f"{home_folder}/Library/Preferences/{dock_version}" | |
dock_tickle = f"{home_folder}/Library/Preferences/edu.mxcc.dock.tickle" | |
if Path(touch_path).exists() and not Path(dock_tickle).exists(): | |
sys.exit(0) | |
Path(touch_path).touch() | |
if Path(dock_tickle).exists(): | |
os.remove(dock_tickle) | |
lab_dock = [ | |
"/Applications/Safari.app", | |
"/Applications/Transmit.app", | |
"/Applications/BBEdit.app", | |
"/Applications/Adobe Photoshop 2020/Adobe Photoshop 2020.app", | |
"/Applications/Adobe Photoshop 2021/Adobe Photoshop 2021.app", | |
"/Applications/Adobe Illustrator 2020/Adobe Illustrator.app", | |
"/Applications/Adobe Illustrator 2021/Adobe Illustrator.app", | |
"/Applications/Adobe InDesign 2020/Adobe InDesign 2020.app", | |
"/Applications/Adobe InDesign 2021/Adobe InDesign 2021.app", | |
"/Applications/Adobe Premiere Pro 2020/Adobe Premiere Pro 2020.app", | |
"/Applications/Adobe Premiere Pro 2021/Adobe Premiere Pro 2021.app", | |
"/Applications/Adobe After Effects 2020/Adobe After Effects 2020.app", | |
"/Applications/Adobe After Effects 2021/Adobe After Effects 2021.app", | |
"/Applications/Adobe Audition 2020/Adobe Audition 2020.app", | |
"/Applications/Adobe Audition 2021/Adobe Audition 2021.app", | |
"/Applications/Adobe Animate 2020/Adobe Animate 2020.app", | |
"/Applications/Adobe Animate 2021/Adobe Animate 2021.app", | |
"/Applications/Adobe Dreamweaver 2020/Adobe Dreamweaver 2020.app", | |
"/Applications/Adobe Dreamweaver 2021/Adobe Dreamweaver 2021.app", | |
"/Applications/Pro Tools.app", | |
"/Applications/Microsoft Word.app", | |
"/Applications/Microsoft Excel.app", | |
"/Applications/Microsoft PowerPoint.app", | |
"/Applications/Microsoft Teams.app" | |
] | |
dock = Dock() | |
dock.items["persistent-apps"] = [ | |
dock.makeDockAppEntry(item) for item in lab_dock if os.path.exists(item) | |
] | |
dock.items['persistent-others'] = [ | |
dock.makeDockOtherEntry(os.path.expanduser("~/Downloads"), arrangement=2, displayas=0, showas=1) | |
] | |
dock.show_recents = False | |
dock.tilesize = 48 | |
dock.save() | |
sys.exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment