pacboy

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

commit f0e0c06394f738f233d043c50224ca946323c626
Author: kocotian <kocotian@kocotian.pl>
Date:   Tue,  5 Jan 2021 19:52:36 +0100

initial commit; v1.0

Diffstat:
AMakefile | 4++++
Apacboy | 80+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apacboy.desktop | 10++++++++++
3 files changed, 94 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile @@ -0,0 +1,4 @@ +PREFIX=/usr/local +install: pacboy + install -Dm 755 pacboy ${PREFIX}/bin/ + install -Dm 755 pacboy.desktop ${PREFIX}/share/applications/ diff --git a/pacboy b/pacboy @@ -0,0 +1,80 @@ +#!/bin/sh +# pacboy - GUI pacman wrapper by kocotian +# depends on yad and st. + +# Other configuration: +termcommand="st -e" +pacflags="--noconfirm -S" +flagtype="default" + +# Language things: +lang_text_updatesys="Update system?" +lang_text_downloadfresh="Download fresh package lists?" +lang_text_search="Write program name for search:" +lang_text_btn_updateonly="Update only" +lang_text_noresults="No results" +lang_text_searchresults="Search results:" +lang_text_sr_name="Name" +lang_text_sr_version="Version" +lang_text_sr_description="Description" + +# Delete this line if you are sure that you installed yad and you don't +# need checking this: +[ "pacman -Q yad 2>/dev/null | wc -l" = "0" ] && pacman -Sy --noconfirm yad + +# Main program: +yad --title "pacboy" \ + --text "$lang_text_updatesys" \ + --button=yad-yes:0 --button=yad-no:1 \ + --width=200 --height=80 --center && { + pacflags="${pacflags} -yu" + flagtype="update" + } || { + yad --title "pacboy" \ + --text "$lang_text_downloadfresh" \ + --button=yad-yes:0 --button=yad-no:1 \ + --width=200 --height=80 --center && { + pacflags="${pacflags} -y" + flagtype="freshsync" + } + } + +query="$(if [ $flagtype = update ]; then # TODO: make this in less bloated way + yad --title "pacboy" \ + --text "$lang_text_search" \ + --entry --center \ + --width=500 --height=100 \ + --button="$lang_text_btn_updateonly":2 \ + --button=yad-cancel:1 \ + --button=yad-ok:0 +else + yad --title "pacboy" \ + --text "$lang_text_search" \ + --entry --center \ + --width=500 --height=100 \ + --button=yad-cancel:1 \ + --button=yad-ok:0 +fi; exit $?)" +s=$? +if [ $s = 2 ]; then + flagtype="updateonly" +elif [ $s = 1 ]; then + exit 1 +fi + +pkgs="$(pacman -Ss $query | sed "s/\\ /\\n/;s/^\\s*//g;/^$/d")" + +[ $(echo "$pkgs" | wc -l) = 1 ] && + yad --title "pacboy" \ + --text "$lang_text_noresults" \ + --center && exit 0 + +[ $flagtype = "updateonly" ] || package="$(echo "$pkgs" | + yad --title "pacboy" \ + --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 + +$termcommand sudo pacman $pacflags $(echo $package | cut -d"|" -f1) diff --git a/pacboy.desktop b/pacboy.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Exec=pacboy +Name=pacboy +Comment=GUI wrapper for pacman by kocotian +Terminal=false +Type=Application +Encoding=UTF-8 +Keywords=pacman;pacboy;package;manager;yad;st; +#Icon= +#Categories=