From f35c6058824c6b22764dcd2842e70b516356c337 Mon Sep 17 00:00:00 2001 From: Marshall Banana Date: Tue, 8 Mar 2016 02:03:36 +0100 Subject: [PATCH 1/4] new package: screenfetch --- screenfetch/PKGBUILD | 37 ++++++ screenfetch/msys2.patch | 268 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 305 insertions(+) create mode 100644 screenfetch/PKGBUILD create mode 100644 screenfetch/msys2.patch diff --git a/screenfetch/PKGBUILD b/screenfetch/PKGBUILD new file mode 100644 index 00000000..8b593faa --- /dev/null +++ b/screenfetch/PKGBUILD @@ -0,0 +1,37 @@ +# Maintainer: Alexey Pavlov + +pkgname=screenfetch +_pkgname=screenFetch +pkgver=3.7.0 +pkgrel=1 +pkgdesc="Bash screenshot information tool" +arch=('any') +url="https://github.com/KittyKatt/screenFetch" +license=('GPL') +depends=('bash') +#optdepends=('scrot: screenshot taking' +# 'curl: screenshot uploading') +source=(https://github.com/KittyKatt/${_pkgname}/archive/v${pkgver}.tar.gz + msys2.patch) +sha256sums=('6711fe924833919d53c1dfbbb43f3777d33e20357a1b1536c4472f6a1b3c6be0' + '727d646199dd35cfe217725f8359a63f3a02797dc5eb57c9133b19ab0708e9c0') + +prepare() { + cd "${srcdir}/${_pkgname}-${pkgver}" + patch -p1 -i ${srcdir}/msys2.patch +} + +build() { + cd "${srcdir}/${_pkgname}-${pkgver}" + ./update-manpage.sh +} + +package() { + cd "${srcdir}/${_pkgname}-${pkgver}" + install -Dm755 screenfetch-dev "${pkgdir}/usr/bin/screenfetch" + install -Dm644 screenfetch.1 "${pkgdir}/usr/share/man/man1/screenfetch.1" + install -Dm644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/COPYING" + install -Dm644 CHANGELOG "${pkgdir}/usr/share/doc/${pkgname}/CHANGELOG" + install -Dm644 README.mkdn "${pkgdir}/usr/share/doc/${pkgname}/README.mkdn" + install -Dm644 TODO "${pkgdir}/usr/share/doc/${pkgname}/TODO" +} diff --git a/screenfetch/msys2.patch b/screenfetch/msys2.patch new file mode 100644 index 00000000..4f8f4137 --- /dev/null +++ b/screenfetch/msys2.patch @@ -0,0 +1,268 @@ + - support Msys2 + - show exact release version on Windows 10 + - use modern logo on Windows 8, 10 and their server equivalents + +--- a/screenfetch-dev ++++ b/screenfetch-dev +@@ -190,7 +190,7 @@ + } + + supported_distros="Antergos, Arch Linux (Old and Current Logos), BLAG, CentOS, Chakra, Chapeau, CrunchBang, CRUX, Debian, Deepin, Dragora, elementary OS, Evolve OS, Fedora, Frugalware, Fuduntu, Funtoo, Gentoo, gNewSense, Jiyuu Linux, Kali Linux, KaOS, Korora, LinuxDeepin, Linux Mint, LMDE, Logos, Mageia, Mandriva/Mandrake, Manjaro, NixOS, openSUSE, Parabola GNU/Linux-libre, PeppermintOS, Raspbian, Red Hat Enterprise Linux, Sabayon, Scientific Linux, Slackware, Solus, TinyCore, Trisquel, Ubuntu, Viperr and Void." +-supported_other="Dragonfly/Free/Open/Net BSD, Haiku, Mac OS X and Windows+Cygwin." ++supported_other="Dragonfly/Free/Open/Net BSD, Haiku, Mac OS X, Windows+Cygwin and Windows+Msys." + supported_dms="KDE, Gnome, Unity, Xfce, LXDE, Cinnamon, MATE, CDE and RazorQt." + supported_wms="2bwm, 9wm, Awesome, Beryl, Blackbox, Cinnamon, Compiz, dminiwm, dwm, dtwm, E16, E17, echinus, Emerald, FluxBox, FVWM, herbstluftwm, IceWM, KWin, Metacity, monsterwm, Musca, Gala, Mutter, Muffin, Notion, OpenBox, PekWM, Ratpoison, Sawfish, ScrotWM, SpectrWM, StumpWM, subtle, WindowMaker, WMFS, wmii, Xfwm4, XMonad and i3." + +@@ -519,6 +519,11 @@ + distro="Cygwin" + fake_distro="${distro}" + ;; ++ "Msys") ++ distro="Msys" ++ fake_distro="${distro}" ++ distro_more="$(uname -r | head -c 1)" ++ ;; + "Haiku") + distro="Haiku" + fake_distro="${distro}" +@@ -535,6 +539,12 @@ + ;; + esac + fi ++ if [[ "${distro}" == "Cygwin" || "${distro}" == "Msys" ]]; then ++ # https://msdn.microsoft.com/en-us/library/ms724832%28VS.85%29.aspx ++ if [ "$(wmic os get version | grep -o '^\(6\.[23]\|10\)')" ]; then ++ fake_distro="Windows - Modern" ++ fi ++ fi + if [[ "${distro}" == "Unknown" ]]; then + if [ -f /etc/os-release ]; then + distrib_id=$(/dev/null 2>&1; then + if [[ "$distro" =~ "BSD" ]]; then +@@ -1227,7 +1239,7 @@ + if [[ "$(echo $xResolution | wc -l)" -ge 1 ]]; then + xResolution=$(echo $xResolution | tr "\\n" "," | sed 's/\(.*\),/\1/') + fi +- elif [[ "${distro}" == "Cygwin" ]]; then ++ elif [[ "${distro}" == "Cygwin" || "${distro}" == "Msys" ]]; then + width=($(wmic desktopmonitor get screenwidth | grep -vE '[a-z]+' | tr '\r\n' ' ')) + height=($(wmic desktopmonitor get screenheight | grep -vE '[a-z]+' | tr '\r\n' ' ')) + +@@ -1250,7 +1262,7 @@ + # DE Detection - Begin + detectde () { + DE="Not Present" +- if [[ ${distro} != "Mac OS X" && ${distro} != "Cygwin" ]]; then ++ if [[ ${distro} != "Mac OS X" && ${distro} != "Cygwin" && "${distro}" != "Msys" ]]; then + if [[ -n ${DISPLAY} ]]; then + if type -p xprop >/dev/null 2>&1;then + xprop_root="$(xprop -root 2>/dev/null)" +@@ -1474,11 +1486,13 @@ + if ps -U ${USER} | grep [F]inder >/dev/null 2>&1; then + DE="Aqua" + fi +- elif [[ "${distro}" == "Cygwin" ]]; then +- winver=`wmic os get version | grep -o '^[0-9]'` +- if [ "$winver" == "7" ]; then DE='Aero' +- elif [ "$winver" == "6" ]; then DE='Aero' +- else DE='Luna'; fi ++ elif [[ "${distro}" == "Cygwin" || "${distro}" == "Msys" ]]; then ++ # https://msdn.microsoft.com/en-us/library/ms724832%28VS.85%29.aspx ++ if [ "$(wmic os get version | grep -o '^\(6\|10\)')" ]; then ++ DE='Aero' ++ else ++ DE='Luna' ++ fi + fi + verboseOut "Finding desktop environment...found as '$DE'" + } +@@ -1488,7 +1502,7 @@ + # WM Detection - Begin + detectwm () { + WM="Not Found" +- if [[ ${distro} != "Mac OS X" && ${distro} != "Cygwin" ]]; then ++ if [[ ${distro} != "Mac OS X" && ${distro} != "Cygwin" && "${distro}" != "Msys" ]]; then + if [[ -n ${DISPLAY} ]]; then + for each in "${wmnames[@]}"; do + PID="$(pgrep -U ${UID} "^$each$")" +@@ -1617,7 +1631,7 @@ + if ps -U ${USER} | grep Finder >/dev/null 2>&1; then + WM="Quartz Compositor" + fi +- elif [[ "${distro}" == "Cygwin" ]]; then ++ elif [[ "${distro}" == "Cygwin" || "${distro}" == "Msys" ]]; then + bugn=$(tasklist | grep -o 'bugn' | tr -d '\r \n') + wind=$(tasklist | grep -o 'Windawesome' | tr -d '\r \n') + if [ "$bugn" = "bugn" ]; then WM="bug.n" +@@ -1753,8 +1767,8 @@ + else + Win_theme="Graphite" + fi +- elif [[ "${distro}" == "Cygwin" ]]; then +- themeFile="$(reg query 'HKCU\Software\Microsoft\Windows\CurrentVersion\Themes' /v 'CurrentTheme' | grep -o '[A-Z]:\\.*')" ++ elif [[ "${distro}" == "Cygwin" || "${distro}" == "Msys" ]]; then ++ themeFile="$(reg query 'HKCU\Software\Microsoft\Windows\CurrentVersion\Themes' //v 'CurrentTheme' | grep -o '[A-Z]:\\.*')" + Win_theme=$(echo $themeFile | awk -F"\\" '{print $NF}' | grep -o '[0-9A-z. ]*$' | grep -o '^[0-9A-z ]*') + fi + +@@ -1995,8 +2009,8 @@ + fi + fi + +- if [ "$distro" == "Cygwin" -a "$gtkFont" == "Not Found" ]; then +- if [ -f "$HOME/.minttyrc" ]; then ++ if [[ "${distro}" == "Cygwin" || "${distro}" == "Msys" ]]; then ++ if [ "$gtkFont" == "Not Found" && -f "$HOME/.minttyrc" ]; then + gtkFont="$(grep '^Font=.*' "$HOME/.minttyrc" | grep -o '[0-9A-z ]*$')" + fi + fi +@@ -2131,9 +2145,9 @@ + + asciiText () { + # Distro logos and ASCII outputs +- if [[ "$fake_distro" ]]; then distro="${fake_distro}"; fi + if [[ "$asc_distro" ]]; then myascii="${asc_distro}" + elif [[ "$art" ]]; then myascii="custom" ++ elif [[ "$fake_distro" ]]; then myascii="${fake_distro}" + else myascii="${distro}"; fi + case ${myascii} in + "custom") source "$art" ;; +@@ -3207,7 +3221,7 @@ + "${c3} o' %s\n") + ;; + +- "Windows"|"Cygwin") ++ "Windows"|"Cygwin"|"Msys") + if [[ "$no_color" != "1" ]]; then + c1=$(getColor 'light red') # Red + c2=$(getColor 'light green') # Green +@@ -3234,6 +3248,33 @@ + "${c4} \"VEzjt:;;z>*\` %s") + ;; + ++ "Windows - Modern") ++ if [[ "$no_color" != "1" ]]; then ++ c1=$(getColor 'light blue') # Blue ++ fi ++ if [ -n "${my_lcolor}" ]; then c1="${my_lcolor}"; fi ++ startline="0" ++ fulloutput=("${c1} .., %s" ++"${c1} ....,,:;+ccllll %s" ++"${c1} ...,,+:; cllllllllllllllllll %s" ++"${c1} ,cclllllllllll lllllllllllllllllll %s" ++"${c1} llllllllllllll lllllllllllllllllll %s" ++"${c1} llllllllllllll lllllllllllllllllll %s" ++"${c1} llllllllllllll lllllllllllllllllll %s" ++"${c1} llllllllllllll lllllllllllllllllll %s" ++"${c1} llllllllllllll lllllllllllllllllll %s" ++"${c1} %s" ++"${c1} llllllllllllll lllllllllllllllllll %s" ++"${c1} llllllllllllll lllllllllllllllllll %s" ++"${c1} llllllllllllll lllllllllllllllllll %s" ++"${c1} llllllllllllll lllllllllllllllllll %s" ++"${c1} llllllllllllll lllllllllllllllllll %s" ++"${c1} \`'ccllllllllll lllllllllllllllllll %s" ++"${c1} \`'\"\"*:: :ccllllllllllllllll %s" ++"${c1} \`\`\`\`''\"*::cll %s" ++"${c1} \`\` %s") ++ ;; ++ + "Haiku") + if [[ "$no_color" != "1" ]]; then + c1=$(getColor 'black_haiku') # Black +@@ -3906,7 +3947,7 @@ + "Arch Linux - Old"|"Fedora"|"Korora"|"Chapeau"|"Mandriva"|"Mandrake"|"Chakra"|"ChromeOS"|"Sabayon"|"Slackware"|"Mac OS X"|"Trisquel"|"Kali Linux"|"Jiyuu Linux"|"Antergos"|"KaOS"|"Logos"|"gNewSense"|"NixOS") labelcolor=$(getColor 'light blue');; + "Arch Linux"|"Frugalware"|"Mageia"|"Deepin"|"CRUX") labelcolor=$(getColor 'light cyan');; + "Mint"|"LMDE"|"openSUSE"|"LinuxDeepin"|"DragonflyBSD"|"Manjaro"|"Manjaro-tree"|"Android"|"Void") labelcolor=$(getColor 'light green');; +- "Ubuntu"|"FreeBSD"|"FreeBSD - Old"|"Debian"|"Raspbian"|"BSD"|"Red Hat Enterprise Linux"|"Peppermint"|"Cygwin"|"Fuduntu"|"NetBSD"|"Scientific Linux"|"DragonFlyBSD"|"BackTrack Linux") labelcolor=$(getColor 'light red');; ++ "Ubuntu"|"FreeBSD"|"FreeBSD - Old"|"Debian"|"Raspbian"|"BSD"|"Red Hat Enterprise Linux"|"Peppermint"|"Cygwin"|"Msys"|"Fuduntu"|"NetBSD"|"Scientific Linux"|"DragonFlyBSD"|"BackTrack Linux") labelcolor=$(getColor 'light red');; + "CrunchBang"|"Solus"|"Viperr"|"elementary"*) labelcolor=$(getColor 'dark grey');; + "Gentoo"|"Parabola GNU/Linux-libre"|"Funtoo"|"Funtoo-text"|"BLAG") labelcolor=$(getColor 'light purple');; + "Haiku") labelcolor=$(getColor 'green');; +@@ -3941,10 +3982,12 @@ + buildVers=`buildVers=$(sw_vers|grep BuildVersion);echo ${buildVers:14}` + if [ -n "$distro_more" ]; then mydistro=$(echo -e "$labelcolor OS:$textcolor $distro_more $sysArch") + else mydistro=$(echo -e "$labelcolor OS:$textcolor $sysArch $distro $prodVers $buildVers"); fi +- elif [[ "$distro" == "Cygwin" ]]; then +- distro=$(wmic os get name | head -2 | tail -1) +- distro=$(expr match "$distro" '\(Microsoft Windows [A-Za-z0-9.]\+\)') +- sysArch=$(wmic os get OSArchitecture | head -2 | tail -1 | tr -d '\r ') ++ elif [[ "${distro}" == "Cygwin" || "${distro}" == "Msys" ]]; then ++ distro="$(wmic os get caption | sed 's/\r//g; s/[ \t]*$//g; 2!d')" ++ if [[ "$(wmic os get version | grep -o '^10\.')" == "10." ]]; then ++ distro="$distro (v$(wmic os get version | grep '^10\.' | tr -d ' '))" ++ fi ++ sysArch=$(wmic os get OSArchitecture | sed 's/\r//g; s/[ \t]*$//g; 2!d') + mydistro=$(echo -e "$labelcolor OS:$textcolor $distro $sysArch") + else + if [ -n "$distro_more" ]; then mydistro=$(echo -e "$labelcolor OS:$textcolor $distro_more") +@@ -4018,7 +4061,7 @@ + # [ "$gtkBackground" ] && mybg=$(echo -e "$labelcolor BG:$textcolor $gtkBackground"); out_array=( "${out_array[@]}" "$mybg" ); ((display_index++)) + fi + fi +- elif [[ "$fake_distro" == "Cygwin" ]]; then ++ elif [[ "${fake_distro}" == "Cygwin" || "${fake_distro}" == "Msys" || "${fake_distro}" == "Windows - Modern" ]]; then + if [[ "${display[@]}" =~ "res" && -n "$xResolution" ]]; then myres=$(echo -e "$labelcolor Resolution:${textcolor} $xResolution"); out_array=( "${out_array[@]}" "$myres" ); ((display_index++)); fi + if [[ "${display[@]}" =~ "de" ]]; then + if [[ "${DE}" != "Not Present" ]]; then +@@ -4034,7 +4077,7 @@ + fi + fi + fi +- [[ "${fake_distro}" != "Cygwin" ]] && if [[ "${display[@]}" =~ "disk" ]]; then mydisk=$(echo -e "$labelcolor Disk:$textcolor $diskusage"); out_array=( "${out_array[@]}" "$mydisk" ); ((display_index++)); fi ++ [[ "${fake_distro}" != "Cygwin" && "${fake_distro}" != "Msys" && "${fake_distro}" != "Windows - Modern" ]] && if [[ "${display[@]}" =~ "disk" ]]; then mydisk=$(echo -e "$labelcolor Disk:$textcolor $diskusage"); out_array=( "${out_array[@]}" "$mydisk" ); ((display_index++)); fi + if [[ "${display[@]}" =~ "cpu" ]]; then mycpu=$(echo -e "$labelcolor CPU:$textcolor $cpu"); out_array=( "${out_array[@]}" "$mycpu" ); ((display_index++)); fi + if [[ "${display[@]}" =~ "gpu" ]] && [[ "$gpu" != "Not Found" ]]; then mygpu=$(echo -e "$labelcolor GPU:$textcolor $gpu"); out_array=( "${out_array[@]}" "$mygpu" ); ((display_index++)); fi + if [[ "${display[@]}" =~ "mem" ]]; then mymem=$(echo -e "$labelcolor RAM:$textcolor $mem"); out_array=( "${out_array[@]}" "$mymem" ); ((display_index++)); fi From 68135234bba6b086dd2ee28c0b4b96461fb2d8db Mon Sep 17 00:00:00 2001 From: Marshall Banana Date: Wed, 9 Mar 2016 11:07:16 +0100 Subject: [PATCH 2/4] screenfetch: update msys2.patch --- screenfetch/PKGBUILD | 2 +- screenfetch/msys2.patch | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/screenfetch/PKGBUILD b/screenfetch/PKGBUILD index 8b593faa..d44058c0 100644 --- a/screenfetch/PKGBUILD +++ b/screenfetch/PKGBUILD @@ -14,7 +14,7 @@ depends=('bash') source=(https://github.com/KittyKatt/${_pkgname}/archive/v${pkgver}.tar.gz msys2.patch) sha256sums=('6711fe924833919d53c1dfbbb43f3777d33e20357a1b1536c4472f6a1b3c6be0' - '727d646199dd35cfe217725f8359a63f3a02797dc5eb57c9133b19ab0708e9c0') + '647e86f8c02ed015ec03ce566b912da76620da18fabdd36edaf86f7ad7c759c6') prepare() { cd "${srcdir}/${_pkgname}-${pkgver}" diff --git a/screenfetch/msys2.patch b/screenfetch/msys2.patch index 4f8f4137..35e20cac 100644 --- a/screenfetch/msys2.patch +++ b/screenfetch/msys2.patch @@ -69,7 +69,7 @@ compressedmem=$(vm_stat | grep occupied | awk '{ print $5 }' | sed 's/\.//') usedmem=$(((${wiredmem} + ${activemem} + ${compressedmem}) * 4 / $human)) - elif [ "$distro" == "Cygwin" ]; then -+ elif [ "${distro}" == "Cygwin" || "${distro}" == "Msys" ]; then ++ elif [[ "${distro}" == "Cygwin" || "${distro}" == "Msys" ]]; then total_mem=$(awk '/MemTotal/ { print $2 }' /proc/meminfo) totalmem=$((${total_mem}/$human)) free_mem=$(awk '/MemFree/ { print $2 }' /proc/meminfo) @@ -164,7 +164,7 @@ - if [ "$distro" == "Cygwin" -a "$gtkFont" == "Not Found" ]; then - if [ -f "$HOME/.minttyrc" ]; then + if [[ "${distro}" == "Cygwin" || "${distro}" == "Msys" ]]; then -+ if [ "$gtkFont" == "Not Found" && -f "$HOME/.minttyrc" ]; then ++ if [[ "$gtkFont" == "Not Found" && -f "$HOME/.minttyrc" ]]; then gtkFont="$(grep '^Font=.*' "$HOME/.minttyrc" | grep -o '[0-9A-z ]*$')" fi fi From 2ca568409357a3627c3e818169adf063bd4e5b59 Mon Sep 17 00:00:00 2001 From: Marshall Banana Date: Wed, 9 Mar 2016 11:56:01 +0100 Subject: [PATCH 3/4] screenfetch: add screenshot.patch Make it possible to upload screenshot when a custom screenshot command was used. Print a warning if no custom command was given and scrot is missing. --- screenfetch/PKGBUILD | 8 +++-- screenfetch/screenshot.patch | 60 ++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 screenfetch/screenshot.patch diff --git a/screenfetch/PKGBUILD b/screenfetch/PKGBUILD index d44058c0..88a2c671 100644 --- a/screenfetch/PKGBUILD +++ b/screenfetch/PKGBUILD @@ -9,16 +9,20 @@ arch=('any') url="https://github.com/KittyKatt/screenFetch" license=('GPL') depends=('bash') +optdepends=('curl: screenshot uploading') #optdepends=('scrot: screenshot taking' # 'curl: screenshot uploading') source=(https://github.com/KittyKatt/${_pkgname}/archive/v${pkgver}.tar.gz - msys2.patch) + msys2.patch + screenshot.patch) sha256sums=('6711fe924833919d53c1dfbbb43f3777d33e20357a1b1536c4472f6a1b3c6be0' - '647e86f8c02ed015ec03ce566b912da76620da18fabdd36edaf86f7ad7c759c6') + '647e86f8c02ed015ec03ce566b912da76620da18fabdd36edaf86f7ad7c759c6' + '26215ce8484897059943a26cc5b039243df7882b1ac741df4c2def2e6edb7c66') prepare() { cd "${srcdir}/${_pkgname}-${pkgver}" patch -p1 -i ${srcdir}/msys2.patch + patch -p1 -i ${srcdir}/screenshot.patch } build() { diff --git a/screenfetch/screenshot.patch b/screenfetch/screenshot.patch new file mode 100644 index 00000000..eca3abc2 --- /dev/null +++ b/screenfetch/screenshot.patch @@ -0,0 +1,60 @@ +Make it possible to upload screenshot when a custom screenshot command was used. +Print a warning if no custom command was given and scrot is missing. + +--- a/screenfetch-dev ++++ b/screenfetch-dev +@@ -226,10 +226,10 @@ + printf " ${bold}-N${c0} Strip all color from output.\n" + printf " ${bold}-t${c0} Truncate output based on terminal width (Experimental!).\n" + printf " ${bold}-p${c0} Portrait output.\n" +- printf " ${bold}-s(u)${c0} Using this flag tells the script that you want it\n" ++ printf " ${bold}-s [-u IMGHOST]${c0} Using this flag tells the script that you want it\n" + printf " to take a screenshot. Use the -u flag if you would like\n" + printf " to upload the screenshots to one of the pre-configured\n" +- printf " locations. These include: teknik, pomf, imgur, mediacrush, and hmp.\n" ++ printf " locations. These include: teknik, pomf, imgur, mediacrush and hmp.\n" + printf " ${bold}-c string${c0} You may change the outputted colors with -c. The format is\n" + printf " as follows: [0-9][0-9],[0-9][0-9]. The first argument controls the\n" + printf " ASCII logo colors and the label colors. The second argument\n" +@@ -2053,7 +2053,15 @@ + ####################### + + takeShot () { ++ take_screenshot="yes" + if [[ -z $screenCommand ]]; then ++ screenCommand="scrot -cd3" ++ if ! type -p scrot >/dev/null 2>&1; then ++ errorOut "Cannot take screenshot! \`scrot' not in \$PATH" ++ take_screenshot="no" ++ fi ++ fi ++ if [[ "${take_screenshot}" == "yes" ]]; then + if [[ "${upload}" == "1" ]]; then + shotfiles[1]=${shotfile} + if [ "$distro" == "Mac OS X" ]; then +@@ -2063,7 +2071,7 @@ + shotfiles[$i]="$(echo ${shotfile} | sed "s/\(.*\)\./\1_${i}./")" + done + printf "Taking shot in 3.. "; sleep 1; printf "2.. "; sleep 1; printf "1.. "; sleep 1; printf "0.\n"; screencapture -x ${shotfiles[@]} &> /dev/null +- else scrot -cd3 "${shotfile}"; fi ++ else $screenCommand "${shotfile}"; fi + if [ -f "${shotfile}" ]; then + verboseOut "Screenshot saved at '${shotfiles[@]}'" + printf "${bold}==>${c0} Uploading your screenshot now..." +@@ -2129,15 +2137,13 @@ + shotfiles[$i]="$(echo ${shotfile} | sed "s/\(.*\)\./\1_${i}./")" + done + printf "Taking shot in 3.. "; sleep 1; printf "2.. "; sleep 1; printf "1.. "; sleep 1; printf "0.\n"; screencapture -x ${shotfiles[@]} &> /dev/null +- else scrot -cd3 "${shotfile}"; fi ++ else $screenCommand "${shotfile}"; fi + if [ -f "${shotfile}" ]; then + verboseOut "Screenshot saved at '${shotfiles[@]}'" + else + errorOut "ERROR: Problem saving screenshot to ${shotfiles[@]}" + fi + fi +- else +- $screenCommand + fi + } + From b0435cd32bddd45ae60daa7b205eabbf19cf2a48 Mon Sep 17 00:00:00 2001 From: Marshall Banana Date: Wed, 9 Mar 2016 12:41:27 +0100 Subject: [PATCH 4/4] screenfetch: warn if uploading was enabled and curl is missing --- screenfetch/PKGBUILD | 2 +- screenfetch/screenshot.patch | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/screenfetch/PKGBUILD b/screenfetch/PKGBUILD index 88a2c671..75923b44 100644 --- a/screenfetch/PKGBUILD +++ b/screenfetch/PKGBUILD @@ -17,7 +17,7 @@ source=(https://github.com/KittyKatt/${_pkgname}/archive/v${pkgver}.tar.gz screenshot.patch) sha256sums=('6711fe924833919d53c1dfbbb43f3777d33e20357a1b1536c4472f6a1b3c6be0' '647e86f8c02ed015ec03ce566b912da76620da18fabdd36edaf86f7ad7c759c6' - '26215ce8484897059943a26cc5b039243df7882b1ac741df4c2def2e6edb7c66') + 'ab51f912efa8ae44847c9c1137f8f9181a8ecc942824d78b328d5afe200a299d') prepare() { cd "${srcdir}/${_pkgname}-${pkgver}" diff --git a/screenfetch/screenshot.patch b/screenfetch/screenshot.patch index eca3abc2..fb222ac1 100644 --- a/screenfetch/screenshot.patch +++ b/screenfetch/screenshot.patch @@ -1,5 +1,6 @@ -Make it possible to upload screenshot when a custom screenshot command was used. -Print a warning if no custom command was given and scrot is missing. +Make it possible to upload screenshots when a custom screenshot command was used. +Warn if no custom command was given and scrot is missing. +Warn if uploading was enabled and curl is missing. --- a/screenfetch-dev +++ b/screenfetch-dev @@ -16,7 +17,7 @@ Print a warning if no custom command was given and scrot is missing. printf " ${bold}-c string${c0} You may change the outputted colors with -c. The format is\n" printf " as follows: [0-9][0-9],[0-9][0-9]. The first argument controls the\n" printf " ASCII logo colors and the label colors. The second argument\n" -@@ -2053,7 +2053,15 @@ +@@ -2053,8 +2053,19 @@ ####################### takeShot () { @@ -30,9 +31,13 @@ Print a warning if no custom command was given and scrot is missing. + fi + if [[ "${take_screenshot}" == "yes" ]]; then if [[ "${upload}" == "1" ]]; then ++ if ! type -p curl >/dev/null 2>&1; then ++ errorOut "Cannot upload screenshot! \`curl' not in \$PATH" ++ else shotfiles[1]=${shotfile} if [ "$distro" == "Mac OS X" ]; then -@@ -2063,7 +2071,7 @@ + displays="$(system_profiler SPDisplaysDataType | grep 'Resolution:' | wc -l | tr -d ' ')" +@@ -2063,7 +2074,7 @@ shotfiles[$i]="$(echo ${shotfile} | sed "s/\(.*\)\./\1_${i}./")" done printf "Taking shot in 3.. "; sleep 1; printf "2.. "; sleep 1; printf "1.. "; sleep 1; printf "0.\n"; screencapture -x ${shotfiles[@]} &> /dev/null @@ -41,7 +46,15 @@ Print a warning if no custom command was given and scrot is missing. if [ -f "${shotfile}" ]; then verboseOut "Screenshot saved at '${shotfiles[@]}'" printf "${bold}==>${c0} Uploading your screenshot now..." -@@ -2129,15 +2137,13 @@ +@@ -2120,6 +2131,7 @@ + else + errorOut "ERROR: Problem saving screenshot to ${shotfiles[@]}" + fi ++ fi + else + shotfiles[1]=${shotfile} + if [ "$distro" == "Mac OS X" ]; then +@@ -2129,15 +2141,13 @@ shotfiles[$i]="$(echo ${shotfile} | sed "s/\(.*\)\./\1_${i}./")" done printf "Taking shot in 3.. "; sleep 1; printf "2.. "; sleep 1; printf "1.. "; sleep 1; printf "0.\n"; screencapture -x ${shotfiles[@]} &> /dev/null