chiark / gitweb /
bin/xduplic-terminal: New script: start terminals for `xduplic-copier'.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 10 May 2020 18:43:37 +0000 (19:43 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 10 May 2020 18:43:37 +0000 (19:43 +0100)
While `xduplic-copier' is awesome, it doesn't work with terminal
emulators built against GTK 3 for bogus `security' reasons.  Also,
typically, I want to start lots of terminals starting out doing slightly
different things.

Anyway, this is a simple which opens a bunch of suitable terminals based
on tags provided on the command line.

Makefile
bin/xduplic-terminal [new file with mode: 0755]

index 3a80ad46ca48aabcd3116bac7991da1734c668b8..3b8d6e523da97980ed65cb2021725bb5edbd6d90 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -305,6 +305,7 @@ SCRIPTLINKS         += xpra-start-xdummy
 SCRIPTLINKS            += play-rawk
 SCRIPTLINKS            += media-keys
 SCRIPTLINKS            += disorder-notify
+SCRIPTLINKS            += xduplic-terminal
 
 DOTCPP                 += .Xdefaults
 Xdefaults_DEFS          = -DEMACSWD=$(call mdw-conf,emacs-width,77)
diff --git a/bin/xduplic-terminal b/bin/xduplic-terminal
new file mode 100755 (executable)
index 0000000..eb094a5
--- /dev/null
@@ -0,0 +1,27 @@
+#! /usr/bin/zsh -e
+### make terminals suitable for xduplic-copier
+
+prog=${0##*/}
+usage () { echo "usage: $prog TAG ... -- COMMAND ARGS"; }
+
+typeset -a tags cmd c
+typeset -i i=1
+typeset tag
+
+for ((; i <= $#; i++)); do
+  if [[ $@[i] = "--" ]]; then break; fi
+  tags+=($@[i])
+done
+if (( i > $# )); then usage >&2; exit 2; fi
+i+=1
+for ((; i <= $#; i++)); do cmd+=($@[i]); done
+
+for tag in $tags; do
+  c=(${cmd//{}/$tag})
+  xterm -xrm "XTerm*allowSendEvents: true" \
+       -geometry 80x35 -title "xduplic: $c" \
+       -e $c&
+done
+sleep 0.5
+xduplic-copier&
+wait