plugin_init.go 806 B

123456789101112131415161718192021222324252627282930313233343536
  1. package LauncherPy
  2. import (
  3. "os/exec"
  4. "os/user"
  5. "github.com/cuu/gogame/time"
  6. "github.com/clockworkpi/LauncherGoDev/sysgo/UI"
  7. )
  8. /******************************************************************************/
  9. type LauncherPyPlugin struct {
  10. UI.Plugin
  11. }
  12. func (self *LauncherPyPlugin) Init( main_screen *UI.MainScreen ) {
  13. }
  14. func (self *LauncherPyPlugin) Run( main_screen *UI.MainScreen ) {
  15. if main_screen != nil {
  16. main_screen.MsgBox.SetText("Rebooting to Launcher")
  17. main_screen.MsgBox.Draw()
  18. main_screen.SwapAndShow()
  19. time.BlockDelay(550)
  20. usr, _ := user.Current()
  21. dir := usr.HomeDir
  22. cmd := exec.Command("sed","-i","s/launchergo/launcher/g",dir+"/.bashrc")
  23. cmd.Run()
  24. cmd = exec.Command("sudo","reboot")
  25. cmd.Run()
  26. }
  27. }
  28. var APIOBJ LauncherPyPlugin