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
|
# x-alpm-package://packagename
|
||||||
# install: xdg-mime default pamac-url-handler.desktop x-scheme-handler/x-alpm-package
|
# install: xdg-mime default pamac-url-handler.desktop x-scheme-handler/x-alpm-package
|
||||||
|
|
||||||
packagename="${1#x-alpm-package://}"
|
if [ $# != 1 ] || [[ "$1" != 'x-alpm-package://'* ]]; then
|
||||||
echo "${packagename:0:4}"
|
echo "Usage: $0 [URL]"
|
||||||
if [[ "aur/" == "${packagename:0:4}" ]]; then
|
exit 1
|
||||||
name="${packagename##*/}"
|
|
||||||
pamac-installer --build "$name"
|
|
||||||
exit 0
|
|
||||||
fi
|
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