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:
1 parent
35e83dba09
commit
63869e9158
7 files changed
+180
-18
No files matched your search
@@ -100,9 +100,6 @@ func (ui *app) showEditDialog(sc store.Shortcut) {
|
||||
desktopChk.SetChecked(sc.Targets.Desktop)
|
||||
terminal := widget.NewCheck(T("check_terminal"), nil)
|
||||
terminal.SetChecked(sc.Terminal)
|
||||
if sc.Kind != shortcut.KindScript {
|
||||
terminal.Hide()
|
||||
}
|
||||
|
||||
browseIcon := newButton(T("browse"), theme.FolderOpenIcon(), T("tip_browse"), widget.MediumImportance, func() {
|
||||
pickFile(ui.win, imageFilter, func(path string) {
|
||||
@@ -123,12 +120,7 @@ func (ui *app) showEditDialog(sc store.Shortcut) {
|
||||
pickFile(ui.win, nil, func(path string) {
|
||||
binPath = path
|
||||
binLabel.SetText(filepath.Base(path) + " · " + detectedKind(path))
|
||||
if shortcut.DetectKind(path) == shortcut.KindScript {
|
||||
terminal.Show()
|
||||
} else {
|
||||
terminal.SetChecked(false)
|
||||
terminal.Hide()
|
||||
}
|
||||
terminal.SetChecked(shortcut.RunsInTerminal(path))
|
||||
})
|
||||
})
|
||||
category := widget.NewSelect(categories, nil)
|
||||
@@ -220,6 +212,12 @@ func (ui *app) showEditDialog(sc store.Shortcut) {
|
||||
})
|
||||
|
||||
hint := textLine(T("edit_hint"), 12, false, colorNameMuted)
|
||||
|
||||
// beberapa entri lama belum menyalakan Terminal walau aplikasinya CLI/TUI
|
||||
terminalSuggest := container.NewVBox()
|
||||
if !sc.Terminal && shortcut.RunsInTerminal(sc.BinaryPath) {
|
||||
terminalSuggest.Add(textLine(T("terminal_suggest"), 12, false, colorNameChipDesk))
|
||||
}
|
||||
content := container.NewVScroll(container.NewVBox(
|
||||
closeRow(func() { d.Hide() }),
|
||||
widget.NewForm(items...),
|
||||
@@ -228,6 +226,7 @@ func (ui *app) showEditDialog(sc store.Shortcut) {
|
||||
menu,
|
||||
desktopChk,
|
||||
terminal,
|
||||
terminalSuggest,
|
||||
hint,
|
||||
container.NewHBox(logoBox(newLogo(), 20), spacer(),
|
||||
newButton(T("cancel"), nil, T("tip_cancel"), widget.MediumImportance, func() { d.Hide() }),
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
@@ -49,7 +49,8 @@ var tr = map[string][2]string{
|
||||
"section_location": {"Shortcut location", "Lokasi shortcut"},
|
||||
"check_menu": {"Application menu", "Menu aplikasi"},
|
||||
"check_desktop": {"Desktop", "Desktop"},
|
||||
"check_terminal": {"Run in a terminal window (scripts)", "Jalankan di jendela terminal (script)"},
|
||||
"check_terminal": {"Run in a terminal window (CLI/TUI apps)", "Jalankan di jendela terminal (aplikasi CLI/TUI)"},
|
||||
"terminal_suggest": {"This looks like a terminal app - tick the box above if it closes right away.", "Ini kelihatan aplikasi terminal - centang kotak di atas kalau menutup begitu saja."},
|
||||
"exec_hint": {"The binary is copied to ~/.local/bin and can be uninstalled from the list.", "Binary disalin ke ~/.local/bin dan bisa dihapus lagi dari daftar."},
|
||||
"web_hint": {"The icon comes from the site's favicon, or is looked up online if there is none.", "Ikon diambil dari favicon situs, atau dicari otomatis di internet kalau tidak ada."},
|
||||
|
||||
|
||||
Reference in new issue
Block a user