def insert_unload_reload(ar: rumps.MenuItem, j: launchd.LaunchdJob): print(j.plistfilename) ar.add( rumps.MenuItem("Unload", callback=lambda x: launchd.unload(j.plistfilename))) ar.add( rumps.MenuItem("Reload", callback=lambda x: launchd.unload(j.plistfilename) and launchd.load(j.plistfilename)))
def uninstall(label): ''' Utility function to remove a .plist file and unload it :param label: job label ''' if launchd.LaunchdJob(label).exists(): fname = launchd.plist.discover_filename(label) launchd.unload(fname) os.unlink(fname)
def plist_launch_uninstall(label, scope): fname = launchd.plist.discover_filename(label, scope) if not fname: raise Exception(f"{label}.plist not found.") launchd.unload(fname) os.unlink(fname)