Skip to content

Instantly share code, notes, and snippets.

@NICHOLAS85
Created June 12, 2020 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save NICHOLAS85/cd360452bb2cbd7b74177325e142fc22 to your computer and use it in GitHub Desktop.
Save NICHOLAS85/cd360452bb2cbd7b74177325e142fc22 to your computer and use it in GitHub Desktop.
var menuOpts = {
a:{
"Reboot Userspace":()=>{
shellrun("launchctl reboot userspace")
},
Respring:()=>{
device.respring()
},
"Safe Mode":()=>{
shellrun("killall -SEGV SpringBoard")
},
UICache:()=>{
shellrun("uicache")
},
More:()=>{
presentMenu("More","","b")
}
},
b:{
"Run MK1 Script":()=>{
prompt("Run MK1 Script","",(script)=>{
if(script) MK1.runScript(script);
})
}
},
Cancel:()=>{
// Does nothing
}
}
function presentMenu(title, msg, submenu){
var list = Object.keys(menuOpts[submenu])
list.push("Cancel")
menu(title, msg, list ,(choice)=>{
(menuOpts[submenu][list[choice]] || menuOpts.Cancel)();
})
}
presentMenu("PowerSelector","","a")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment