- System tray (Linux): pure Go D-Bus StatusNotifierItem, no cgo/libappindicator. Close now offers Minimize to Tray vs Quit instead of always quitting. - New APK Installer module: batch-install from a folder or hand-picked files, live per-file progress, select all/none. - Fix Packages/App Inspector silently hiding packages disabled/uninstalled by Canta/Shizuku (pm list packages needs -u to see them). Added a state filter and per-row Restore/Enable/Disable/Uninstall actions. - 6 new theme palettes (Nord, Tokyo Night, Solarized Dark/Light, Rosé Pine, Everforest - 26 total), custom text colour, 8 bundled display fonts, adjustable font size. - Horizontal sidebar now shrinks label text progressively instead of scrolling when the window narrows; fixed a touchpad stuck-scrollbar-drag bug. - Updated README and fixed stale Go 1.23 -> 1.25 build instructions.
122 lines
3.1 KiB
Go
122 lines
3.1 KiB
Go
package main
|
|
|
|
import (
|
|
"github.com/ncruces/zenity"
|
|
)
|
|
|
|
// SelectFileForPush opens a native file picker for choosing a file to push.
|
|
func (a *App) SelectFileForPush() (string, error) {
|
|
path, err := zenity.SelectFile(
|
|
zenity.Title("Select file to push to device"),
|
|
)
|
|
if err == zenity.ErrCanceled {
|
|
return "", nil
|
|
}
|
|
return path, err
|
|
}
|
|
|
|
// SelectFileForInstall opens a file picker filtered to APK files.
|
|
func (a *App) SelectFileForInstall() (string, error) {
|
|
path, err := zenity.SelectFile(
|
|
zenity.Title("Select APK to install"),
|
|
zenity.FileFilters{
|
|
{Name: "APK files", Patterns: []string{"*.apk"}, CaseFold: true},
|
|
{Name: "All files", Patterns: []string{"*"}},
|
|
},
|
|
)
|
|
if err == zenity.ErrCanceled {
|
|
return "", nil
|
|
}
|
|
return path, err
|
|
}
|
|
|
|
// SelectFileForFlash opens a file picker for image files (for fastboot flash).
|
|
func (a *App) SelectFileForFlash() (string, error) {
|
|
path, err := zenity.SelectFile(
|
|
zenity.Title("Select image to flash"),
|
|
zenity.FileFilters{
|
|
{Name: "Image files", Patterns: []string{"*.img", "*.zip", "*.bin"}, CaseFold: true},
|
|
{Name: "All files", Patterns: []string{"*"}},
|
|
},
|
|
)
|
|
if err == zenity.ErrCanceled {
|
|
return "", nil
|
|
}
|
|
return path, err
|
|
}
|
|
|
|
// SelectSaveFile opens a native save-as dialog.
|
|
func (a *App) SelectSaveFile(defaultName string) (string, error) {
|
|
path, err := zenity.SelectFileSave(
|
|
zenity.Title("Save as"),
|
|
zenity.Filename(defaultName),
|
|
)
|
|
if err == zenity.ErrCanceled {
|
|
return "", nil
|
|
}
|
|
return path, err
|
|
}
|
|
|
|
// SelectAnyFile opens a native file picker with no type filter.
|
|
func (a *App) SelectAnyFile() (string, error) {
|
|
path, err := zenity.SelectFile(zenity.Title("Select a file"))
|
|
if err == zenity.ErrCanceled {
|
|
return "", nil
|
|
}
|
|
return path, err
|
|
}
|
|
|
|
// SelectDirectoryForPull opens a native directory picker.
|
|
func (a *App) SelectDirectoryForPull() (string, error) {
|
|
path, err := zenity.SelectFile(
|
|
zenity.Title("Select destination folder"),
|
|
zenity.Directory(),
|
|
)
|
|
if err == zenity.ErrCanceled {
|
|
return "", nil
|
|
}
|
|
return path, err
|
|
}
|
|
|
|
// SelectApkFolder opens a native directory picker for a folder of APKs to
|
|
// batch-install.
|
|
func (a *App) SelectApkFolder() (string, error) {
|
|
path, err := zenity.SelectFile(
|
|
zenity.Title("Select a folder of APKs"),
|
|
zenity.Directory(),
|
|
)
|
|
if err == zenity.ErrCanceled {
|
|
return "", nil
|
|
}
|
|
return path, err
|
|
}
|
|
|
|
// SelectMultipleApkFiles opens a native multi-file picker filtered to APKs.
|
|
func (a *App) SelectMultipleApkFiles() ([]string, error) {
|
|
paths, err := zenity.SelectFileMultiple(
|
|
zenity.Title("Select APKs to install"),
|
|
zenity.FileFilters{
|
|
{Name: "APK files", Patterns: []string{"*.apk"}, CaseFold: true},
|
|
},
|
|
)
|
|
if err == zenity.ErrCanceled {
|
|
return nil, nil
|
|
}
|
|
return paths, err
|
|
}
|
|
|
|
// SelectFileWithFilter opens a file picker with custom file type filters.
|
|
func (a *App) SelectFileWithFilter(title string, patterns []string) (string, error) {
|
|
filters := []zenity.FileFilter{
|
|
{Name: "Matching files", Patterns: patterns, CaseFold: true},
|
|
{Name: "All files", Patterns: []string{"*"}},
|
|
}
|
|
path, err := zenity.SelectFile(
|
|
zenity.Title(title),
|
|
zenity.FileFilters(filters),
|
|
)
|
|
if err == zenity.ErrCanceled {
|
|
return "", nil
|
|
}
|
|
return path, err
|
|
}
|