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,54 @@
|
||||
// Package xdg menghitung path XDG yang dipakai LazyRun.
|
||||
package xdg
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func home() string {
|
||||
h, _ := os.UserHomeDir()
|
||||
return h
|
||||
}
|
||||
|
||||
func dataHome() string {
|
||||
if v := os.Getenv("XDG_DATA_HOME"); v != "" {
|
||||
return v
|
||||
}
|
||||
return filepath.Join(home(), ".local", "share")
|
||||
}
|
||||
|
||||
func configHome() string {
|
||||
if v := os.Getenv("XDG_CONFIG_HOME"); v != "" {
|
||||
return v
|
||||
}
|
||||
return filepath.Join(home(), ".config")
|
||||
}
|
||||
|
||||
// BinDir adalah lokasi binary target setelah di-install.
|
||||
func BinDir() string { return filepath.Join(home(), ".local", "bin") }
|
||||
|
||||
// ApplicationsDir menampung file .desktop untuk menu aplikasi.
|
||||
func ApplicationsDir() string { return filepath.Join(dataHome(), "applications") }
|
||||
|
||||
// IconsDir adalah direktori ikon aplikasi XDG.
|
||||
func IconsDir() string {
|
||||
return filepath.Join(dataHome(), "icons", "hicolor", "512x512", "apps")
|
||||
}
|
||||
|
||||
// DesktopDir mengikuti xdg-user-dir, fallback ke ~/Desktop.
|
||||
func DesktopDir() string {
|
||||
if out, err := exec.Command("xdg-user-dir", "DESKTOP").Output(); err == nil {
|
||||
if p := strings.TrimSpace(string(out)); p != "" {
|
||||
return p
|
||||
}
|
||||
}
|
||||
return filepath.Join(home(), "Desktop")
|
||||
}
|
||||
|
||||
// MetadataPath adalah file daftar shortcut milik LazyRun.
|
||||
func MetadataPath() string {
|
||||
return filepath.Join(configHome(), "lazyrun", "shortcuts.json")
|
||||
}
|
||||
Reference in new issue
Block a user