From 5f74f9aa4ef1e690f4fb6bfef5ac4b973beb3c55 Mon Sep 17 00:00:00 2001 From: Steven Saus Date: Sun, 17 Dec 2023 21:35:13 -0600 Subject: [PATCH] GUI working --- patootie.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/patootie.sh b/patootie.sh index 989731c..25e00b6 100755 --- a/patootie.sh +++ b/patootie.sh @@ -23,14 +23,14 @@ fi ANSWER=$(yad --form --separator="±" --item-separator="," --columns=2 --title "patootie" \ --field="What to toot?:TXT" "" \ ---field="ComboBox:CBE" none,discrimination,bigot,uspol,medicine,violence,reproduction,healthcare,LGBTQIA,climate,SocialMedia \ +--field="ContentWarning:CBE" none,discrimination,bigot,uspol,medicine,violence,reproduction,healthcare,LGBTQIA,climate,SocialMedia \ --field="Attachment?:CHK" \ --item-separator="," --button=Cancel:99 --button=Post:0) TootText=$(echo "${ANSWER}" | awk -F '±' '{print $1}' | sed -e 's/"/“/g' -e "s/'/’/g" -e 's/—/ -- /g' -e 's/ — / -- /g' -e 's/ - / -- /g' -e 's/ – / -- /g' -e 's/ – / -- /g') ContentWarning=$(echo "${ANSWER}" | awk -F '±' '{print $2}' | sed -e 's/"/“/g' -e "s/'/’/g" -e 's/—/ -- /g' -e 's/ — / -- /g' -e 's/ - / -- /g' -e 's/ – / -- /g' -e 's/ – / -- /g') -if "$ContentWarning" == "none" ];then +if [ "$ContentWarning" == "none" ];then ContentWarning="" fi @@ -40,14 +40,13 @@ Need_Image=$(echo "$ANSWER" | awk -F '±' '{print $3}') if [ "${Need_Image}" == "TRUE" ];then IMAGE_FILE=$(yad --title "Select image to add" --width=500 --height=400 --file --file-filter "Graphic files | *.jpg *.png *.webp *.jpeg") if [ ! -f "${IMAGE_FILE}" ];then - IMAGE_FILE="" + SendImage="" else if [ -f /usr/bin/convert ];then - SendImage=$(mktemp) + SendImage=$(mktemp --suffix=.png) /usr/bin/convert -resize 800x512\! "$IMAGE_FILE" "$SendImage" fi - ALT_TEXT=$(yad --window-icon=musique --always-print-result --on-top --skip-taskbar --image-on-top --borders=5 --title "Choose your alt text" \ - --text-align=center --image "${IMAGE_FILE}" --field="Alt text to use?:TXT" "" --item-separator="," --separator="±") + ALT_TEXT=$(yad --window-icon=musique --on-top --skip-taskbar --image-on-top --borders=5 --title "Choose your alt text" --image "${SendImage}" --form --separator="±" --item-separator="," --text-align=center --field="Alt text to use?:TXT" "I was too lazy to put alt text" --item-separator="," --separator="±") fi fi @@ -72,4 +71,7 @@ else postme=$(printf "%s post \"%s\" %s %s -u %s --quiet" "$binary" "${TootText}" "${SendImage}" "${ContentWarning}" "${TOOTACCT}") eval ${postme} fi - + +if [ -f "$SendImage" ];then + rm -rf "${SendImage}" +fi