#!/usr/bin/env python3

#Copyright 2025 mycophobia. Licensed under the GNU GPL version 3. A copy can be found enclosed with the source code, or here:
#https://www.gnu.org/licenses/gpl-3.0.en.html

from autogui import *

remover = "appmanager_uninstall"
desktopcheck = "appmanager_checkifdesktop"
updatecmd = 'sudo apt update && sudo apt-file update && appmanager_getdesktoplist && sudo apt dist-upgrade'

command = ''

update = Mode(updatecmd, "Update system")
install = Mode("sudo apt install", "Install application")
remove = Mode(remover, "Remove application")
search = Mode(desktopcheck, "Search for application")
show = Mode("apt-cache show", "Show information")
installbar = Parameter('','','Package name', ["sudo apt install"])
removebar = Parameter('','','Click then drag and drop application from menu',[remover], True)
searchbar = Parameter('','','Search terms', [desktopcheck, "apt-cache show"])
widgets = [update, None, None, install, installbar, remove, removebar, search, show, searchbar]
runapp(command, widgets, 'AppManager')
