diff --git a/internal/ui_main_events.go b/internal/ui_main_events.go index d290ffb..a69c8ba 100644 --- a/internal/ui_main_events.go +++ b/internal/ui_main_events.go @@ -14,8 +14,10 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { case "enter": if m.loaded { - // Process the selected item - m.processSelection() + // Process the selected item, if the return value is true then exit the application + if m.processSelection() { + return m, tea.Quit + } } case "ctrl+z", "backspace": // Go backwards in the model diff --git a/internal/ui_main_functions.go b/internal/ui_main_functions.go index a872cbf..5e00eea 100644 --- a/internal/ui_main_functions.go +++ b/internal/ui_main_functions.go @@ -1,7 +1,6 @@ package internal import ( - "os" "regexp" "github.com/HikariKnight/quickpassthrough/internal/configs" @@ -9,7 +8,7 @@ import ( ) // This function processes the enter event -func (m *model) processSelection() { +func (m *model) processSelection() bool { switch m.focused { case GPUS: // Gets the selected item @@ -65,24 +64,37 @@ func (m *model) processSelection() { // Gets the selected item selectedItem := m.lists[m.focused].SelectedItem() + // If user selected yes then if selectedItem.(item).title == "YES" { + // Add disable VFIO video to the config m.disableVFIOVideo() } + + // Configure modprobe + configs.Set_Modprobe() + + // Go to the next view m.focused++ case INTRO: // This is an OK Dialog // Create the config folder and the files related to this system configs.InitConfigs() + + // Go to the next view m.focused++ case DONE: - os.Exit(0) + return true } + + return false } func (m *model) disableVFIOVideo() { // Get the config config := configs.GetConfig() + + // Add to the kernel arguments that we want to disable VFIO video output on the host fileio.AppendContent(" vfio_pci.disable_vga=1", config.Path.CMDLINE) }