mabox-pipemenus/usr/bin/mabox-software-pipemenu

136 lines
4.3 KiB
Bash
Executable File

#!/bin/bash
# mabox-software-pipemenu - an Openbox pipemenu to manage software updates, install popular applications, etc.
MB_COMMON_LIBDIR="/usr/lib/mabox/mabox-common"
if ! . "$MB_COMMON_LIBDIR/mabox-include.cfg" 2> /dev/null; then
echo $"Error: Failed to locate mabox-include.cfg in $MB_COMMON_LIBDIR" >&2
exit 1
fi
case $LANG in
pl*)
SYSUPDATE="Aktualizacja systemu"
MIRR_RANK="Ranking mirrorów"
MIRROR_RANK="Tworzenie rankingu mirrorów"
RENEWKEYS="Odnawianie kluczy"
ALL="Wszystkie"
GEOIP="Najbliższe (wg geoip)"
SOFT_MANAGEMENT="Zarządzanie oprogramowaniem"
POPULAR_APPS="Popularne programy"
INSTALL="Instaluj"
INSTALLING="Instalowanie"
LAUNCH="Uruchom"
GRAPHICS="Grafika"
GAMES="Gry"
OFFICE="Biuro"
REG_MENU="Regeneruj Menu"
;;
*)
SYSUPDATE="System update"
MIRR_RANK="Rank mirrors"
MIRROR_RANK="Create mirror rank"
ALL="All"
GEOIP="by geoip"
RENEWKEYS="Renew keys"
SOFT_MANAGEMENT="Software Management"
POPULAR_APPS="Applications"
INSTALL="Install"
INSTALLING="Installing"
LAUNCH="Launch"
GRAPHICS="Graphics"
GAMES="Games"
OFFICE="Office"
REG_MENU="Regenerate Menu"
;;
esac
if [[ $1 = '--update' ]]; then
terminator --title="$SYSUPDATE" --command='sudo pacman -Syu'
elif [[ $1 = '--rank-all' ]]; then
terminator --title="$MIRROR_RANK" --command='sudo pacman-mirrors -i -c all'
elif [[ $1 = '--rank-geoip' ]]; then
terminator --title="$MIRROR_RANK" --command='sudo pacman-mirrors -i --geoip'
elif [[ $1 = '--fixkeys' ]]; then
terminator --title="$RENEWKEYS" --command='sudo pacman -Sy archlinux-keyring manjaro-keyring mabox-keyring'
else
menuStart
menuSeparator "$SOFT_MANAGEMENT"
menuItem "$SYSUPDATE" "mabox-software-pipemenu --update"
menuSubmenu 'rank' "$MIRR_RANK"
menuItem "$ALL" "mabox-software-pipemenu --rank-all"
menuItem "$GEOIP" "mabox-software-pipemenu --rank-geoip"
menuSubmenuEnd
menuItem "$RENEWKEYS" "mabox-software-pipemenu --fixkeys"
menuSeparator "$POPULAR_APPS"
menuSubmenu 'internet' 'Internet'
internet=('chromium' 'firefox' 'opera' 'thunderbird' 'dropbox')
for curApp in "${internet[@]}"; do
if ! type "$curApp" &> /dev/null; then
menuItem "$INSTALL ${curApp^}" "terminator --title='$INSTALLING ${curApp^}' --command='sudo pacman -S $curApp'"
else
menuItem "$LAUNCH ${curApp^}" "$curApp"
fi
done
menuSubmenuEnd
menuSubmenu 'multimedia' 'Multimedia'
multimedia=('kodi' 'audacious' 'vlc' 'smplayer' 'simplescreenrecorder')
for curApp in "${multimedia[@]}"; do
if ! type "$curApp" &> /dev/null; then
menuItem "$INSTALL ${curApp^}" "terminator --title='$INSTALLING ${curApp^}' --command='sudo pacman -S $curApp'"
else
menuItem "$LAUNCH ${curApp^}" "$curApp"
fi
done
menuSubmenuEnd
menuSubmenu 'grafika' "$GRAPHICS"
grafika=('gimp' 'inkscape' 'blender')
for curApp in "${grafika[@]}"; do
if ! type "$curApp" &> /dev/null; then
menuItem "$INSTALL ${curApp^}" "terminator --title='$INSTALLING ${curApp^}' --command='sudo pacman -S $curApp'"
else
menuItem "$LAUNCH ${curApp^}" "$curApp"
fi
done
menuSubmenuEnd
menuSubmenu 'gry' "$GAMES"
gry=('playonlinux' 'steam-manjaro' 'wesnoth')
for curApp in "${gry[@]}"; do
if ! type "$curApp" &> /dev/null; then
menuItem "$INSTALL ${curApp^}" "terminator --title='$INSTALLING ${curApp^}' --command='sudo pacman -S $curApp'"
else
menuItem "$LAUNCH ${curApp^}" "$curApp"
fi
done
menuSubmenuEnd
menuSubmenu 'system' "System"
system=('manjaro-printer' 'bleachbit' 'virtualbox')
for curApp in "${system[@]}"; do
if ! type "$curApp" &> /dev/null; then
menuItem "$INSTALL ${curApp^}" "terminator --title='$INSTALLING ${curApp^}' --command='sudo pacman -S $curApp'"
else
menuItem "$LAUNCH ${curApp^}" "$curApp"
fi
done
menuSubmenuEnd
menuSubmenu 'office' "$OFFICE"
system=('abiword' 'gnumeric' 'libreoffice-still' 'libreoffice-fresh' 'cherrytree' 'zim')
for curApp in "${system[@]}"; do
if ! type "$curApp" &> /dev/null; then
menuItem "$INSTALL ${curApp^}" "terminator --title='$INSTALLING ${curApp^}' --command='sudo pacman -S $curApp'"
else
menuItem "$LAUNCH ${curApp^}" "$curApp"
fi
done
menuSubmenuEnd
menuSeparator
menuItem "$REG_MENU" "mb-regenerate-menu"
menuEnd
fi
exit 0