diff options
author | epoch <epoch@hack.thebackupbox.net> | 2021-10-30 00:27:43 +0000 |
---|---|---|
committer | epoch <epoch@hack.thebackupbox.net> | 2021-10-30 00:27:43 +0000 |
commit | 3c5cd5e68278f82cc071623419e1a205c6fee38b (patch) | |
tree | 72d8dc4493e399d7ea6cc094826e527ef9e4c564 /xwindowURI | |
parent | 62817acef7618bd5d6e77ffabb39aabe33f5a37c (diff) | |
parent | c38649558142ee7a02c176f373120f417633b022 (diff) | |
download | uritools-3c5cd5e68278f82cc071623419e1a205c6fee38b.tar.gz uritools-3c5cd5e68278f82cc071623419e1a205c6fee38b.zip |
Merge branch 'master' of ssh://git.thebackupbox.net/uritools
Diffstat (limited to 'xwindowURI')
-rwxr-xr-x | xwindowURI | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/xwindowURI b/xwindowURI new file mode 100755 index 0000000..6e9235a --- /dev/null +++ b/xwindowURI @@ -0,0 +1,35 @@ +#!/bin/sh +if [ ! "$1" ];then + id="$(xwinID)" +else + id="$1" +fi + +class=$(xclass -id "$id") +#echo "$class" + +case "$class" in +mupdf) + basename="$(xwintitle "$id" | rev | cut '-d ' -f5- | rev)" + echo "b: $basename" + page="$(xwintitle "$id" | tr ' ' '\n' | grep '[0-9][0-9]*/[0-9][0-9]*' | cut -d/ -f1)" + echo "$page" + for PID in $(pgrep mupdf);do + argv1="$(cat /proc/$PID/cmdline | tr '\0' '\n' | sed -n 2p)" + cd "$(readlink /proc/$PID/cwd)" + abspath="$(normalpath "$argv1")" + echo "a: $abspath" + echo "b: $basename" + if [ "$(basename "$abspath")" = "$basename" ];then + printf "file://%s#page=%s\n" "$(uriescape "$abspath")" "$page" + exit 0 + fi + done + ;; +Navigator) + xwintitle "$id" | rev | cut '-d ' -f4 | rev + ;; +*) + echo "class: $class" + ;; +esac |