LazyRun v1.0.0: shortcut maker untuk executable dan PWA
- Fungsi A: shortcut dari file executable (ELF/AppImage/script) - Fungsi B: shortcut PWA/URL dengan deteksi browser (native, /opt, Flatpak) - Checkbox Menu Aplikasi / Desktop, desktop-only pakai NoDisplay=true - List + uninstall + deteksi shortcut yang file .desktop-nya hilang - Metadata ~/.config/lazyrun/shortcuts.json, refresh cache XDG/KDE - AppImage + zsync update info via build.sh
This commit is contained in:
1 parent
9cd5a1f82d
commit
da31f7d7d7
31 files changed
+2916
No files matched your search
@@ -0,0 +1,41 @@
|
||||
package shortcut
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
|
||||
"lazyrun/internal/store"
|
||||
)
|
||||
|
||||
// RemoveOptions mengatur apa saja yang ikut dihapus saat uninstall.
|
||||
type RemoveOptions struct {
|
||||
// Binary true = binary hasil salinan di ~/.local/bin juga dihapus.
|
||||
Binary bool
|
||||
}
|
||||
|
||||
// Uninstall menghapus .desktop (menu + desktop), ikon, dan opsional binary.
|
||||
func Uninstall(sc store.Shortcut, o RemoveOptions) error {
|
||||
var errs []error
|
||||
|
||||
for _, path := range []string{sc.DesktopCopyPath, sc.DesktopPath} {
|
||||
if path == "" {
|
||||
continue
|
||||
}
|
||||
if err := os.Remove(path); err != nil && !os.IsNotExist(err) {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
if sc.IconPath != "" {
|
||||
if err := os.Remove(sc.IconPath); err != nil && !os.IsNotExist(err) {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
if o.Binary && sc.Type == store.TypeExecutable && sc.BinaryPath != "" {
|
||||
if err := os.Remove(sc.BinaryPath); err != nil && !os.IsNotExist(err) {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
go RefreshCache()
|
||||
return errors.Join(errs...)
|
||||
}
|
||||
Reference in new issue
Block a user