Deteksi aplikasi terminal (CLI/TUI) + perbaikan shortcut lazydocker

- internal/shortcut/terminal.go: RunsInTerminal() menebak dari library dinamis
  (tanpa lib GUI = aplikasi terminal); script selalu true, .exe wine false
- checkbox 'Run in a terminal window' kini muncul untuk semua executable, bukan
  hanya script, dan terisi otomatis saat berkas dipilih
- dialog edit: kalau entri lama belum menyalakan Terminal padahal aplikasinya
  CLI/TUI, muncul catatan kecil sebagai petunjuk
- tes: script/.exe/binary CLI (test binary)/binary GUI (helium)/lazydocker nyata
- kasus nyata: lazydocker & docker-dash terpasang Terminal=false -> TUI gagal
  ('open /dev/tty: no such device or address'); dengan Terminal=true TUI jalan
This commit is contained in:
oxpoe committed 2026-10-13 10:34:05 +07:00
1 parent 35e83dba09
commit 63869e9158
7 files changed
+180 -18

No files matched your search

+3 -8
View File
@@ -41,19 +41,14 @@ func (ui *app) showExecutableDialog() {
desktop := widget.NewCheck(T("check_desktop"), nil)
desktop.SetChecked(true)
terminal := widget.NewCheck(T("check_terminal"), nil)
terminal.Hide() // hanya relevan untuk script
browseBin := newButton(T("browse"), theme.FolderOpenIcon(), T("tip_browse"), widget.MediumImportance, func() {
pickFile(ui.win, nil, func(path string) {
binPath = path
binLabel.SetText(filepath.Base(path) + " · " + detectedKind(path))
// terminal hanya perlu untuk script; tampilkan kalau terdeteksi
if shortcut.DetectKind(path) == shortcut.KindScript {
terminal.Show()
} else {
terminal.SetChecked(false)
terminal.Hide()
}
// aplikasi terminal (TUI/CLI/script) perlu Terminal=true;
// tebakannya dari library yang dipakai binary
terminal.SetChecked(shortcut.RunsInTerminal(path))
if strings.TrimSpace(nameEntry.Text) == "" {
nameEntry.SetText(appNameFromFile(path))
}