Add desktop entry manager.

This commit is contained in:
lemniskett 2020-12-15 14:11:47 +07:00
parent f0c8980eef
commit 51266b4612
3 changed files with 45 additions and 1 deletions

43
archbox-desktop.bash Executable file
View File

@ -0,0 +1,43 @@
#!/bin/bash
source /etc/archbox.conf
install_desktop(){
mkdir -p ~/.local/share/applications/archbox
for i in $@; do
archbox readlink /usr/share/applications/$i >/dev/null 2>&1 \
&& cp $CHROOT/$(archbox readlink /usr/share/applications/$i) ~/.local/share/applications/archbox \
|| cp $CHROOT/usr/share/applications/$i ~/.local/share/applications/archbox
sed -i 's/Exec=/Exec=archbox\ /g' ~/.local/share/applications/archbox/$i
done
}
help_text(){
cat << EOF
USAGE: $0 <arguments>
OPTIONS:
-i, --install URL Installs a desktop entry in /usr/share/applications
-h, --help Displays this help message
EOF
}
case $1 in
-i|--install)
install_desktop ${@:2}
;;
-h|--help)
help_text
;;
*)
list_desktop="$(archbox ls --color=none -1 /usr/share/applications)"
zenity_entry="$(echo $list_desktop | sed 's/\ /\ FALSE\ /g')"
selected_entry=$(zenity --list --checklist --height=500 --width=450 \
--title="Archbox Desktop Manager" \
--text "Select .desktop entries those you want to install" \
--column "Select" --column "Applications" \
FALSE $zenity_entry | sed 's/|/\ /g')
install_desktop $selected_entry
;;
esac

View File

@ -2,6 +2,7 @@
mkdir -p /usr/local/share/archbox/bin mkdir -p /usr/local/share/archbox/bin
install -v -D -m 755 ./archbox.bash /usr/local/bin/archbox install -v -D -m 755 ./archbox.bash /usr/local/bin/archbox
install -v -D -m 755 ./archbox-desktop.bash /usr/local/bin/archbox-desktop
[[ ! -e /etc/archbox.conf ]] && install -v -D -m 755 ./archbox.conf /etc/archbox.conf [[ ! -e /etc/archbox.conf ]] && install -v -D -m 755 ./archbox.conf /etc/archbox.conf
install -v -D -m 755 ./copyresolv.bash /usr/local/share/archbox/bin/copyresolv install -v -D -m 755 ./copyresolv.bash /usr/local/share/archbox/bin/copyresolv
install -v -D -m 755 ./archboxcommand.bash /usr/local/share/archbox/bin/archbox install -v -D -m 755 ./archboxcommand.bash /usr/local/share/archbox/bin/archbox