Add flatpak support #1
33
pamac-url-handler
Normal file → Executable file
33
pamac-url-handler
Normal file → Executable file
|
@ -4,12 +4,31 @@
|
|||
# x-alpm-package://packagename
|
||||
# install: xdg-mime default pamac-url-handler.desktop x-scheme-handler/x-alpm-package
|
||||
|
||||
packagename="${1#x-alpm-package://}"
|
||||
echo "${packagename:0:4}"
|
||||
if [[ "aur/" == "${packagename:0:4}" ]]; then
|
||||
name="${packagename##*/}"
|
||||
pamac-installer --build "$name"
|
||||
exit 0
|
||||
if [ $# != 1 ] || [[ "$1" != 'x-alpm-package://'* ]]; then
|
||||
echo "Usage: $0 [URL]"
|
||||
exit 1
|
||||
fi
|
||||
pamac-installer "$packagename"
|
||||
|
||||
content="${1#x-alpm-package://}"
|
||||
|
||||
# AUR install
|
||||
if [[ "$content" == 'aur//'* ]]; then
|
||||
packagename="${content#aur//}"
|
||||
pamac-installer --build "$packagename"
|
||||
|
||||
# Flatpak install
|
||||
elif [[ "$content" == 'flatpak//'* ]]; then
|
||||
appID="${content#flatpak//}"
|
||||
info=$(flatpak remote-info flathub "$appID") || {
|
||||
yad --image 'dialog-error' --title 'Alert' --buttons-layout=center --text-align=center --button=yad-close --borders=10 --text "Flatpak ID not found:\n$appID"
|
||||
exit 1
|
||||
}
|
||||
yad --image 'dialog-question' --title 'Flatpak install' --button=Cancel:1 --button=Install:0 --text "$info" &&
|
||||
exo-open --launch TerminalEmulator \
|
||||
bash -c "flatpak install --assumeyes flathub $appID ; printf '\n'; read -n1 -rsp 'press any key to close window...'"
|
||||
|
||||
# Repo install
|
||||
else
|
||||
packagename=$content
|
||||
pamac-installer "$packagename"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue
Block a user