pacgtk

GUI wrapper for pacman
git clone git://git.kocotian.pl/pacboy.git
Log | Files | Refs | README | LICENSE

commit bf96ad04f3d71f8bdcdcfcb74aaf6d44af68212c
parent 9a46f89a8657946f541584a59992b1fc59e7687a
Author: kocotian <kocotian@kocotian.pl>
Date:   Wed,  6 Jan 2021 20:19:13 +0100

version 2.0: removing, checking updates; see CHANGELOG

Diffstat:
ACHANGELOG | 6++++++
Mlanguages/pl.diff | 32+++++++++++++++++++++++++-------
Mpacgtk | 155+++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------
3 files changed, 140 insertions(+), 53 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG @@ -0,0 +1,6 @@ +=> v2.0 ======================================================================= +- Huge rebuild - now on start you will have menu where you can choose searching + and removing programs, checking for updates and updating system. +- Checking available updates using checkupdates from community/pacman-contrib + (proposed by icar) +- Removing programs diff --git a/languages/pl.diff b/languages/pl.diff @@ -1,25 +1,43 @@ ---- a/pacboy 2021-01-05 20:00:30.258345261 +0100 -+++ b/pacboy 2021-01-05 20:10:27.950359466 +0100 -@@ -10,15 +10,15 @@ +--- a/pacgtk 2021-01-05 20:00:30.258345261 +0100 ++++ b/pacgtk 2021-01-05 20:10:27.950359466 +0100 +@@ -8,21 +8,21 @@ # Language things: --lang_text_updatesys="Update system?" +-lang_text_menu_searchprog="Search for programs" +-lang_text_menu_rmprog="Remove programs" +-lang_text_menu_updatecheck="Check updates" +-lang_text_menu_updatesys="Update system" +-lang_text_menu_exit="Exit" -lang_text_search="Write program name for search:" --lang_text_btn_updateonly="Update only" -lang_text_noresults="No results" +-lang_text_noupdates="No updates available" -lang_text_searchresults="Search results:" -lang_text_sr_name="Name" -lang_text_sr_version="Version" -lang_text_sr_description="Description" +-lang_text_availableupdates="Available updates" +-lang_text_uc_name="Name" +-lang_text_uc_versiondiff="Version difference" -lang_text_installationdone="Installation done." -lang_text_installationfailed="Installation failed." -+lang_text_updatesys="Zaktualizować system?" +-lang_text_removingdone="Removing done." +-lang_text_removingfailed="Removing failed." ++lang_text_menu_searchprog="Wyszukaj programy" ++lang_text_menu_rmprog="Usuń programy" ++lang_text_menu_updatecheck="Sprawdź aktualizacje" ++lang_text_menu_updatesys="Zaktualizuj system" ++lang_text_menu_exit="Wyjdź" +lang_text_search="Wpisz nazwę (lub opis) programu aby wyszukać:" -+lang_text_btn_updateonly="Tylko zaktualizuj" +lang_text_noresults="Brak wyników" ++lang_text_noupdates="Brak dostępnych aktualizacji" +lang_text_searchresults="Wyniki wyszukiwania:" +lang_text_sr_name="Nazwa" +lang_text_sr_version="Wersja" +lang_text_sr_description="Opis" ++lang_text_availableupdates="Dostępne aktualizacje" ++lang_text_uc_name="Nazwa" ++lang_text_uc_versiondiff="Różnica wersji" +lang_text_installationdone="Instalacja zakończona powodzeniem." +lang_text_installationfailed="Instalacja zakończona niepowodzeniem." ++lang_text_removingdone="Usuwanie zakończone powodzeniem." ++lang_text_removingfailed="Usuwanie zakończone niepowodzeniem." diff --git a/pacgtk b/pacgtk @@ -1,73 +1,136 @@ #!/bin/sh # pacgtk - GUI wrapper for pacman by kocotian # depends on yad and st. -# version 1.2.1-pre1 +# version 2.0 # Other configuration: termcommand="st -e" -pacflags="--noconfirm -S" -flagtype="default" # Language things: -lang_text_updatesys="Update system?" +lang_text_menu_searchprog="Search for programs" +lang_text_menu_rmprog="Remove programs" +lang_text_menu_updatecheck="Check updates" +lang_text_menu_updatesys="Update system" +lang_text_menu_exit="Exit" lang_text_search="Write program name for search:" -lang_text_btn_updateonly="Update only" lang_text_noresults="No results" +lang_text_noupdates="No updates available" lang_text_searchresults="Search results:" lang_text_sr_name="Name" lang_text_sr_version="Version" lang_text_sr_description="Description" +lang_text_availableupdates="Available updates" +lang_text_uc_name="Name" +lang_text_uc_versiondiff="Version difference" lang_text_installationdone="Installation done." lang_text_installationfailed="Installation failed." +lang_text_removingdone="Removing done." +lang_text_removingfailed="Removing failed." -# Main program: -yad --title "pacgtk" \ - --text "$lang_text_updatesys" \ - --button=yad-yes:0 --button=yad-no:1 \ - --width=200 --height=80 --center && { - pacflags="${pacflags} -yu" - flagtype="update" - } +# Functions: +pac() { + if $termcommand sudo pacman --noconfirm $@; then + yad --title "pacgtk" \ + --text "$lang_text_installationdone" \ + --button=yad-ok:0 \ + --center + else + yad --title "pacgtk" \ + --text "$lang_text_installationfailed" \ + --button=yad-ok:1 \ + --center + fi +} -[ $flagtype = update ] && additionalbtn="--button=$lang_text_btn_updateonly:2" -query="$(yad --title "pacgtk" \ +# 4 main functions: +searchprog() { + query=$(yad --title "pacgtk" \ --text "$lang_text_search" \ --entry --center \ --width=500 --height=100 \ - "$additionalbtn" \ --button=yad-cancel:1 \ - --button=yad-ok:0; exit $?)" -s=$? -if [ $s = 2 ]; then - flagtype="updateonly" -elif [ $s = 1 ]; then - exit 1 -fi + --button=yad-ok:0 || exit 1) || exit 1 -pkgs="$(pacman -Ss $query | sed "s/\\ /\\n/;s/^\\s*//g;/^$/d")" + pkgs="$(pacman -Ss $query | sed "s/\\ /\\n/;s/^\\s*//g;/^$/d")" -[ $(echo "$pkgs" | wc -l) = 1 ] && - yad --title "pacgtk" \ - --text "$lang_text_noresults" \ - --center && exit 0 + if [ $(echo "$pkgs" | wc -l) = 1 ]; then + yad --title "pacgtk" \ + --text "$lang_text_noresults" \ + --center && exit 1 + else + package="$(echo "$pkgs" | + yad --title "pacgtk" \ + --text "$lang_text_searchresults" \ + --list --maximized \ + --column "$lang_text_sr_name" \ + --column "$lang_text_sr_version" \ + --column "$lang_text_sr_description" || exit 1)" || exit 1 + fi || exit 1 + pac -S $(echo $package | cut -d"|" -f1) +} -[ $flagtype = "updateonly" ] || package="$(echo "$pkgs" | - yad --title "pacgtk" \ - --text "$lang_text_searchresults" \ - --list --maximized \ - --column "$lang_text_sr_name" \ - --column "$lang_text_sr_version" \ - --column "$lang_text_sr_description" || exit 1)" || exit 1 +rmprog() { + query=$(yad --title "pacgtk" \ + --text "$lang_text_search" \ + --entry --center \ + --width=500 --height=100 \ + --button=yad-cancel:1 \ + --button=yad-ok:0 || exit 1) || exit 1 -echo "DEBUG: sudo pacman $pacflags $(echo $package | cut -d"|" -f1)" -if $termcommand sudo pacman $pacflags $(echo $package | cut -d"|" -f1); then - yad --title "pacgtk" \ - --text "$lang_text_installationdone" \ - --button=yad-ok:0 \ - --center -else + pkgs="$(pacman -Qs $query | sed "s/\\ /\\n/;s/^\\s*//g;/^$/d")" + + if [ $(echo "$pkgs" | wc -l) = 1 ]; then + yad --title "pacgtk" \ + --text "$lang_text_noresults" \ + --center && exit 1 + else + package="$(echo "$pkgs" | + yad --title "pacgtk" \ + --text "$lang_text_packages" \ + --list --maximized \ + --column "$lang_text_sr_name" \ + --column "$lang_text_sr_version" \ + --column "$lang_text_sr_description" || exit 1)" || exit 1 + fi || exit 1 + pac -Rs $(echo $package | cut -d"|" -f1) +} + +updatecheck() { + pkgs="$(checkupdates | sed "s/\\ /\\n/;s/^\\s*//g;/^$/d")" + + if [ $(echo "$pkgs" | wc -l) = 1 ]; then + yad --title "pacgtk" \ + --text "$lang_text_noupdates" \ + --center && exit 1 + else + package="$(echo "$pkgs" | + yad --title "pacgtk" \ + --text "$lang_text_availableupdates" \ + --list --maximized \ + --column "$lang_text_uc_name" \ + --column "$lang_text_uc_versiondiff" || exit 1)" || exit 1 + fi || exit 1 +} + +updatesys() { + pac -Syu +} + +# Main loop: +while true; do yad --title "pacgtk" \ - --text "$lang_text_installationfailed" \ - --button=yad-ok:1 \ - --center -fi + --text="Choose activity:" \ + --center \ + --button="$lang_text_menu_searchprog":1 \ + --button="$lang_text_menu_rmprog":2 \ + --button="$lang_text_menu_updatecheck":3 \ + --button="$lang_text_menu_updatesys":4 \ + --button="$lang_text_menu_exit":0 && break + R=$? + case $R in + 1) searchprog ;; + 2) rmprog ;; + 3) updatecheck ;; + 4) updatesys ;; + esac +done