git: 9030dea42bd2 - main - x11-fonts/fontpreview: fix script to use nsxiv instead of sxiv

From: Rene Ladan <rene_at_FreeBSD.org>
Date: Fri, 01 Apr 2022 13:52:06 UTC
The branch main has been updated by rene:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9030dea42bd267ba3d93dac8c4733405a8d9f75a

commit 9030dea42bd267ba3d93dac8c4733405a8d9f75a
Author:     Rene Ladan <rene@FreeBSD.org>
AuthorDate: 2022-04-01 13:50:17 +0000
Commit:     Rene Ladan <rene@FreeBSD.org>
CommitDate: 2022-04-01 13:52:01 +0000

    x11-fonts/fontpreview: fix script to use nsxiv instead of sxiv
    
    Reported by:    jbeich
    Fixes:  1c15713f "x11-fonts/fontpreview: switch to nsixv fork"
---
 x11-fonts/fontpreview/files/patch-README.md   |  20 +++++
 x11-fonts/fontpreview/files/patch-fontpreview | 109 ++++++++++++++++++++++++--
 x11-fonts/fontpreview/pkg-descr               |   2 +-
 3 files changed, 123 insertions(+), 8 deletions(-)

diff --git a/x11-fonts/fontpreview/files/patch-README.md b/x11-fonts/fontpreview/files/patch-README.md
new file mode 100644
index 000000000000..5de69f62204d
--- /dev/null
+++ b/x11-fonts/fontpreview/files/patch-README.md
@@ -0,0 +1,20 @@
+--- README.md.orig	2020-04-08 13:27:50 UTC
++++ README.md
+@@ -3,7 +3,7 @@
+ `fontpreview` is a commandline tool that lets you **quickly search** for fonts
+ that are installed on your machine and preview them. The **fuzzy search** feature
+ is provided by `fzf` and the preview is generated with `imagemagick` and then
+-displayed using `sxiv`. This tool is **highly customizable**, almost all of the
++displayed using `nsxiv`. This tool is **highly customizable**, almost all of the
+ variables in this tool can be changed using the commandline flags or you can
+ configure them using environment variables.
+ 
+@@ -15,7 +15,7 @@ configure them using environment variables.
+ - `xdotool`
+ - `fzf`
+ - `imagemagick`
+-- `sxiv`
++- `nsxiv`
+ 
+ ## Installation
+ ### Install using `make`
diff --git a/x11-fonts/fontpreview/files/patch-fontpreview b/x11-fonts/fontpreview/files/patch-fontpreview
index b0c78ce465a9..e8dcb7b06e2d 100644
--- a/x11-fonts/fontpreview/files/patch-fontpreview
+++ b/x11-fonts/fontpreview/files/patch-fontpreview
@@ -1,11 +1,106 @@
---- fontpreview.orig	2020-04-19 12:00:29 UTC
+--- fontpreview.orig	2022-04-01 13:42:53 UTC
 +++ fontpreview
-@@ -164,7 +164,7 @@ font=$1
+@@ -2,7 +2,7 @@
+ #
+ # Siddharth Dushantha 2020
+ #
+-# Dependencies: sxiv, imagemagick, xdotool, fzf
++# Dependencies: nsxiv, imagemagick, xdotool, fzf
  
+ VERSION=1.0.6
  
