Skip to content

Commit

Permalink
fix #238: Select first enabled process
Browse files Browse the repository at this point in the history
  • Loading branch information
F1bonacc1 committed Aug 31, 2024
1 parent cefc4e6 commit 859f75b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions issues/issue_238/process-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: "0.5"
processes:
elevated:
command: echo "hi"
is_elevated: true
pc_log:
command: "tail -f -n100 process-compose-${USER}.log"
working_dir: "/tmp"
date:
command: while true; do date && sleep 1; done
disabled: true
11 changes: 11 additions & 0 deletions src/tui/proc-table.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ func (pv *pcView) createProcTable() *tview.Table {
func (pv *pcView) updateTable(ctx context.Context) {
pv.appView.QueueUpdateDraw(func() {
pv.fillTableData()
pv.selectFirstEnabledProcess()
})
ticker := time.NewTicker(pv.refreshRate)
defer ticker.Stop()
Expand Down Expand Up @@ -447,3 +448,13 @@ func (pv *pcView) selectTableProcess(name string) {
}
}
}

func (pv *pcView) selectFirstEnabledProcess() {
for i := 1; i < pv.procTable.GetRowCount(); i++ {
status := pv.procTable.GetCell(i, int(ProcessStateStatus)).Text
if status != types.ProcessStateDisabled && status != types.ProcessStateForeground {
pv.procTable.Select(i, 1)
return
}
}
}

0 comments on commit 859f75b

Please sign in to comment.