From 51266b4612a808cbd348609b194ec2e5f2c5da2e Mon Sep 17 00:00:00 2001 From: lemniskett Date: Tue, 15 Dec 2020 14:11:47 +0700 Subject: [PATCH] Add desktop entry manager. --- archbox-desktop.bash | 43 +++++++++++++++++++++++++++++++++++++++++++ archbox.bash | 2 +- install.sh | 1 + 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100755 archbox-desktop.bash diff --git a/archbox-desktop.bash b/archbox-desktop.bash new file mode 100755 index 0000000..8a2f277 --- /dev/null +++ b/archbox-desktop.bash @@ -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 + +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 \ No newline at end of file diff --git a/archbox.bash b/archbox.bash index faf908a..88f1dc1 100755 --- a/archbox.bash +++ b/archbox.bash @@ -27,7 +27,7 @@ OPTIONS: -c, --create URL Creates a chroot enviroment. -e, --enter Enters chroot enviroment. -h, --help Displays this help message. - --remount-run Remount /run in chroot enviroment. + --remount-run Remount /run in chroot enviroment. EOF } diff --git a/install.sh b/install.sh index 790c36b..71cfe96 100755 --- a/install.sh +++ b/install.sh @@ -2,6 +2,7 @@ mkdir -p /usr/local/share/archbox/bin 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 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