- # Parse the arguments
--options=$(getopt -o hi:o: --long position:,size:,version,search-prompt:,font-size:,bg-color:,fg-color:,preview-text:,input:,output:,help -- "$@")
-+options=$(%%GETOPT%% -o hi:o: --long position:,size:,version,search-prompt:,font-size:,bg-color:,fg-color:,preview-text:,input:,output:,help -- "$@")
- eval set -- "$options"
+@@ -44,7 +44,7 @@ optional arguments:
+ pre_exit() {
+     # Get the proccess ID of this script and kill it.
+     # We are dumping the output of kill to /dev/null
+-    # because if the user quits sxiv before they
++    # because if the user quits nsxiv before they
+     # exit this script, an error will be shown
+     # from kill and we dont want that
+     kill -9 "$(cat "$PIDFILE" 2>/dev/null)" &> /dev/null
+@@ -66,7 +66,7 @@ generate_preview(){
  
- while true; do
+ main(){
+     # Checkig if needed dependencies are installed
+-    dependencies=(xdotool sxiv convert fzf)
++    dependencies=(xdotool nsxiv convert fzf)
+     for dependency in "${dependencies[@]}"; do
+         type -p "$dependency" &>/dev/null || {
+             echo "error: Could not find '${dependency}', is it installed?" >&2
+@@ -87,7 +87,7 @@ main(){
+     [[ $FONTPREVIEW_PREVIEW_TEXT != "" ]] && PREVIEW_TEXT=$FONTPREVIEW_PREVIEW_TEXT
+ 
+     # Save the window ID of the terminal window fontpreview is executed in.
+-    # This is so that when we open up sxiv, we can change the focus back to
++    # This is so that when we open up nsxiv, we can change the focus back to
+     # the terminal window, so that the user can search for the fonts without
+     # having to manualy change the focus back to the terminal.
+     xdotool getactivewindow > "$TERMWIN_IDFILE"
+@@ -109,33 +109,33 @@ main(){
+         if [[ $FIRST_RUN == true ]]; then
+             FIRST_RUN=false
+ 
+-            # Display the font preview using sxiv
+-            #sxiv -g "$SIZE$POSITION" "$FONT_PREVIEW" -N "fontpreview" -b &
+-            sxiv -N "fontpreview" -b -g "$SIZE$POSITION" "$FONT_PREVIEW" &
++            # Display the font preview using nsxiv
++            #nsxiv -g "$SIZE$POSITION" "$FONT_PREVIEW" -N "fontpreview" -b &
++            nsxiv -N "fontpreview" -b -g "$SIZE$POSITION" "$FONT_PREVIEW" &
+ 
+-            # Change focus from sxiv, back to the terminal window
++            # Change focus from nsxiv, back to the terminal window
+             # so that user can continue to search for fonts without
+             # having to manually change focus back to the terminal window
+             xdotool windowfocus "$(cat "$TERMWIN_IDFILE")"
+ 
+             # Save the process ID so that we can kill
+-            # sxiv when the user exits the script
++            # nsxiv when the user exits the script
+             echo $! >"$PIDFILE"
+ 
+-	# Check for crashes of sxiv
++	# Check for crashes of nsxiv
+ 	elif [[ -f $PIDFILE ]] ; then
+ 	    if ! pgrep -F "$PIDFILE" >/dev/null 2>&1; then
+-		echo "Restart sxiv - You maybe using a obsolete version. " >&2
+-		# Display the font preview using sxiv
+-		sxiv -g "$SIZE$POSITION" -N "fontpreview" -b "$FONT_PREVIEW" &
++		echo "Restart nsxiv - You maybe using a obsolete version. " >&2
++		# Display the font preview using nsxiv
++		nsxiv -g "$SIZE$POSITION" -N "fontpreview" -b "$FONT_PREVIEW" &
+ 
+-		# Change focus from sxiv, back to the terminal window
++		# Change focus from nsxiv, back to the terminal window
+ 		# so that user can continue to search for fonts without
+ 		# having to manually change focus back to the terminal window
+ 		xdotool windowfocus "$(cat "$TERMWIN_IDFILE")"
+ 
+ 		# Save the process ID so that we can kill
+-		# sxiv when the user exits the script
++		# nsxiv when the user exits the script
+ 		echo $! >"$PIDFILE"
+ 	    fi
+ 
+@@ -144,7 +144,7 @@ main(){
+ }
+ 
+ # Disable CTRL-Z because if we allowed this key press,
+-# then the script would exit but, sxiv would still be
++# then the script would exit but, nsxiv would still be
+ # running
+ trap "" SIGTSTP
+ 
+@@ -225,10 +225,10 @@ done
+ if [ -f "$font" ]; then
+     generate_preview "$font" "$FONT_PREVIEW"
+ 
+-    # Display the font preview using sxiv
+-    sxiv -g "$SIZE$POSITION" -N "fontpreview" -b "$FONT_PREVIEW" &
++    # Display the font preview using nsxiv
++    nsxiv -g "$SIZE$POSITION" -N "fontpreview" -b "$FONT_PREVIEW" &
+ 
+-    # For some strange reason, sxiv just doesnt have time to read the file
++    # For some strange reason, nsxiv just doesnt have time to read the file
+     sleep 0.1
+     exit
+ fi
diff --git a/x11-fonts/fontpreview/pkg-descr b/x11-fonts/fontpreview/pkg-descr
index c7a75f890347..68591d791d3f 100644
--- a/x11-fonts/fontpreview/pkg-descr
+++ b/x11-fonts/fontpreview/pkg-descr
@@ -1,7 +1,7 @@
 fontpreview is a command-line tool that lets the user to quickly search for
 fonts that are installed on their machine and preview them. The fuzzy search
 feature is provided by fzf and the preview is generated with ImageMagick and
-then displayed using sxiv. This tool is highly customizable, almost all of the
+then displayed using nsxiv. This tool is highly customizable, almost all of the
 variables in this tool can be changed using the command-line flags or the
 environment variables.