-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: xtools
action: commit
revision:
path_from:
revision_from: dce7514a241d1174fe28c5f315d935f2ac74fb71:
path_to:
revision_to:

git.thebackupbox.net

xtools

git://git.thebackupbox.net/xtools

commit dce7514a241d1174fe28c5f315d935f2ac74fb71
Author: epoch <epoch@enzo.thebackupbox.net>
Date:   Wed Feb 2 07:28:50 2022 +0000

    broke on spaces before. works now. ymmv.

diff --git a/xwindowURI b/xwindowURI

index e954470c52a5111f5070863d47673f76a64d7f67..

index ..8fbb6b1513dc0e3367c3fccd1a50c5183ae9e87d 100755

--- a/xwindowURI
+++ b/xwindowURI
@@ -10,7 +10,7 @@ classB=$(xclass -id "$id" | tail -n1)

 case "$classA:$classB" in
 mupdf*)
-  basename="$(xwintitle "$id" | cut '-d ' -f1)"
+  basename="$(xwintitle "$id" | rev | cut '-d ' -f5- | rev)"
   page="$(xwintitle "$id" | tr ' ' '\n' | grep '[0-9][0-9]*/[0-9][0-9]*' | cut -d/ -f1)"
   for PID in $(pgrep mupdf);do
     ### this assumes that the filename in the window's title is argv[1] of the process.
@@ -18,7 +18,8 @@ mupdf*)
     cd "$(readlink /proc/$PID/cwd)"
     abspath="$(normalpath "$argv1")"
     if [ "$(basename "$abspath")" = "$basename" ];then
-      printf "file://%s#page=%s\n" "$abspath" "$page"
+      esc_abspath="$(uriescape "$abspath")"
+      printf "file://%s#page=%s #bookmark\n" "$esc_abspath" "$page"
       exit 0
     fi
   done

-----END OF PAGE-----

-- Response ended

-- Page fetched on Sun Jun 2 18:09:40 2024